Skip to content

Commit

Permalink
fix B coef
Browse files Browse the repository at this point in the history
  • Loading branch information
helske committed Sep 24, 2024
1 parent c7433a1 commit 7ebed10
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions R/coef.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,13 @@ coef.mnhmm <- function(object, probs = c(0.025, 0.5, 0.975), ...) {
cluster = rep(object$cluster_names, each = (S - 1) * S * K_s)
)
K_o <- length(object$coef_names_emission)
gamma_B_raw <- unlist(object$coefficients$gamma_B_raw)
if (object$n_channels == 1) {
gamma_B <- data.frame(
state = unlist(object$state_names),
observations = rep(object$symbol_names[-1], each = S),
parameter = rep(object$coef_names_emission, each = S * (M - 1)),
estimate = gamma_B_raw,
cluster = rep(object$cluster_names, each = S * (S - 1) * K_o)
estimate = unlist(object$coefficients$gamma_B_raw),
cluster = rep(object$cluster_names, each = S * (M - 1) * K_o)
)
} else {
gamma_B <- data.frame(
Expand All @@ -136,7 +135,7 @@ coef.mnhmm <- function(object, probs = c(0.025, 0.5, 0.975), ...) {
parameter = unlist(lapply(seq_len(object$n_channels), function(i) {
rep(object$coef_names_emission, each = S * (M[i] - 1))
})),
estimate = gamma_B_raw,
estimate = unlist(object$coefficients$gamma_B_raw),
cluster = unlist(lapply(seq_len(object$n_channels), function(i) {
rep(object$cluster_names, each = S * (M[i] - 1) * K_o)
}))
Expand Down

0 comments on commit 7ebed10

Please sign in to comment.