StEM: Stochastic EM algorithm

Description Usage Arguments Value Author(s) Examples

Description

Stochastic EM algorithm

Usage

1
2
3
4
StEM(model, modelpar, theta0, data, cluster = 1:nrow(data), eta,
  control = list(), Mfun, CondVarEta, update = FALSE, m = 1, nsim = 50,
  iter = 50, stepsize = 1, burnin = nsim - 1, plot = FALSE,
  idx = 1:length(theta0), printidx = idx, printvar = FALSE, ...)

Arguments

model

String defining model

modelpar

Model parameters

theta0

Initial parameter vector

data

data-frame

cluster

See Estep

eta

See Estep

control

See Estep

Mfun

Function defining M-step

CondVarEta

Variance of proposal distribution (defaults to the identity matrix).

update

Adaptive algorithm, where the variance of the proposal distribution is updated in each E-step from the empirical distribution of the latent variables given the data (obtained from previous E-step).

m

The number of imputations to base the E-step on (m=1 => StEM)

nsim

Number of samples to draw in the E-step (a burnin period is needed!)

iter

Number of iterations of the EM-algorithm

stepsize

Scaling of the variance of the proposal distribution

burnin

For development testing only

plot

Plot coordinates 'idx' of chain

idx

Trace these coordinates

printidx

Print these coordinates in each M-step

printvar

Boolean indicating whether variance parameters should be printed

...

Additional parameters parsed on to lower-level functions.

Value

list

Author(s)

Klaus K. Holst

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
modelpar <- list(nlatent=3, ny1=4, ny2=3, npred=2)
modelpar$model <- "nsem1"
nparreg <- with(modelpar, ny1+ny2 + (ny1-1) + (ny2-1) + 2 + npred)
nparvar <- with(modelpar, ny1+ny2+nlatent)
modelpar$theta <- rep(5,nparreg+nparvar)
npar <- with(modelpar, ny1+ny2 + (ny1-1) + (ny2-1) + npred + 2 + ny1 +
ny2 + nlatent)
aa <- StEM(modelpar$model,modelpar=modelpar,theta0=modelpar$theta,data=yy,cluster=1:NROW(yy),nsim=200,iter=500,plot=FALSE,update=FALSE,stepsize=0.2,idx=15:16,m=5)
plot(aa,idx=15:16)
bb <- lava.nlin::restart(aa,stepsize=0.1,nsim=1000,update=TRUE,m=1)
bb

## End(Not run)

kkholst/lava.nlin documentation built on May 20, 2019, 10:47 a.m.