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

View source: R/trinormalCovff.R

Estimates the means and the upper-half of the (symmetric) covariance matrix of a trivariate normal distribution by maximum likelihood.

1 2 3 4 5 | ```
trinormalCovff(zero = c("var", "cov"),
lmean = "identitylink",
lvar = "loglink",
lcov = "identitylink")
``` |

`zero` |
The linear predictors modelled as intercept–only.
See |

`lmean, lvar, lcov` |
Link functions applied to the means, variances (diagonal elements of the
covariance matrix), and covariances (off-diagonal elements).
See |

This family function is similar to
`trinormal`

. The only difference is
that the variances and covariances, instead of the
standard deviations and correlation coefficients ,
are directly modelled and estimated.
Similarly, `trinormalCovff`

also fits linear models to the means of a trivariate normal distribution.

The fitted means are returned as the fitted values in the form of a
three–column matrix. By default, the variances and covariances
are modelled as intercept–only, where a
`loglink`

link is applied to the variances
and a `identitylink`

over
the covariances.

An object of class `"vglmff"`

(see `vglmff-class`

) to be
used by VGLM/VGAM modelling functions, e.g.,
`vglm`

or `vgam`

.

Victor Miranda.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ```
set.seed(123); nn <- 350
var1 <- exp(1.5); var2 <- exp(0.75); var3 <- exp(1.0)
### Artificial data, with two covariates.
tdata <- data.frame(x2 = runif(nn), x3 = runif(nn))
tdata <- transform(tdata,
y1 = rnorm(nn, 1 + 2 * x2, sd = sqrt(var1)),
y2 = rnorm(nn, 3 + 1 * x2, sd = sqrt(var2)),
y3 = rnorm(nn, 3 - 1 * x3, sd = sqrt(var2 * var3)))
### Fit the model using VGAMextra::trinormalCovff().
fit.trinormCovff <- vglm(cbind(y1, y2, y3) ~ x2 + x3,
trinormalCovff,
data = tdata, trace = TRUE)
summary(fit.trinormCovff)
vcov(fit.trinormCovff)
### Fitting the model using VGAM::trinormal()
fit.trinormVGAM <- vglm(cbind(y1, y2, y3) ~ x2 + x3,
trinormal,
data = tdata, trace = TRUE)
summary(fit.trinormVGAM)
vcov(fit.trinormVGAM)
#### Compare the estimated coefficients. Note that
#### trinormal() estimaes the sd's and correlation coeffs.
coef(fit.trinormCovff, matrix = TRUE)
coef(fit.trinormVGAM, matrix = TRUE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.