sim_hmm: Simulating action sequences using HMM

View source: R/sim.R

sim_hmmR Documentation

Simulating action sequences using HMM

Description

sim_hmm generate n action sequences from HMM based on given parameters. The lengths of the generated sequences are simulated from a Poission distribution with mean mean_len and at least min_len.

Usage

sim_hmm(n, paras, min_len, mean_len, return_state = TRUE)

Arguments

n

number of action sequences to be generated

paras

a list containing specified HMM parameters: state-transition probability matrix (P), state-action probability matrix (Q), and initial state probability (P1).

min_len

minimum length of generated sequences

mean_len

mean length of generated sequences

return_state

logical. Whether generated hidden state sequences should be returned or not.

Value

sim_hmm returns a list of n generated action sequences if return_state = FALSE. If return_state = TRUE, it returns a list of two lists, seqs and state_seqs. seqs gives the generated action sequences. state_seqs gives the corresponding hidden state sequences.

Examples

paras <- sim_hmm_paras(5,2)
sim_data <- sim_hmm(20, paras, 3, 10)


proclhmm documentation built on June 22, 2024, 10:02 a.m.