lpRR: Multivariate Normal Log-likelihood and Score Functions for...

View source: R/lpmvnorm.R

lpRRR Documentation

Multivariate Normal Log-likelihood and Score Functions for Reduced Rank Covariances

Description

Computes the log-likelihood (contributions) of interval-censored observations from multivariate normal distributions with reduced rank structure and evaluates corresponding score functions.

Usage

lpRR(lower, upper, mean = 0, B, D = rep(1, nrow(B)), 
     Z, weights = 1 / ncol(Z), log.p = TRUE)
slpRR(lower, upper, mean = 0, B, D = rep(1, nrow(B)), 
      Z, weights = 1 / ncol(Z), log.p = TRUE)

Arguments

lower

vector of lower limits (one element for each dimension, J elements).

upper

vector of upper limits (one element for each dimension, J elements).

mean

vector of means (one element for each dimension, length is recycled to length of lower and upper).

B

matrix of dimension J \times K.

D

vector of J diagonal elements.

Z

matrix of standard normal random variables, with K nrows.

weights

optional weights.

log.p

logical. By default, log-probabilities are returned.

Details

Evaluates the multivariate normal log-likelihood defined by means, B and D when the covariance is Sigma = B B^\top + D over boxes defined by lower and upper. Details are given in Genz and Bretz (2009, Chapter 2.3.1.).

slpmvnorm computes the corresponding score functions with respect to lower, upper, mean, B and D.

More details can be found in the lmvnorm_src package vignette.

Value

The log-likelihood (log.p = TRUE) or corresponding probability. slpRR return the scores.

References

Genz, A. and Bretz, F. (2009), Computation of Multivariate Normal and t Probabilities. Lecture Notes in Statistics, Vol. 195. Springer-Verlag, Heidelberg.

See Also

vignette("lmvnorm_src", package = "mvtnorm")

Examples

  J <- 6
  K <- 3
  B <- matrix(rnorm(J * K), nrow = J)
  D <- runif(J)
  S <- tcrossprod(B) + diag(D)
  a <- -(2 + runif(J))
  b <- 2 + runif(J)
  M <- 1e4
  Z <- matrix(rnorm(K * M), nrow = K)
  lpRR(lower = a, upper = b, B = B, D = D, Z = Z)

mvtnorm documentation built on April 3, 2025, 8:15 p.m.