diff --git a/R/coef.R b/R/coef.R index 563d7602..5d6b840e 100644 --- a/R/coef.R +++ b/R/coef.R @@ -100,6 +100,7 @@ coef.mnhmm <- function(object, probs = c(0.025, 0.5, 0.975), ...) { D <- object$n_clusters gamma_pi_raw <- unlist(object$coefficients$gamma_pi_raw) K_i <- length(object$coef_names_initial) + object$state_names <- unname(object$state_names) gamma_pi <- data.frame( state = unlist(lapply(object$state_names, function(x) x[-1])), parameter = rep(object$coef_names_initial, each = (S - 1)), diff --git a/R/get_probs.R b/R/get_probs.R index a3bf641b..af26c5be 100644 --- a/R/get_probs.R +++ b/R/get_probs.R @@ -340,7 +340,7 @@ get_emission_probs.mnhmm <- function(model, ...) { state = model$state_names[[j]], channel = model$channel_names[i], observation = rep(symbol_names[[i]], each = S), - estimate = c( + estimate = unlist( get_B_all( model$coefficients$gamma_B_raw[[j]][[i]], model$X_emission, FALSE, FALSE,attr(model, "tv_B") diff --git a/tests/testthat/test-forward_backward.R b/tests/testthat/test-forward_backward.R index fd5be182..1a0a5205 100644 --- a/tests/testthat/test-forward_backward.R +++ b/tests/testthat/test-forward_backward.R @@ -64,7 +64,7 @@ test_that("'forward_backward' works for single-channel 'nhmm'", { set.seed(1) expect_error( fit <- estimate_nhmm( - hmm_biofam$observations[[1]], n_states = 3, + hmm_biofam$observations[[1]][1:10,], n_states = 3, restarts = 2, threads = 1, maxeval = 2 ), NA