Skip to content

Commit

Permalink
inits for mixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
helske committed Sep 24, 2024
1 parent 91260f7 commit a5023a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/create_initial_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ create_gamma_pi_inits <- function(x, S, K, init_sd = 0, D = 1) {
create_gamma_pi_raw_mnhmm(rnorm((S - 1) * K * D, sd = init_sd), S, K, D)
} else {
stopifnot_(
length(x) == (S - 1) * K * D,
length(unlist(x)) == (S - 1) * K * D,
paste0(
"Number of initial values for {.val gamma_pi} is not equal to ",
"(S - 1) * K * D = {(S - 1) * K * D}."
Expand Down Expand Up @@ -78,7 +78,7 @@ create_gamma_A_inits <- function(x, S, K, init_sd = 0, D = 1) {
create_gamma_A_raw_mnhmm(rnorm((S - 1) * K * S * D, sd = init_sd), S, K, D)
} else {
stopifnot_(
length(x) == (S - 1) * K * S * D,
length(unlist(x)) == (S - 1) * K * S * D,
paste0(
"Number of initial values for {.val gamma_A} is not equal to ",
"(S - 1) * K * S * D = {(S - 1) * K * S * D}."
Expand Down Expand Up @@ -110,7 +110,7 @@ create_gamma_B_inits <- function(x, S, M, K, init_sd = 0, D = 1) {
)
} else {
stopifnot_(
length(x) == sum((M - 1) * K * S) * D,
length(unlist(x)) == sum((M - 1) * K * S) * D,
paste0(
"Number of initial values for {.val gamma_B} is not equal to ",
"sum((M - 1) * K * S) * D = {sum((M - 1) * K * S) * D}."
Expand Down Expand Up @@ -142,7 +142,7 @@ create_gamma_B_inits <- function(x, S, M, K, init_sd = 0, D = 1) {
)
} else {
stopifnot_(
length(x) == (M - 1) * K * S * D,
length(unlist(x)) == (M - 1) * K * S * D,
paste0(
"Number of initial values for {.val gamma_B} is not equal to ",
"(M - 1) * K * S * D = {(M - 1) * K * S * D}."
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-simulate_mnhmm.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test_that("simulate_mnhmm, coef and get_probs works", {
initial_formula = ~1, transition_formula = ~ x,
emission_formula = ~ x + z, cluster_formula = ~w,
data = d, time = "month", id = "person",
inits = sim$model$coefficients),
inits = sim$model$coefficients, maxeval = 1),
NA
)
expect_error(
Expand Down

0 comments on commit a5023a9

Please sign in to comment.