Learn R Programming

VGAM (version 1.1-12)

trinormal: Trivariate Normal Distribution Family Function

Description

Maximum likelihood estimation of the nine parameters of a trivariate normal distribution.

Usage

trinormal(zero = c("sd", "rho"), eq.mean = FALSE,
  eq.sd = FALSE, eq.cor = FALSE,
  lmean1 = "identitylink", lmean2 = "identitylink",
  lmean3 = "identitylink",
  lsd1   = "loglink", lsd2   = "loglink", lsd3   = "loglink",
  lrho12 = "rhobitlink", lrho23 = "rhobitlink", lrho13 = "rhobitlink",
  imean1 = NULL, imean2 = NULL, imean3 = NULL,
  isd1   = NULL, isd2   = NULL, isd3   = NULL,
  irho12 = NULL, irho23 = NULL, irho13 = NULL, imethod = 1)

Value

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

Arguments

lmean1, lmean2, lmean3, lsd1, lsd2, lsd3

Link functions applied to the means and standard deviations. See Links for more choices. Being positive quantities, a log link is the default for the standard deviations.

lrho12, lrho23, lrho13

Link functions applied to the correlation parameters. See Links for more choices. By default the correlation parameters are allowed to have a value between -1 and 1, but that may be problematic when eq.cor = TRUE because they should have a value between -0.5 and 1.

imean1, imean2, imean3, isd1, isd2, isd3

See CommonVGAMffArguments for more information.

irho12, irho23, irho13, imethod, zero

See CommonVGAMffArguments for more information.

eq.mean, eq.sd, eq.cor

Logical. Constrain the means or the standard deviations or correlation parameters to be equal?

Warning

The default parameterization does not make the estimated variance-covariance matrix positive-definite. In order for the variance-covariance matrix to be positive-definite the quantity 1 - rho12^2 - rho13^2 - rho23^2 + 2 * rho12 * rho13 * rho23 must be positive, and if eq.cor = TRUE then this means that the rhos must be between -0.5 and 1.

Author

T. W. Yee

Details

For the trivariate normal distribution, this fits a linear model (LM) to the means, and by default, the other parameters are intercept-only. The response should be a three-column matrix. The three correlation parameters are prefixed by rho, and the default gives them values between \(-1\) and \(1\) however, this may be problematic when the correlation parameters are constrained to be equal, etc.. The fitted means are returned as the fitted values, which is in the form of a three-column matrix. Fisher scoring is implemented.

See Also

uninormal, binormal, rtrinorm.

Examples

Run this code
if (FALSE)   set.seed(123); nn <- 1000
tdata <- data.frame(x2 = runif(nn), x3 = runif(nn))
tdata <- transform(tdata, y1 = rnorm(nn, 1 + 2 * x2),
                          y2 = rnorm(nn, 3 + 4 * x2),
                          y3 = rnorm(nn, 4 + 5 * x2))
fit1 <- vglm(cbind(y1, y2, y3) ~ x2, data = tdata,
             trinormal(eq.sd = TRUE, eq.cor = TRUE), trace = TRUE)
coef(fit1, matrix = TRUE)
constraints(fit1)
summary(fit1)
# Try this when eq.sd = TRUE, eq.cor = TRUE:
fit2 <-
  vglm(cbind(y1, y2, y3) ~ x2, data = tdata, stepsize = 0.25,
       trinormal(eq.sd = TRUE, eq.cor = TRUE,
                 lrho12 = extlogitlink(min = -0.5),
                 lrho23 = extlogitlink(min = -0.5),
                 lrho13 = extlogitlink(min = -0.5)), trace = TRUE)
coef(fit2, matrix = TRUE)

Run the code above in your browser using DataLab