uninormal.RdMaximum likelihood estimation of the two parameters of a univariate normal distribution.
uninormal(lmean = "identitylink", lsd = "loglink", lvar =
"loglink", var.arg = FALSE, imethod = 1, isd = NULL,
parallel = FALSE, vfl = FALSE, Form2 = NULL,
smallno = 1e-05, zero = if (var.arg)
"var" else "sd")Link functions applied to the mean and standard
deviation/variance. See Links for more choices.
Being positive quantities, a log link is the default for the
standard deviation and variance (see var.arg).
Logical.
If TRUE then the second parameter is the variance and
lsd and esd are ignored,
else the standard deviation is used
and lvar and evar are ignored.
Numeric, positive but close to 0.
Used specifically for quasi-variances; if the link for the
mean is explink then any non-positive value
of eta is replaced by this quantity (hopefully,
temporarily and only during early iterations).
See CommonVGAMffArguments for information.
If lmean = loglink then try imethod = 2.
If parallel = TRUE then the parallelism constraint
is not applied to the intercept.
See CommonVGAMffArguments for information.
This fits a linear model (LM) as the first linear/additive predictor. So, by default, this is just the mean. By default, the log of the standard deviation is the second linear/additive predictor. The Fisher information matrix is diagonal. This VGAM family function can handle multiple responses.
An object of class "vglmff"
(see vglmff-class).
The object is used by modelling functions
such as vglm,
and vgam.
Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011). Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.
gaussianff() was deprecated but has been brought back
into VGAM nominally.
It should be called Mickey Mouse.
It gives a warning and calls
uninormal
instead
(hopefully all the arguments should pass in correctly).
Users should avoid calling gaussianff();
use glm with
gaussian instead.
It is dangerous to treat what is an
uninormal fit as a
gaussianff() object.
Yet to do: allow an argument such as eq.sd that enables
the standard devations to be the same.
Also, this function used to be called normal1() too,
but it has been decommissioned.
udata <- data.frame(x2 = rnorm(nn <- 200))
udata <- transform(udata,
y1 = rnorm(nn, m = 1 - 3*x2, sd = exp(1 + 0.2*x2)),
y2a = rnorm(nn, m = 1 + 2*x2, sd = exp(1 + 2.0*x2)^0.5),
y2b = rnorm(nn, m = 1 + 2*x2, sd = exp(1 + 2.0*x2)^0.5))
fit1 <- vglm(y1 ~ x2, uninormal(zero = NULL), udata, trace = TRUE)
#> Iteration 1: loglikelihood = -511.28097
#> Iteration 2: loglikelihood = -495.53621
#> Iteration 3: loglikelihood = -492.26526
#> Iteration 4: loglikelihood = -491.78757
#> Iteration 5: loglikelihood = -491.72074
#> Iteration 6: loglikelihood = -491.71152
#> Iteration 7: loglikelihood = -491.71027
#> Iteration 8: loglikelihood = -491.7101
#> Iteration 9: loglikelihood = -491.71008
#> Iteration 10: loglikelihood = -491.71007
coef(fit1, matrix = TRUE)
#> mean loglink(sd)
#> (Intercept) 1.642739 1.0552127
#> x2 -2.784912 0.2368165
fit2 <- vglm(cbind(y2a, y2b) ~ x2, data = udata, trace = TRUE,
uninormal(var = TRUE, parallel = TRUE ~ x2,
zero = NULL))
#> Iteration 1: loglikelihood = -1168.7301
#> Iteration 2: loglikelihood = -1086.2212
#> Iteration 3: loglikelihood = -1047.7682
#> Iteration 4: loglikelihood = -1023.5978
#> Iteration 5: loglikelihood = -979.51371
#> Iteration 6: loglikelihood = -897.62281
#> Iteration 7: loglikelihood = -789.76331
#> Iteration 8: loglikelihood = -735.88666
#> Iteration 9: loglikelihood = -731.57829
#> Iteration 10: loglikelihood = -731.56259
#> Iteration 11: loglikelihood = -731.56259
coef(fit2, matrix = TRUE)
#> mean1 loglink(var1) mean2 loglink(var2)
#> (Intercept) 0.9470505 0.9470505 0.9470505 0.9470505
#> x2 1.9647801 1.9647801 1.9647801 1.9647801
# Generate data from N(mu=theta=10, sigma=theta) and estimate theta.
theta <- 10
udata <- data.frame(y3 = rnorm(100, m = theta, sd = theta))
fit3a <- vglm(y3 ~ 1, uninormal(lsd = "identitylink"), data = udata,
constraints = list("(Intercept)" = rbind(1, 1)))
fit3b <- vglm(y3 ~ 1, uninormal(lsd = "identitylink",
parallel = TRUE ~ 1, zero = NULL), udata)
coef(fit3a, matrix = TRUE)
#> mean sd
#> (Intercept) 9.906519 9.906519
coef(fit3b, matrix = TRUE) # Same as fit3a
#> mean sd
#> (Intercept) 9.906519 9.906519