Generate from conditional normal distribution
Generates realizations from a multivariate normal distribution conditional on observed data vector
rcondnorm(nsim = 1, y, mu, mup, V, Vp, Vop, method = "eigen")
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 n times n. |
Vp |
The covariance matrix of the responses to be generated. The matrix should be symmetric and positive definite. The size must be np times np. |
Vop |
The cross-covariance matrix between the observed data and the responses to be generated. The size must be n times np. |
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. |
An np \times nsim matrix containing the nsim
realizations of the conditional normal distribution. Each column of the matrix represents a realization of the multivariate normal distribution.
Joshua French
rmvnorm
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")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.