addlnorm {MQMF}R Documentation

addlnorm estimates a log-normal distribution from output of hist

Description

addlnorm estimates a log-normal distribution from the output of a histogram of a data set.

Usage

addlnorm(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 this.

Value

a 4 x N matrix of x and y values to be used to plot the fitted normal probability density function.Combined with estimates of mean(log(indata)) and log(sd(indata))

Examples

 oldpar <- par(no.readonly=TRUE)
 egdata <- rlnorm(200,meanlog=0.075,sdlog=0.5)
 outh <- hist(egdata,main="",col=2,breaks=seq(0,8,0.2))
 ans <- addlnorm(outh,egdata)
 lines(ans[,"x"],ans[,"y"],lwd=2,col=4) 
 par(oldpar)

[Package MQMF version 0.1.5 Index]