dmvnorm2: Multivariate Gaussian probability density

View source: R/distributions.r

dmvnorm2R Documentation

Multivariate Gaussian probability density

Description

This is an alternative parameterization of the ordinary multivariate Gaussian probability density.

Usage

dmvnorm2( x , Mu , sigma , Rho , log=FALSE )
rmvnorm2( n , Mu=rep(0,length(sigma)) , sigma=rep(1,length(Mu)) , 
          Rho=diag(length(Mu)) , method="chol" )

Arguments

x

Values to compute densities of

Mu

Mean vector

sigma

Vector of standard deviations

Rho

Correlation matrix

log

If TRUE, returns log-density instead of density

n

Number of random observations to sample

Details

These functions merely compose the variance-covariance matrix from separate standard deviation and correlation matrix arguments. They then use dmvnorm and rmvnorm from the mvtnorm package to perform calculations.

Author(s)

Richard McElreath

Examples

dmvnorm2( c(1,0) , Mu=c(0,0) , sigma=c(1,1) , Rho=diag(2) )
rmvnorm2( 10 , Mu=c(1,2) )

rmcelreath/rethinking documentation built on Aug. 26, 2024, 5:54 p.m.