mpk: Fit Mixtures of Perturbed Kernels

Description Usage Arguments Details Value Examples

View source: R/mpk.R

Description

This function generates draws from the posterior of Mixtures of Perturbed Kernels.

Usage

1
mpk(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 Number of mixture components. 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.

Details

For i = 1, …, n_j and j = 1, …, J:

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

where

(w_{j,1}, …, w_{j,K}) | α \sim Dirichlet(α/K)

μ_{j,k} | μ_{0,k} ε_k, Σ_k \sim Normal(μ_{0,k}, ε_k Σ_k)

ε_k | ε_0 \sim Inv-Gamma( τ_{ε} + 1, ε_0 τ_{ε} )

μ_{0,k} | Σ_k, k_0 \sim Normal(m_1, Σ_k / k_0)

Σ_{k}^{-1}| Ψ_1 \sim Wishart(Ψ_1, ν_1).

In addition, there are the following hyperpriors:

α \sim Gamma(τ_{α, 1}, τ_{α, 2} )

ε_0 \sim Beta(τ_{ε_0,1}, τ_{ε_0,2} )

m_1 \sim Normal(m_2, S_2)

k_0 \sim Gamma(τ_{γ,1}/2, τ_{γ,2}/2 )

Ψ_1 \sim Inv-Wishart(Ψ_2, ν_2)

Value

A MPK 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 = mpk(Y, C)

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