obtain_emiss obtains the emission distribution for a fitted multilevel
hidden Markov model, for either the group level, i.e., representing the
average emission distribution over all subjects, or at the subject level,
returning the emission distribution for each subject.
obtain_emiss(object, level = "group", burn_in = NULL)
An object of class
String specifying if the returned transition probability matrix
gamma should be at the group level (
An integer which specifies the number of iterations to discard
when obtaining the model parameter summary statistics. When left
obtain_emiss returns the object
est_emiss. Depending on
the specification at the input variable
either a list of matrices with the emission distribution at the group level
level = "group") for each dependent variable, or a list of
lists, where for each dependent variable a list is returned with the number
of elements equal to the number of subjects analyzed, if
'subject'). In the latter scenario, each matrix in the lower level list
represents the subject specific emission distribution for a specific
mHMM for fitting the multilevel hidden Markov model.
###### Example on package data, see ?nonverbal # specifying general model properties: m <- 2 n_dep <- 4 q_emiss <- c(3, 2, 3, 2) # specifying starting values start_TM <- diag(.8, m) start_TM[lower.tri(start_TM) | upper.tri(start_TM)] <- .2 start_EM <- list(matrix(c(0.05, 0.90, 0.05, 0.90, 0.05, 0.05), byrow = TRUE, nrow = m, ncol = q_emiss), # vocalizing patient matrix(c(0.1, 0.9, 0.1, 0.9), byrow = TRUE, nrow = m, ncol = q_emiss), # looking patient matrix(c(0.90, 0.05, 0.05, 0.05, 0.90, 0.05), byrow = TRUE, nrow = m, ncol = q_emiss), # vocalizing therapist matrix(c(0.1, 0.9, 0.1, 0.9), byrow = TRUE, nrow = m, ncol = q_emiss)) # looking therapist # Run a model without covariate(s): out_2st <- mHMM(s_data = nonverbal, gen = list(m = m, n_dep = n_dep, q_emiss = q_emiss), start_val = c(list(start_TM), start_EM), mcmc = list(J = 11, burn_in = 5)) out_2st summary(out_2st) # obtaining the emission probabilities at the group and subject level obtain_emiss(out_2st, level = "group") obtain_emiss(out_2st, level = "subject")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.