Learn R Programming

hmma (version 1.1.0)

simulate.hmma: Simulates a HMM-A.

Description

simulate.hmma simulates a HMM-A. The only difference between simulate.hmma and simulate.hmmspec is that this function adds the names of the nodes of the Bayesian networks to the results. The simulate.hmmspec function only uses numbers, instead of names.

Usage

# S3 method for hmma
simulate(object, nsim, seed = NULL, ...)

Arguments

object

A hmma object

nsim

An integer or vector of integers (for multiple sequences) specifying the length of the sequence(s)

seed

seed for the random number generator

...

Further arguments passed to or from other methods.

Value

A simulation with the following values

  • s The states of the model.

  • x The observations.

  • n The length of the observation.

Examples

Run this code
# NOT RUN {
# Get a HMM-A (e.g. from learnModel or createHmma)
model <- learnModel(data = hmmaExampleData, amountOfStates = 2, seed = 1234)

# Simulate the data, results in 100 observation sequences of length 20.
data <- simulate(model, nsim = c(rep(20, 100)))

# }

Run the code above in your browser using DataLab