rcondnorm {SpatialTools} | R Documentation |
Generate from conditional normal distribution
Description
Generates realizations from a multivariate normal distribution conditional on observed data vector
Usage
rcondnorm(nsim = 1, y, mu, mup, V, Vp, Vop, method = "eigen")
Arguments
nsim |
An integer indicating the number of realizations from the distribution. |
y |
A vector of length |
mu |
The mean vector of the observed data. Should be a vector of length |
mup |
The mean vector of the responses to be generated. Should be a vector of length |
V |
The covariance matrix of the observed data. The matrix should be symmetric and positive definite. The size must be |
Vp |
The covariance matrix of the responses to be generated. The matrix should be symmetric and positive definite. The size must be |
Vop |
The cross-covariance matrix between the observed data and the responses to be generated. The size must be |
method |
The method for performing a decomposition of the covariance matrix. Possible values are "eigen", "chol", and "svd", Eigen value decomposition, Cholesky decomposition, or Singular Value Decomposoition, respectively. |
Value
An matrix containing the
nsim
realizations of the conditional normal distribution. Each column of the matrix represents a realization of the multivariate normal distribution.
Author(s)
Joshua French
See Also
rmvnorm
Examples
n <- 100
np <- 100
mu <- rep(1, 100)
mup <- rep(2, 100)
coords <- matrix(runif(2 * n), ncol = 2)
pcoords <- matrix(runif(2 * np), ncol = 2)
myV <- cov.sp(coords, sp.type = "exponential", c(1, 2), error.var = 1, pcoords = pcoords)
y <- rmvnorm(1, mu = mu, V = myV$V)
rcondnorm(3, y = y, mu = mu, mup = mup, V = myV$V, Vp = myV$Vp, Vop = myV$Vop, method = "chol")