compute_sufficient_statistics_given_mu: Compute sufficient statistics given mu

Description Usage Arguments Value Author(s) Examples

View source: R/fabMix.R

Description

Compute sufficient statistics given y, z and μ.

Usage

1

Arguments

y

n\times q matrix of factors

z

Allocation vector

K

Number of components

x_data

n\times p matrix with observed data

mu

K\times p matrix with marignal means per component

Value

A list with six entries of sufficient statistics.

cluster_size

Integer vector of length K

sx

K\times p array

sy

K\times q array

sxx

Not used

syy

K\times q \times q array

sxy

K\times p \times q array

Author(s)

Panagiotis Papastamoulis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
        data(waveDataset1500)
        x_data <- as.matrix(waveDataset1500[ 1:20, -1]) # data
        z <-  waveDataset1500[ 1:20, 1] # class
        p <- dim(x_data)[2]
        n <- dim(x_data)[1]
        q <- 2
        K <- length(table(z))           # 3 classes
        # give some arbitrary values to the parameters:
        set.seed(1)
        mu <- array( runif(K * p), dim = c(K,p) )
	y <- array(rnorm(n = q*n), dim = c(n,q))
	# compute sufficient stats 
	suf_stat <- compute_sufficient_statistics_given_mu(y = y, 
	 z = z, K = K, x_data = x_data, mu = mu)

fabMix documentation built on Feb. 20, 2020, 1:09 a.m.