Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rcondnorm

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 n contained the observed data.

mu

The mean vector of the observed data. Should be a vector of length n.

mup

The mean vector of the responses to be generated. Should be a vector of length np.

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.

Value

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.

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")

SpatialTools

Tools for Spatial Data Analysis

v1.0.4
GPL (>= 2)
Authors
Joshua French <joshua.french@ucdenver.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.