sim_hmm_paras {proclhmm}R Documentation

generate HMM parameters

Description

sim_hmm_paras generates logit scale parameters of HMM with K hidden states and N distinct actions from Uniform(-0.5, 0.5).

Usage

sim_hmm_paras(N, K, return_prob = TRUE)

Arguments

N

number of distinct actions

K

number of hidden states

return_prob

logical. indicates to return parameters in probability scale (TRUE, default) or logit scale.

Value

a list of three elements. If return_prob = TRUE, the element names are P1, P, and Q. If return_prob = FALSE, the element names are para_P1, para_P, and oara_Q.

Examples

# generate probability parameters
set.seed(12345)
paras1 <- sim_hmm_paras(5, 2)
names(paras1)

# generate parameters in the logit scale
set.seed(12345)
paras2 <- sim_hmm_paras(5, 2, return_prob = FALSE)
names(paras2)

paras1$P1
paras2$para_P1

# logit scale parameters can be transformed to probability parameters
all.equal(compute_paras_hmm(paras2$para_P, paras2$para_Q, paras2$para_P1), paras1)


[Package proclhmm version 1.0.0 Index]