mvnpdf: Based on the implementation from Nino Hardt and Dicko Ahmadou...

View source: R/mvnpdf.R

mvnpdfCR Documentation

Based on the implementation from Nino Hardt and Dicko Ahmadou http://gallery.rcpp.org/articles/dmvnorm_arma/ (accessed in August 2014)

Description

This is a concise description of what the function does.

Usage

mvnpdfC(x, mean, varcovM, Log = TRUE)

timesTwo(x)

mvnpdf(x, mean = rep(0, nrow(x)), varcovM = diag(nrow(x)), Log = TRUE)

mvnpdf_invC(x, mean = rep(0, nrow(x)), varcovM = diag(nrow(x)), Log = TRUE)

mvnpdfoptim(x, mean = rep(0, nrow(x)), varcovM = diag(nrow(x)), Log = TRUE)

mvnpdfoptim_par(x, mean = rep(0, nrow(x)), varcovM = diag(nrow(x)), Log = TRUE)

mvnpdfoptim_parIter(
  x,
  mean = rep(0, nrow(x)),
  varcovM = diag(nrow(x)),
  Log = TRUE,
  ncores = 1
)

mvnpdfsmart(x, mean = rep(0, nrow(x)), varcovM = diag(nrow(x)), Log = TRUE)

Arguments

x

a p x n data matrix with n the number of observations and p the number of dimensions

mean

mean vector

varcovM

variance-covariance matrix

Log

logical flag for returning the log of the probability density function. Default is TRUE.

ncores

Number of cores used to run the code in parallel

Details

This part gives more details on the function.

Value

a list containing the input matrix x and y the multivariate-Normal probability density function computed at x

Examples

mvnpdf(x=matrix(1.96), Log=FALSE)
dnorm(1.96)

mvnpdf(x=matrix(rep(1.96, 2), nrow=2, ncol=1), Log=FALSE)
## Not run: 
n <- 10000
mb <- microbenchmark::microbenchmark(
  mvtnorm::dmvnorm(matrix(1.96, nrow = n, ncol = 2)),
  mvnpdfsmart(x=matrix(1.96, nrow = 2, ncol = n), Log=FALSE),
  mvnpdfoptim_par(x=matrix(1.96, nrow = 2, ncol = n), Log=FALSE),
  times=10L)
mb

## End(Not run)


robingenuer/mypkgr documentation built on June 10, 2022, 11:01 p.m.