Maximum likelihood estimation of the Multivariate Normal distribution. The covariances (not correlation coefficients) are included in the parameter vector.
MVNcov(zero = c("var", "cov"), lmean = "identitylink", lvar = "loglink", lcov = "identitylink")
Integer or character–string vector.
Which linear predictors are intercept–only.
VGLM–link functions applied to the means, variances and covariances.
K–dimensional normal distribution,
this fits a linear model to the
j = 1, \ldots, K, which are the
first entries in the linear predictor. The variances
j = 1, \ldots, K
and then the covariances
i = 1, \ldots, K,
j = i + 1, \ldots, K, are next aligned.
The fitted means are returned as the fitted values.
The log–likelihood is computed via
an implementation of the multivariate Normal density.
The score and expected information matrices are internally computed at each Fisher scoring step, using its vectorized form.
The response should be an
The covariances may be any real number so that
is a reasonable choice.
For further details on VGLM/VGAM–link functions, see
An object of class
vglmff-class) to be
used by VGLM/VGAM modelling functions, e.g.,
Unlike other implementations, e.g.,
VGAM in terms of
\rho and standard deviations,
the variances and covariances, modeled as intercept–only.
zero, whose default is
to change this.
Thus far, there is no guarantee that the estimated var–cov matrix will be
positive–definite. Proper procedures to validate this will
be incorporated shortly, such as the
Although the function has been tested on
K \leq 5
data sets, it is recommended that
K \leq 3,
unless the data are nice and
n is sufficiently large.
# K = 3. set.seed(180227) nn <- 85 mvndata <- data.frame(x2 = runif(nn), x3 = runif(nn)) mvndata <- transform(mvndata, y = rbinorm(nn, mean1 = 2 - 2 * x2 + 1 * x3, mean2 = 2 - 1.5 * x3, var1 = exp(1.0), var2 = exp(-0.75), cov12 = 0.5 * exp(1.0) * exp(-0.75))) mvndata <- transform(mvndata, y3 = rnorm(nn, mean = 2 + x2, sd = exp(1.5))) colnames(mvndata) <- c("x2", "x3", "y1", "y2", "y3") mvnfit <- vglm(cbind(y1, y2, y3) ~ x2 + x3, MVNcov, data = mvndata, trace = TRUE) (mvncoef <- coef(mvnfit, mat = TRUE)) ## Check variances and covariances: var1, var2 and var3. exp(mvncoef[c(10, 13, 16)]) # True are var1 = exp(1.0) = 2.718, # var2 = exp(-0.75) = 0.472 # and var3 = exp(1.5)^2 = 20.08554 vcov(mvnfit) constraints(mvnfit) summary(mvnfit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.