simulate.hhsmmspec: Simulation of data from hhsmm model

View source: R/simulate-hhsmm.R

simulate.hhsmmspecR Documentation

Simulation of data from hhsmm model

Description

Simulates a data set of class "hhsmmdata" using a hhsmmspec model

Usage

## S3 method for class 'hhsmmspec'
simulate(
  object,
  nsim,
  seed = NULL,
  remission = rmixmvnorm,
  ...,
  emission.control = list(autoregress = FALSE, lags = 1, start = list(mean = NULL, cov =
    NULL))
)

Arguments

object

a hhsmmspec model

nsim

a vector of sequence lengths (might be of length 1)

seed

a random seed to be set

remission

a random emission generation function (default = rmixmvnorm)

...

additional parameters of the remission function

emission.control

a list of additional control parameters including the following items:

  • autoregress logical. if TRUE the auto-regressive data generation will be considered with rmixar function

  • lags a positive integer which is the number of lags to be considered for the auto-regressive sequence

  • start a list containing the items mean which is the mean vector and cov which is the covarince matrix for starting value of the auto-regressive sequence (if autoregress == TRUE). If start is not specified the zero mean vector and the identity matrix will be considered as mean and cov, respectively.

Value

a list of class "hsmm.data" containing the following items:

  • s the vector of states

  • x observation matrix

  • N vector of sequence lengths

Author(s)

Morteza Amini, morteza.amini@ut.ac.ir, Afarin Bayat, aftbayat@gmail.com

Examples

J <- 3
initial <- c(1, 0, 0)
semi <- c(FALSE, TRUE, FALSE)
P <- matrix(c(0.8, 0.1, 0.1, 0.5, 0, 0.5, 0.1, 0.2, 0.7), nrow = J, 
byrow = TRUE)
par <- list(mu = list(list(7, 8), list(10, 9, 11), list(12, 14)),
sigma = list(list(3.8, 4.9), list(4.3, 4.2, 5.4), list(4.5, 6.1)),
mix.p = list(c(0.3, 0.7),c(0.2, 0.3, 0.5), c(0.5, 0.5)))
sojourn <- list(shape = c(0, 3, 0), scale = c(0, 8, 0), type = "gamma")
model <- hhsmmspec(init = initial, transition = P, parms.emis = par,
dens.emis = dmixmvnorm, sojourn = sojourn, semi = semi)
train <- simulate(model, nsim = c(8, 5, 5, 10), seed = 1234, 
remission = rmixmvnorm)


hhsmm documentation built on Aug. 8, 2023, 9:06 a.m.