posnormal1 {VGAM} | R Documentation |
Fits a positive (univariate) normal distribution.
posnormal1(lmean="identity", lsd="loge", emean=list(), esd=list(), imean=NULL, isd=NULL, zero=NULL)
lmean, lsd |
Link functions for the mean and standard
deviation parameters of the usual univariate normal distribution.
They are mu and sigma respectively.
See Links for more choices.
|
emean, esd |
List. Extra argument for each of the links.
See earg in Links for general information.
|
imean, isd |
Optional initial values for mu and sigma.
A NULL means a value is computed internally.
|
zero |
An integer-valued vector specifying which
linear/additive predictors are modelled as intercepts only.
The values must be from the set {1,2} corresponding
respectively to mu, sigma.
If zero=NULL then all linear/additive predictors are modelled as
a linear combination of the explanatory variables.
For many data sets having zero=2 is a good idea.
|
The positive normal distribution is the ordinary normal distribution but with the probability of zero or less being zero. The rest of the probability density function is scaled up. Hence the probability density function can be written
f(y) = (1/(sqrt(2*pi)*sigma)) * exp( -0.5 * (y-mu)^2/ sigma^2) / [1-Phi(-mu/ sigma)]
where Phi is the cumulative distribution function of a
standard normal (pnorm
).
Equivalently, this is
f(y) = (1/sigma) * dnorm((y-mu)/sigma) / [1-pnorm(-mu/ sigma)].
where dnorm() is the probability density function of a
standard normal distribution (dnorm
).
The mean of Y is
E(Y) = mu + sigma * dnorm((y-mu)/sigma) / [1-pnorm(-mu/ sigma)].
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
Under- or over-flow may occur if the data is ill-conditioned.
The response variable for this family function is the same as
normal1
except positive values are required.
Reasonably good initial values are needed.
Fisher scoring is implemented.
The distribution of the reciprocal of a positive normal random variable is known as an alpha distribution.
Thomas W. Yee
Documentation accompanying the VGAM package at http://www.stat.auckland.ac.nz/~yee contains further information and examples.
m = 1.0; SD = exp(1.0) y = rposnorm(n <- 1000, m=m, sd=SD) ## Not run: hist(y, prob=TRUE, main=paste("posnorm(m=",m,", sd=",round(SD,2),")")) fit = vglm(y ~ 1, fam=posnormal1, trace=TRUE) coef(fit, mat=TRUE) (Cfit = Coef(fit)) mygrid = seq(min(y), max(y), len=200) # Add the fit to the histogram ## Not run: lines(mygrid, dposnorm(mygrid, Cfit[1], Cfit[2]), col="red")