The multivariate normal mixture density and auxiliary functions.
Details
Each entry in the ...
argument list is a numeric
vector defining one component of the mixture multivariate
normal distribution. The first entry of the component defining
vector is the weight of the mixture component followed by the
vector of means in each dimension and finally a specification
of the covariance matrix, which depends on the chosen
parametrization. The covariance matrix is expected to be given
as numeric vector in a column-major format, which is standard
conversion applied to matrices by the vector concatenation
function c
. Please refer to the examples
section below.
Each component defining vector can be specified in different ways
as determined by the param
option:
- ms
Mean vector and covariance matrix
s
. Default.- mn
Mean vector and number of observations.
n
determines the covariance for each component via the relation \(\Sigma/n\) with \(\Sigma\) being the known reference covariance.
The reference covariance \(\Sigma\) is the known covariance in
the normal-normal model (observation covariance). The function
sigma
can be used to query the reference covariance and may
also be used to assign a new reference covariance, see examples
below. In case sigma
is not specified, the user has to
supply sigma
as argument to functions which require a
reference covariance.
Examples
S <- diag(c(1, 2)) %*% matrix(c(1, 0.5, 0.5, 1), 2, 2) %*% diag(c(1, 2))
mvnm1 <- mixmvnorm(rob=c(0.2, c(0, 0), diag(c(5, 5))),
inf=c(0.8, c(0.5, 1), S/10), sigma=S)
print(mvnm1)
#> Multivariate normal mixture
#> Outcome dimension: 2
#> Reference covariance:
#> 1 2
#> 1 1 1
#> 2 1 4
#> Mixture Components:
#> rob inf
#> w 0.2000000 0.8000000
#> m[1] 0.0000000 0.5000000
#> m[2] 0.0000000 1.0000000
#> s[1] 2.2360680 0.3162278
#> s[2] 2.2360680 0.6324555
#> rho[2,1] 0.0000000 0.5000000
summary(mvnm1)
#> $mean
#> 1 2
#> 0.4 0.8
#>
#> $cov
#> 1 2
#> 1 1.12 0.16
#> 2 0.16 1.48
#>
set.seed(657846)
mixSamp1 <- rmix(mvnm1, 500)
colMeans(mixSamp1)
#> 1 2
#> 0.3695877 0.7900870