Learn R Programming

pmclust (version 0.1-1)

apecm1.step.worker: APECM1 steps for workers

Description

The APECM1 algorithm for model-based clustering of finite mixture Gaussian models with unstructured dispersions.

Usage

apecm1.step.worker(PARAM.org)

Arguments

PARAM.org
an original set of parameters generated by set.global.

Value

  • A convergent results will be returned in the other list variables containing all new parameters which represent the components of models. See the help page of PARAM or PARAM.org for details.

Details

A global variable called X.worker should exist in the .GlobalEnv environment, usually the working environment. The X.worker is the data matrix to be clustered, and this matrix has a dimension N.worker by p.

A PARAM.org will be a local variable inside apecm1.step.worker, and this variable is a list containing all parameters related to models. This function also updates in the parameters by the APECM1 algorithm, and return the convergent results. The details of list elements are initially generated by set.global.

References

High Performance Statistical Computing Website: http://thirteen-01.stat.iastate.edu/snoweye/hpsc/

Chen, W.-C. and Maitra, R. (2011) Model-based clustering of regression time series data via APECM -- an AECM algorithm sung to an even faster beat, Statistical Analysis and Data Mining, 4, 567-578.

See Also

set.global, mb.print, em.step.worker, aecm.step.worker, apecm2.step.worker.

Examples

Run this code
# Save code in a file "demo.r" and run in 4 processors by
# > mpirun -np 4 Rscript demo.r

### Setup mpi environment.
library(Rmpi)
library(pmclust)
invisible(mpi.comm.dup(0, 1))

### Generate an example data.
N.allworkers <- rep(5000, mpi.comm.size())
N.worker <- 5000
N.K.worker <- c(2000, 3000)
N <- 5000 * mpi.comm.size()
p <- 2
K <- 2
seed <- 123 + mpi.comm.rank()
data.worker <- generate.basic.worker(N.allworkers, N.worker, N.K.worker,
                                     N, p, K, seed)
X.worker <- data.worker$X.worker

### Run clustering.
PARAM.org <- set.global(K = K)
# PARAM.org <- initial.em.worker(PARAM.org)
PARAM.org <- initial.RandEM.worker(PARAM.org)
PARAM.new <- apecm1.step.worker(PARAM.org)
em.update.class.worker()

### Get results.
N.CLASS <- get.N.CLASS(K)
catmpi("# of class:", N.CLASS, "\n")

### Quit Rmpi.
mpi.quit()

Run the code above in your browser using DataLab