uninormal: Univariate Normal Distribution

Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples

View source: R/family.normal.R

Description

Maximum likelihood estimation of the two parameters of a univariate normal distribution.

Usage

1
2
3
uninormal(lmean = "identitylink", lsd = "loglink", lvar = "loglink",
          var.arg = FALSE, imethod = 1, isd = NULL, parallel = FALSE,
          smallno = 1e-05, zero = if (var.arg) "var" else "sd")

Arguments

lmean, lsd, lvar

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).

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.

smallno

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).

imethod, parallel, isd, zero

See CommonVGAMffArguments for more information. If lmean = loglink then try imethod = 2. If parallel = TRUE then the parallelism constraint is not applied to the intercept.

Details

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.

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, and vgam.

Warning

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.

Note

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.

Author(s)

T. W. Yee

References

Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011). Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.

See Also

posnormal, mix2normal, ordsup, normal.vcm, Qvar, tobit, cens.normal, foldnormal, skewnormal, double.cens.normal, SURff, AR1, huber2, studentt, binormal, trinormal, dnorm, simulate.vlm, hdeff.vglm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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), data = udata, trace = TRUE)
coef(fit1, matrix = TRUE)
fit2 <- vglm(cbind(y2a, y2b) ~ x2, data = udata, trace = TRUE,
             uninormal(var = TRUE, parallel = TRUE ~ x2,
                       zero = NULL))
coef(fit2, matrix = TRUE)

# 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), data = udata)
coef(fit3a, matrix = TRUE)
coef(fit3b, matrix = TRUE)  # Same as fit3a

Example output

Loading required package: stats4
Loading required package: splines
VGLM    linear loop  1 :  loglikelihood = -502.62168
VGLM    linear loop  2 :  loglikelihood = -476.33344
VGLM    linear loop  3 :  loglikelihood = -471.3409
VGLM    linear loop  4 :  loglikelihood = -471.12187
VGLM    linear loop  5 :  loglikelihood = -471.11932
VGLM    linear loop  6 :  loglikelihood = -471.11927
VGLM    linear loop  7 :  loglikelihood = -471.11927
                 mean  loge(sd)
(Intercept)  0.856378 0.9484291
x2          -2.958116 0.2179926
VGLM    linear loop  1 :  loglikelihood = -1232.7318
VGLM    linear loop  2 :  loglikelihood = -1155.4069
VGLM    linear loop  3 :  loglikelihood = -1151.2022
VGLM    linear loop  4 :  loglikelihood = -1150.4512
VGLM    linear loop  5 :  loglikelihood = -1149.9159
VGLM    linear loop  6 :  loglikelihood = -1149.6691
VGLM    linear loop  7 :  loglikelihood = -1149.5066
VGLM    linear loop  8 :  loglikelihood = -1149.3991
VGLM    linear loop  9 :  loglikelihood = -1149.3197
VGLM    linear loop  10 :  loglikelihood = -1149.2581
VGLM    linear loop  11 :  loglikelihood = -1149.2085
VGLM    linear loop  12 :  loglikelihood = -1149.1672
VGLM    linear loop  13 :  loglikelihood = -1149.1323
VGLM    linear loop  14 :  loglikelihood = -1149.1022
VGLM    linear loop  15 :  loglikelihood = -1149.076
VGLM    linear loop  16 :  loglikelihood = -1149.0528
VGLM    linear loop  17 :  loglikelihood = -1149.032
VGLM    linear loop  18 :  loglikelihood = -1149.0133
VGLM    linear loop  19 :  loglikelihood = -1148.9961
VGLM    linear loop  20 :  loglikelihood = -1148.9803
VGLM    linear loop  21 :  loglikelihood = -1148.9655
VGLM    linear loop  22 :  loglikelihood = -1148.9517
VGLM    linear loop  23 :  loglikelihood = -1148.9385
VGLM    linear loop  24 :  loglikelihood = -1148.9259
VGLM    linear loop  25 :  loglikelihood = -1148.9138
VGLM    linear loop  26 :  loglikelihood = -1148.902
VGLM    linear loop  27 :  loglikelihood = -1148.8905
VGLM    linear loop  28 :  loglikelihood = -1148.8791
VGLM    linear loop  29 :  loglikelihood = -1148.8677
VGLM    linear loop  30 :  loglikelihood = -1148.8563
Warning message:
In vglm.fitter(x = x, y = y, w = w, offset = offset, Xm2 = Xm2,  :
  convergence not obtained in 30 IRLS iterations
                mean1 loge(var1)     mean2 loge(var2)
(Intercept) 2.0137007  2.0137007 2.0137007  2.0137007
x2          0.9142307  0.9142307 0.9142307  0.9142307
                mean       sd
(Intercept) 9.271576 9.271576
                mean       sd
(Intercept) 9.271576 9.271576

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.