dmvnrm2: Density of multivariate normal distribution

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Density of multivariate normal distribution

Usage

1
dmvnrm2(x, mean, sigma, logd = FALSE)

Arguments

x

vector to compute the density

mean

location parameter

sigma

scale/variance parameter

logd

bool variable. If true, output log density, otherwise output true density

Value

return the density

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Y = Readjpeg(train)
K = 5
p = ncol(Y)
mean = matrix(rnorm(K*p), K, p)
sigma = array(rep(diag(p), K), dim = c(p, p, K)) 
z = matrix(0, K, nrow(Y))
for (i in 1:nrow(Y)){
  for(j in 1:nrow(mean)){
z[j,i] = dmvnrm2(Y[i, ], mean[j, ],sigma[, , j], true);
}
}

yehanxuan/tamu-689-final documentation built on Dec. 8, 2019, 5:25 p.m.