R: C++ implementation of multivariate Normal probability density...

mmvtpdfC {NPflow} | R Documentation

## C++ implementation of multivariate Normal probability density function for multiple inputs

### Description

C++ implementation of multivariate Normal probability density function for multiple inputs

### Usage

    mmvtpdfC(x, mean, varcovM, df, Log = TRUE)

### Arguments

`x` | data matrix of dimension `p x n`, `p` being the dimension of the data and n the number of data points.
`mean` | mean vectors matrix of dimension `p x K`, `K` being the number of distributions for which the density probability has to be evaluated.
`varcovM` | list of length `K` of variance-covariance matrices, each of dimensions `p x p`.
`df` | vector of length `K` of degree of freedom parameters.
`Log` | logical flag for returning the log of the probability density function. Defaults is `TRUE`.

### Value

matrix of densities of dimension `K x n`.

### Author(s)

Boris Hejblum

### Examples

    mvnpdf(x=matrix(1.96), mean=0, varcovM=diag(1), Log=FALSE)
    mvtpdf(x=matrix(1.96), mean=0, varcovM=diag(1), df=10000000, Log=FALSE)
    mmvtpdfC(x=matrix(1.96), mean=matrix(0), varcovM=list(diag(1)), df=10000000, Log=FALSE)

    mvnpdf(x=matrix(1.96), mean=0, varcovM=diag(1))
    mvtpdf(x=matrix(1.96), mean=0, varcovM=diag(1), df=10000000)
    mmvtpdfC(x=matrix(1.96), mean=matrix(0), varcovM=list(diag(1)), df=10000000)

    mvtpdf(x=matrix(1.96), mean=0, varcovM=diag(1), df=10)
    mmvtpdfC(x=matrix(1.96), mean=matrix(0), varcovM=list(diag(1)), df=10)

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

[Package NPflow version 0.13.3 Index]