mpg: Fit Mixtures of Perturbed Gaussians

Description Usage Arguments Details Value Examples

Description

This function generates a sample from the posterior of Mixtures of Perturbed Gaussians.

Usage

1
mpg(Y, C, prior = NULL, mcmc = NULL, state = NULL)

Arguments

Y

Matrix of the data. Each row represents an observation.

C

Vector of the group label of each observation. Labels are integers starting from 1.

prior

A list giving the prior information. If unspecified, a default prior is used. The list includes the following hyparameters: K_0 Number of mixture components with shared weights. K_1 Number of mixture components with independent weights. epsilon_range Vector with minimum and maximum values for epsilon. merge_step Introduce step to merge mixture components with small KL divergence. Default is merge_step = TRUE. merge_par Parameter controlling merging radius. Default is merge_par = 0.1.

mcmc

A list giving the MCMC parameters. If unspecified, default parameters are used. The list includes the following parameters: nburn indicates the number of burn-in scans, nsave indicates the number of scans to be saved, nskip indicates the thinning interval, ndisplay indicates the number of scans to be displayed on screen. The total number of scans is equal to nburn + nsave*nskip.

state

Initial state of the chain. At the moment only the latent variables Z can be initialized.

Details

y_{i,j} = ∑_{k=1}^{K_0+K_1}π_{j,k}N(y_{i,j} | μ_{j,k}, Σ_k )

where i = 1, …, n_j and j = 1, …, J. The weights are defined as follows:

π_{j,k} = ρ w_{0,k} \;\;\; k = 1, …, K_0,

π_{j,k} = (1 - ρ) w_{j,k + K_0} \;\;\; k = 1, …, K_1,

where

(w_{0,1}, …, w_{0,K_0}) \sim Dirichlet(α_0/K_0)

(w_{j,1}, …, w_{j,K_1}) \sim Dirichlet(α_j/K_1)

Value

A MPG object.

Examples

1
2
3
4
5
6
7
8
9
n = c(250, 250)
p = 4

Y1 = rbind( matrix( rnorm( n[1]*p), ncol = p), matrix( rnorm(n[2]*p) + 3, ncol = p))
Y2 = rbind( matrix( rnorm( n[1]*p), ncol = p), matrix( rnorm(n[2]*p) + 4, ncol = p))
Y = rbind(Y1, Y2)
C = c( rep(1,sum(n)), rep(2,sum(n)))

ans = mpg(Y, C)

jacsor/MPG documentation built on May 18, 2019, 9:05 a.m.