Positive Normal Distribution Family Function
Fits a positive (univariate) normal distribution.
posnormal(lmean = "identitylink", lsd = "loglink", eq.mean = FALSE, eq.sd = FALSE, gmean = exp((-5:5)/2), gsd = exp((-1:5)/2), imean = NULL, isd = NULL, probs.y = 0.10, imethod = 1, nsimEIM = NULL, zero = "sd")
lmean, lsd |
Link functions for the mean and standard
deviation parameters of the usual univariate normal distribution.
They are mu and sigma respectively.
See |
gmean, gsd, imethod |
See |
imean, isd |
Optional initial values for mu and sigma.
A |
eq.mean, eq.sd |
See |
zero, nsimEIM, probs.y |
See |
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)].
This family function handles multiple responses.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
It is recommended that trace = TRUE
be used to monitor convergence;
sometimes the estimated mean is -Inf
and the
estimated mean standard deviation is Inf
, especially
when the sample size is small.
Under- or over-flow may occur if the data is ill-conditioned.
The response variable for this family function is the same as
uninormal
except positive values are required.
Reasonably good initial values are needed.
The distribution of the reciprocal of a positive normal random variable is known as an alpha distribution.
Thomas W. Yee
pdata <- data.frame(Mean = 1.0, SD = exp(1.0)) pdata <- transform(pdata, y = rposnorm(n <- 1000, m = Mean, sd = SD)) ## Not run: with(pdata, hist(y, prob = TRUE, border = "blue", main = paste("posnorm(m =", Mean[1], ", sd =", round(SD[1], 2),")"))) ## End(Not run) fit <- vglm(y ~ 1, posnormal, data = pdata, trace = TRUE) coef(fit, matrix = TRUE) (Cfit <- Coef(fit)) mygrid <- with(pdata, seq(min(y), max(y), len = 200)) # Add the fit to the histogram ## Not run: lines(mygrid, dposnorm(mygrid, Cfit[1], Cfit[2]), col = "orange")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.