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

View source: R/mvnpdf.R

mvnpdfoptimCR 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

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

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

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)

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

mvnpdfsmart_parpb(
  x,
  mean = rep(0, nrow(x)),
  varcovM = diag(nrow(x)),
  Log = TRUE,
  ncpus = 1
)

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

mvnpdfsmart_sleepy_par(
  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 parallel cores to split task over when using itertools

ncpus

number of cores for parallelized pbapply

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)


borishejblum/mypkgr documentation built on Sept. 24, 2023, 1:41 p.m.