addnorm {MQMF} | R Documentation |
addnorm adds a normal distribution to a histogram of a data set.
Description
addnorm adds a normal distribution to a histogram of a data set. This is generally to be used to illustrate whether log-transformation normalizes a set of catch or cpue data.
Usage
addnorm(inhist, xdata, inc = 0.01)
Arguments
inhist |
is the output from a call to 'hist' (see examples) |
xdata |
is the data that is being plotted in the histogram. |
inc |
defaults to a value of 0.01; is the fine grain increment used to define the normal curve. The histogram breaks should be coarse grained relative to inc. |
Value
a list with a vector of 'x' values and a vector of 'y' values (to be used to plot the fitted normal probability density function), and a vector called 'stats' containing the mean and standard deviation of the input data
Examples
oldpar <- par(no.readonly=TRUE)
x <- rnorm(1000,mean=5,sd=1)
#plotprep(height=6,width=4,newdev=FALSE)
par(mfrow= c(1,1),mai=c(0.5,0.5,0.3,0.05))
par(cex=0.75, mgp=c(1.5,0.35,0), font.axis=7)
outH <- hist(x,breaks=25,col=3,main="")
nline <- addnorm(outH,x)
lines(nline$x,nline$y,lwd=3,col=2)
print(nline$stats)
par(oldpar)
[Package MQMF version 0.1.5 Index]