Learn R Programming

VGAM (version 1.1-14)

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)

Arguments

Value

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

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