Learn R Programming

SpatialTools (version 0.3.2)

condnorm.par: Calculates conditional mean and covariance matrix of multivariate normal distribution

Description

This function calculates the conditional mean and covariance matrix of a multivariate normal distribution based on observed responses. The conditional mean and a decomposition of the conditional covariance matrix are returned.

Usage

condnorm.par(y, V, Vp, Vop, coeff, X, Xp, method = "eigen")

Arguments

y
A numeric vector of length $n$ containing the observed responses.
V
A numeric matrix of size $n \times n$ containing the covariance of the observed responses.
Vp
A numeric matrix of size $np \times np$ containing the covariance of the unobserved responses.
Vop
A numeric matrix of size $n \times np$ containing the covariance between the observed and unobserved responses.
coeff
A vector of length $k$ containing the trend parameters.
X
A numeric matrix of size $n \times k$ containing the design matrix of the observed responses.
Xp
A numeric matrix of size $np \times k$ containing the design matrix of the unobserved responses.
method
A character vector indicating the method of decomposition. Current choices include eigen, chol, and svd.

Value

  • Returns a list with the following elements:
  • mcThe conditional mean.
  • decomp.VcThe decomposition of the conditional covariance matrix.

Details

It is assumed that the unconditional mean of the responses are given by X %*% coeff and Xp %*% coeff. In other words, it is assumed that the mean structure of the response is linear in the coefficients.

The covariance matrix of the unobserved responses conditional on the observed responses in not returned. Instead a decomposition of this matrix is returned. Specifically, if Vc is the conditional covariance matrix, then Vc = decomp.Vc %*% t(decomp.Vc).

See Also

decomp.cov

Examples

Run this code
data(toydata)

y <- toydata$y
V <- toydata$V
Vp <- toydata$Vp
Vop <- toydata$Vop
X <- toydata$X
Xp <- toydata$Xp

temp1 <- condnorm.par(y, V, Vp, Vop, coeff = c(1, 2, 3), X, Xp, 
    method = "eigen")

#conditional covariance matrix
Vc <- temp1$decomp.Vc %*% t(temp1$decomp.Vc)

Run the code above in your browser using DataLab