Learn R Programming

NPflow (version 0.10.1)

mvnpdfC: C++ implementation of multivariate normal likelihood function for multiple inputs

Description

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

Usage

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

Arguments

x
data matrix
mean
mean vector
varcovM
variance covariance matrix
Log
logical flag for returning the log of the probability density function. Defaults is TRUE

Value

vector of densities

Examples

Run this code
mvnpdf(x=matrix(1.96), mean=0, varcovM=diag(1), Log=FALSE)
mvnpdfC(x=matrix(1.96), mean=0, varcovM=diag(1), Log=FALSE)
mvnpdf(x=matrix(1.96), mean=0, varcovM=diag(1))
mvnpdfC(x=matrix(1.96), mean=0, varcovM=diag(1))

if(require(microbenchmark)){
library(microbenchmark)
microbenchmark(mvnpdf(x=matrix(1.96), mean=0, varcovM=diag(1), Log=FALSE),
               mvnpdfC(x=matrix(1.96), mean=0, varcovM=diag(1), Log=FALSE),
               times=10000L)
}else{
cat("package 'microbenchmark' not available\n")
}

Run the code above in your browser using DataLab