Learn R Programming

snipEM (version 1.0.1)

ldmvnorm: Multivariate Normal Log-Density for Complete and Incomplete Data

Description

This function provides the log-density function for the multivariate normal distribution with mean equal to mu and covariance matrix Sigma. Marginal distributions will be used when the vector (or matrix) of quantiles is incomplete. That is, when the vector (or matrix) of quantiles contain NA.

Usage

ldmvnorm(x, mu, Sigma, onNA=0)

Arguments

x

Vector or matrix of quantiles. If x is a matrix, each row is taken to be a quantile.

mu

Mean vector, default is rep(0, length = ncol(x))

Sigma

Covariance matrix, default is diag(ncol(x)).

onNA

Action for a row on NAs. Default is to return 0.

Examples

Run this code
# NOT RUN {
x <- matrix(rnorm(1000),100, 10)
u <- matrix(rbinom(1000, 1, 0.1), 100, 10)
x[ u == 1 ] <- NA
mu <- rep(0,10)
Sigma <- diag(10)
ldmvnorm(x, mu, Sigma)
# }

Run the code above in your browser using DataLab