init_matrixmixture: Initializing settings for Matrix Mixture Models

Description Usage Arguments Value See Also Examples

View source: R/mixnorm.R

Description

Providing this will generate a list suitable for use as the init argument in the matrixmixture function. Either provide data and it will select centers and variance matrices to initialize or provide initial values and it will format them as expected for the function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
init_matrixmixture(
  data,
  prior = NULL,
  K = length(prior),
  centers = NULL,
  U = NULL,
  V = NULL,
  centermethod = "kmeans",
  varmethod = "identity",
  model = "normal",
  init = NULL,
  ...
)

Arguments

data

data, p * q * n array

prior

prior probability. One of prior and K must be provided. They must be consistent if both provided.

K

number of groups

centers

(optional) either a matrix or an array of p * p matrices for use as the centers argument. If fewer than K are provided, the remainder are chosen by centermethod.

U

(optional) either a matrix or an array of p * p matrices for use as the U argument. If a matrix is provided, it is duplicated to provide an array. If an array is provided, it should have K slices.

V

(optional) either a matrix or an array of matrices for use as the V argument. If a matrix is provided, it is duplicated to provide an array. If an array is provided, it should have K slices.

centermethod

what method to use to generate initial centers. Currently support random start (random) or performing k-means (kmeans) on the vectorized version for a small number of iterations and then converting back. By default, if K centers are provided, nothing will be done.

varmethod

what method to use to choose initial variance matrices. Currently only identity matrices are created. By default, if U and V matrices are provided, nothing will be done.

model

whether to use a normal distribution or a t-distribution, not relevant for more initialization methods.

init

(optional) a (possibly partially-formed) list with some of the components centers, U, and V. The function will complete the list and fill out missing entries.

...

Additional arguments to pass to kmeans() if that is centermethod.

Value

a list suitable to use as the init argument in matrixmixture:

centers

the group means, a p * q * K array.

U

the between-row covariance matrices, a p * p * K array

V

the between-column covariance matrix, a q * q * K array

See Also

matrixmixture()

Examples

1
2
3
4
5
6
7
8
9
 set.seed(20180221)
A <- rmatrixt(30,mean=matrix(0,nrow=3,ncol=4), df = 10)
# 3x4 matrices with mean 0
B <- rmatrixt(30,mean=matrix(2,nrow=3,ncol=4), df = 10)
# 3x4 matrices with mean 2
C <- array(c(A,B), dim=c(3,4,60)) # combine into one array
prior <- c(.5,.5) # equal probability prior
init = init_matrixmixture(C, prior = prior)
# will find two centers using the "kmeans" method on the vectorized matrices

gzt/MixMatrix documentation built on Nov. 18, 2021, 11:02 a.m.