mstep.mvnorm: Performs re-estimation (the M-step) for a multivariate normal...

View source: R/spec_functions.R

mstep.mvnormR Documentation

Performs re-estimation (the M-step) for a multivariate normal emission distribution

Description

Re-estimates the parameters of a multivariate normal emission distribution as part of the EM algorithm for HMMs and HSMMs. This is called by the hmm and hsmm functions. It is a suitable prototype function for users wishing to design their own emission distributions.

Usage

mstep.mvnorm(x, wt)

Arguments

x

A vector of observed values

wt

A T x J matrix of weights. Column entries are the weights for respective states.

Details

Users may write functions that take the same arguments and return the same values for their own custom emission distributions.

Value

Returns the emission slot of a hmmspec or hsmmspec object

mu

A list of length J contain the mean vectors

sigma

A list of length J containing the covariance matrices

Author(s)

Jared O'Connell jaredoconnell@gmail.com

See Also

dmvnorm.hsmm, rmvnorm.hsmm

Examples

  J<-2
  initial <- rep(1/J,J)
  P <- matrix(c(.3,.5,.7,.5),nrow=J)
  b <- list(mu=list(c(-3,0),c(1,2)),sigma=list(diag(2),matrix(c(4,2,2,3), ncol=2)))
  model <- hmmspec(init=initial, trans=P, parms.emission=b,dens.emission=dmvnorm.hsmm)
  model
  train <- simulate(model, nsim=300, seed=1234, rand.emis=rmvnorm.hsmm)
  plot(train,xlim=c(0,100))
  h1 = hmmfit(train,model,mstep=mstep.mvnorm)

mhsmm documentation built on Aug. 23, 2023, 9:06 a.m.