Nothing
test_that("check output from longitudinal missing data function", {
testthat::skip_on_cran()
testthat::skip_if_not(
isTRUE(tryCatch(requireNamespace("rjags", quietly = TRUE), error = function(e) FALSE)),
"JAGS / rjags is not available"
)
load(test_path("testdata/PBS.RData"))
model.eff <- e ~ trt
model.cost <- c ~ trt + e
type <- "MAR"
dist_e <- "norm"
dist_c <- "norm"
n.iter <- 10
n.trt <- length(unique(PBS$trt))
n.trt.names <- unique(PBS$trt)
n.time <- max(PBS$time)
n.ind <- length(unique(PBS$id))
n.rows <- nrow(PBS)
lmm <- lmdm(data = PBS, model.eff = model.eff, dist_e = dist_e,
model.cost = model.cost, dist_c = dist_c, type = type, n.iter = n.iter)
expect_length(lmm, 11)
expect_type(lmm, "list")
expect_named(lmm, c("data_set", "model_output", "mod_est", "cea", "type",
"data_format", "time_dep", "w_e", "w_c", "call", "prior"))
expect_equal(lmm$type, "MAR")
expect_equal(lmm$data_format, "long")
expect_length(lmm$data_set, 2)
expect_type(lmm$data_set, "list")
expect_named(lmm$data_set, c("data_raw", "model_formula"))
expect_length(lmm$mod_est, 4)
expect_type(lmm$mod_est, "list")
expect_named(lmm$mod_est, c("model.eff", "model.cost", "model.me", "model.mc"))
expect_equal(lmm$time_dep, "AR1")
expect_equal(lmm$w_e, 0.25)
expect_equal(lmm$w_c, 1)
expect_length(lmm$call, 8)
expect_type(lmm$call, "language")
expect_named(lmm$call, c("", "model.eff", "model.cost", "data", "dist_e", "dist_c", "type", "n.iter"))
expect_length(lmm$prior, 1)
expect_type(lmm$prior, "list")
expect_named(lmm$prior, "default")
expect_length(lmm$cea, 24)
expect_type(lmm$cea, "list")
expect_named(lmm$cea, c("n_sim", "n_comparators", "n_comparisons", "delta_e",
"delta_c", "ICER", "Kmax", "k", "ceac", "ib", "eib", "kstar",
"best", "U", "vi", "Ustar", "ol", "evi", "ref", "comp", "step",
"interventions", "e", "c"))
expect_length(lmm$data_set$data_raw, 93)
expect_type(lmm$data_set$data_raw, "list")
expect_length(lmm$data_set$model_formula, 8)
expect_type(lmm$data_set$model_formula, "list")
expect_type(lmm$data_set$data_raw$data, "list")
expect_vector(lmm$data_set$data_raw$e_long)
expect_vector(lmm$data_set$data_raw$c_long)
expect_equal(lmm$data_set$data_raw$e_long, PBS$e, ignore_attr = TRUE)
expect_equal(lmm$data_set$data_raw$c_long, PBS$c, ignore_attr = TRUE)
expect_vector(lmm$data_set$data_raw$e)
expect_vector(lmm$data_set$data_raw$c)
expect_shape(lmm$data_set$data_raw$e, dim = c(n.ind, n.time))
expect_shape(lmm$data_set$data_raw$c, dim = c(n.ind, n.time))
expect_vector(lmm$data_set$data_raw$trt)
expect_length(lmm$data_set$data_raw$trt, n.ind)
expect_vector(lmm$data_set$data_raw$me_long)
expect_vector(lmm$data_set$data_raw$mc_long)
expect_length(lmm$data_set$data_raw$me_long, n.rows)
expect_length(lmm$data_set$data_raw$mc_long, n.rows)
expect_vector(lmm$data_set$data_raw$time_long)
expect_length(lmm$data_set$data_raw$time_long, n.rows)
expect_vector(lmm$data_set$data_raw$n_obs_e)
expect_vector(lmm$data_set$data_raw$n_obs_c)
expect_length(lmm$data_set$data_raw$n_obs_e, n.trt)
expect_length(lmm$data_set$data_raw$n_obs_c, n.trt)
expect_named(lmm$data_set$data_raw$n_obs_e, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$n_obs_c, n.trt.names, ignore.case = TRUE)
expect_vector(lmm$data_set$data_raw$n_obs_time_e)
expect_vector(lmm$data_set$data_raw$n_obs_time_c)
expect_length(lmm$data_set$data_raw$n_obs_time_e, n.time)
expect_length(lmm$data_set$data_raw$n_obs_time_c, n.time)
expect_named(lmm$data_set$data_raw$n_obs_time_e, unique(PBS$time), ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$n_obs_time_c, unique(PBS$time), ignore.case = TRUE)
expect_vector(lmm$data_set$data_raw$n_obs_time_trt_e)
expect_vector(lmm$data_set$data_raw$n_obs_time_trt_c)
expect_length(lmm$data_set$data_raw$n_obs_time_trt_e, n.time*n.trt)
expect_length(lmm$data_set$data_raw$n_obs_time_trt_c, n.time*n.trt)
expect_shape(lmm$data_set$data_raw$n_mis_e, dim = n.trt)
expect_shape(lmm$data_set$data_raw$n_mis_c, dim = n.trt)
expect_named(lmm$data_set$data_raw$n_mis_e, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$n_mis_c, n.trt.names, ignore.case = TRUE)
expect_vector(lmm$data_set$data_raw$n_mis_time_e)
expect_vector(lmm$data_set$data_raw$n_mis_time_c)
expect_length(lmm$data_set$data_raw$n_mis_time_e, n.time)
expect_length(lmm$data_set$data_raw$n_mis_time_c, n.time)
expect_named(lmm$data_set$data_raw$n_mis_time_e, unique(PBS$time), ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$n_mis_time_c, unique(PBS$time), ignore.case = TRUE)
expect_vector(lmm$data_set$data_raw$n_mis_time_trt_e)
expect_vector(lmm$data_set$data_raw$n_mis_time_trt_c)
expect_length(lmm$data_set$data_raw$n_mis_time_trt_e, n.time*n.trt)
expect_length(lmm$data_set$data_raw$n_mis_time_trt_c, n.time*n.trt)
expect_length(lmm$data_set$data_raw$n_long, n.trt)
expect_named(lmm$data_set$data_raw$n_long, n.trt.names, ignore.case = TRUE)
expect_length(lmm$data_set$data_raw$n_long_time, n.time)
expect_named(lmm$data_set$data_raw$n_long_time, unique(PBS$time), ignore.case = TRUE)
expect_vector(lmm$data_set$data_raw$n_long_time_trt)
expect_length(lmm$data_set$data_raw$n_long_time_trt, n.time*n.trt)
expect_shape(lmm$data_set$data_raw$n, dim = n.trt)
expect_named(lmm$data_set$data_raw$n, n.trt.names, ignore.case = TRUE)
expect_shape(lmm$data_set$data_raw$count_me, dim = c(n.ind, n.time, 3))
expect_shape(lmm$data_set$data_raw$count_mc, dim = c(n.ind, n.time, 3))
expect_vector(lmm$data_set$data_raw$count_me_long)
expect_vector(lmm$data_set$data_raw$count_mc_long)
expect_length(lmm$data_set$data_raw$count_me_long, n.rows)
expect_length(lmm$data_set$data_raw$count_mc_long, n.rows)
expect_type(lmm$data_set$data_raw$cov_fixed_e, "list")
expect_type(lmm$data_set$data_raw$cov_fixed_c, "list")
expect_named(lmm$data_set$data_raw$cov_fixed_e, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$cov_fixed_c, n.trt.names, ignore.case = TRUE)
expect_length(lmm$data_set$data_raw$cov_fixed_e, n.trt)
expect_length(lmm$data_set$data_raw$cov_fixed_c, n.trt)
expect_type(lmm$data_set$data_raw$avg_cov_fixed_e, "list")
expect_type(lmm$data_set$data_raw$avg_cov_fixed_c, "list")
expect_named(lmm$data_set$data_raw$avg_cov_fixed_e, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$avg_cov_fixed_c, n.trt.names, ignore.case = TRUE)
expect_length(lmm$data_set$data_raw$cov_fixed_me, n.trt)
expect_length(lmm$data_set$data_raw$cov_fixed_mc, n.trt)
expect_named(lmm$data_set$data_raw$cov_fixed_me, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$cov_fixed_mc, n.trt.names, ignore.case = TRUE)
expect_length(lmm$data_set$data_raw$avg_cov_fixed_me, n.trt)
expect_length(lmm$data_set$data_raw$avg_cov_fixed_mc, n.trt)
expect_named(lmm$data_set$data_raw$avg_cov_fixed_me, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$avg_cov_fixed_mc, n.trt.names, ignore.case = TRUE)
expect_null(lmm$data_set$data_raw$cov_random_e)
expect_null(lmm$data_set$data_raw$cov_random_c)
expect_null(lmm$data_set$data_raw$avg_cov_random_e)
expect_null(lmm$data_set$data_raw$avg_cov_random_c)
expect_null(lmm$data_set$data_raw$cov_random_me)
expect_null(lmm$data_set$data_raw$cov_random_mc)
expect_null(lmm$data_set$data_raw$avg_cov_random_me)
expect_null(lmm$data_set$data_raw$avg_cov_random_mc)
expect_null(lmm$data_set$data_raw$clus_e)
expect_null(lmm$data_set$data_raw$clus_c)
expect_null(lmm$data_set$data_raw$clus_me)
expect_null(lmm$data_set$data_raw$clus_mc)
expect_null(lmm$data_set$data_raw$n_clus_e)
expect_null(lmm$data_set$data_raw$n_clus_e)
expect_null(lmm$data_set$data_raw$n_clus_me)
expect_null(lmm$data_set$data_raw$n_clus_mc)
expect_length(lmm$data_set$data_raw$trt_pos_e, 1)
expect_length(lmm$data_set$data_raw$trt_pos_c, 1)
expect_length(lmm$data_set$data_raw$trt_pos_me, 1)
expect_length(lmm$data_set$data_raw$trt_pos_mc, 1)
expect_type(lmm$data_set$data_raw$trt_index_long, "list")
expect_length(lmm$data_set$data_raw$trt_index_long, n.trt)
expect_named(lmm$data_set$data_raw$trt_index_long, n.trt.names, ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$trt_index, "list")
expect_length(lmm$data_set$data_raw$trt_index, n.trt)
expect_named(lmm$data_set$data_raw$trt_index, n.trt.names, ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$efft, "list")
expect_named(lmm$data_set$data_raw$efft, n.trt.names, ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$costt, "list")
expect_named(lmm$data_set$data_raw$costt, n.trt.names, ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$m_efft, "list")
expect_named(lmm$data_set$data_raw$m_efft, n.trt.names, ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$m_costt, "list")
expect_named(lmm$data_set$data_raw$m_costt, n.trt.names, ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$count_met, "list")
expect_type(lmm$data_set$data_raw$count_mct, "list")
expect_length(lmm$data_set$data_raw$count_met, n.trt)
expect_length(lmm$data_set$data_raw$count_mct, n.trt)
expect_named(lmm$data_set$data_raw$count_met, n.trt.names, ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$count_mct, n.trt.names, ignore.case = TRUE)
expect_null(lmm$data_set$data_raw$name_clus_e)
expect_null(lmm$data_set$data_raw$name_clus_c)
expect_null(lmm$data_set$data_raw$name_clus_me)
expect_null(lmm$data_set$data_raw$name_clus_mc)
expect_shape(lmm$data_set$data_raw$x_e_fixed, nrow = n.ind)
expect_shape(lmm$data_set$data_raw$x_c_fixed, nrow = n.ind)
expect_null(lmm$data_set$data_raw$x_e_random)
expect_null(lmm$data_set$data_raw$x_c_random)
expect_shape(lmm$data_set$data_raw$z_e_fixed, nrow = n.ind)
expect_shape(lmm$data_set$data_raw$z_c_fixed, nrow = n.ind)
expect_null(lmm$data_set$data_raw$z_e_random)
expect_null(lmm$data_set$data_raw$z_c_random)
expect_null(lmm$data_set$data_raw$clusn_e)
expect_null(lmm$data_set$data_raw$clusn_c)
expect_null(lmm$data_set$data_raw$clusn_me)
expect_null(lmm$data_set$data_raw$clusn_mc)
expect_null(lmm$data_set$data_raw$clus_e_lev)
expect_null(lmm$data_set$data_raw$clus_c_lev)
expect_null(lmm$data_set$data_raw$clus_me_lev)
expect_null(lmm$data_set$data_raw$clus_mc_lev)
expect_type(lmm$data_set$data_raw$eff_time_list, "list")
expect_type(lmm$data_set$data_raw$cost_time_list, "list")
expect_length(lmm$data_set$data_raw$eff_time_list, n.time)
expect_length(lmm$data_set$data_raw$cost_time_list, n.time)
expect_named(lmm$data_set$data_raw$eff_time_list, unique(PBS$time), ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$cost_time_list, unique(PBS$time), ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$time_index_long, "list")
expect_length(lmm$data_set$data_raw$time_index_long, n.time)
expect_named(lmm$data_set$data_raw$time_index_long, unique(PBS$time), ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$eff_time_trt_list, "list")
expect_type(lmm$data_set$data_raw$cost_time_trt_list, "list")
expect_length(lmm$data_set$data_raw$eff_time_trt_list, n.time*n.trt)
expect_length(lmm$data_set$data_raw$cost_time_trt_list, n.time*n.trt)
expect_named(lmm$data_set$data_raw$eff_time_trt_list,
names(lmm$data_set$data_raw$n_long_time_trt), ignore.case = TRUE)
expect_named(lmm$data_set$data_raw$cost_time_trt_list,
names(lmm$data_set$data_raw$n_long_time_trt), ignore.case = TRUE)
expect_type(lmm$data_set$data_raw$time_trt_index_long, "list")
expect_length(lmm$data_set$data_raw$time_trt_index_long, n.time*n.trt)
expect_named(lmm$data_set$data_raw$time_trt_index_long,
names(lmm$data_set$data_raw$n_long_time_trt), ignore.case = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.e_fixed, model.eff, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.c_fixed, model.cost, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.me_fixed, me ~ 1, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.mc_fixed, mc ~ 1, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.e_random, e ~ 0, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.c_random, c ~ 0, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.me_random, me ~ 0, ignore_attr = TRUE)
expect_equal(lmm$data_set$model_formula$mf_model.mc_random, mc ~ 0, ignore_attr = TRUE)
expect_length(lmm$model_output, 26)
expect_type(lmm$model_output, "list")
expect_named(lmm$model_output, c("summary", "model", "mean_effects", "mean_costs", "sd_effects",
"sd_costs", "effects_fixed", "costs_fixed", "pmis_effects",
"mis_effects_fixed", "pmis_costs", "mis_costs_fixed",
"effects_random", "costs_random", "mis_effects_random",
"mis_costs_random", "imputed", "imputed_trt", "loglik", "type",
"method", "ind_fixed", "ind_random", "dist_e", "dist_c", "filein"))
expect_true(is.matrix(lmm$model_output$summary))
expect_contains(colnames(lmm$model_output$summary), c("mean", "sd", "2.5%", "25%", "50%",
"75%", "97.5%", "Rhat", "n.eff"))
expect_shape(lmm$model_output$summary, ncol = 9)
expect_type(lmm$model_output$model, "list")
expect_shape(lmm$model_output$mean_effects, dim = c(n.iter, n.trt, n.time))
expect_shape(lmm$model_output$mean_costs, dim = c(n.iter, n.trt, n.time))
expect_shape(lmm$model_output$sd_effects, dim = c(n.iter, n.time))
expect_shape(lmm$model_output$sd_costs, dim = c(n.iter, n.time))
expect_type(lmm$model_output$effects_fixed, "list")
expect_length(lmm$model_output$effects_fixed, 3)
expect_named(lmm$model_output$effects_fixed, c("alpha", "alpha_te", "alpha_tc"))
expect_shape(lmm$model_output$effects_fixed$alpha, dim = c(n.iter, dim(lmm$data_set$data_raw$x_e_fixed)[2], n.time))
expect_shape(lmm$model_output$effects_fixed$alpha_te, dim = c(n.iter, n.time))
expect_shape(lmm$model_output$effects_fixed$alpha_tc, dim = c(n.iter, n.time))
expect_type(lmm$model_output$costs_fixed, "list")
expect_length(lmm$model_output$costs_fixed, 4)
expect_named(lmm$model_output$costs_fixed, c("beta", "beta_f", "beta_te", "beta_tc"))
expect_shape(lmm$model_output$costs_fixed$beta, dim = c(n.iter, dim(lmm$data_set$data_raw$x_c_fixed)[2], n.time))
expect_shape(lmm$model_output$costs_fixed$beta_f, dim = c(n.iter, n.time))
expect_shape(lmm$model_output$costs_fixed$beta_te, dim = c(n.iter, n.time))
expect_shape(lmm$model_output$costs_fixed$beta_tc, dim = c(n.iter, n.time))
expect_shape(lmm$model_output$pmis_effects, dim = c(n.iter, n.time, 3))
expect_shape(lmm$model_output$pmis_costs, dim = c(n.iter, n.time, 3))
expect_shape(lmm$model_output$mis_effects_fixed, dim = c(n.iter, n.time, 3))
expect_shape(lmm$model_output$mis_costs_fixed, dim = c(n.iter, n.time, 3))
expect_equal(lmm$model_output$effects_random, lmm$data_set$data_raw$x_e_random)
expect_equal(lmm$model_output$costs_random, lmm$data_set$data_raw$x_c_random)
expect_equal(lmm$model_output$mis_effects_random, lmm$data_set$data_raw$z_e_random)
expect_equal(lmm$model_output$mis_costs_random, lmm$data_set$data_raw$z_c_random)
expect_type(lmm$model_output$imputed, "list")
expect_length(lmm$model_output$imputed, 2)
expect_named(lmm$model_output$imputed, c("effects", "costs"))
expect_type(lmm$model_output$imputed$effects, "list")
expect_length(lmm$model_output$imputed$effects, 4)
expect_named(lmm$model_output$imputed$effects, c("avg", "ql", "qu", "index"))
expect_vector(lmm$model_output$imputed$effects$avg)
expect_length(lmm$model_output$imputed$effects$avg, sum(lmm$data_set$data_raw$n_mis_e))
expect_vector(lmm$model_output$imputed$effects$ql)
expect_length(lmm$model_output$imputed$effects$ql, sum(lmm$data_set$data_raw$n_mis_e))
expect_vector(lmm$model_output$imputed$effects$qu)
expect_length(lmm$model_output$imputed$effects$qu, sum(lmm$data_set$data_raw$n_mis_e))
expect_vector(lmm$model_output$imputed$effects$index)
expect_length(lmm$model_output$imputed$effects$index, sum(lmm$data_set$data_raw$n_mis_e))
expect_type(lmm$model_output$imputed$costs, "list")
expect_length(lmm$model_output$imputed$costs, 4)
expect_named(lmm$model_output$imputed$costs, c("avg", "ql", "qu", "index"))
expect_vector(lmm$model_output$imputed$costs$avg)
expect_length(lmm$model_output$imputed$costs$avg, sum(lmm$data_set$data_raw$n_mis_c))
expect_vector(lmm$model_output$imputed$costs$ql)
expect_length(lmm$model_output$imputed$costs$ql, sum(lmm$data_set$data_raw$n_mis_c))
expect_vector(lmm$model_output$imputed$costs$qu)
expect_length(lmm$model_output$imputed$costs$qu, sum(lmm$data_set$data_raw$n_mis_c))
expect_vector(lmm$model_output$imputed$costs$index)
expect_length(lmm$model_output$imputed$costs$index, sum(lmm$data_set$data_raw$n_mis_c))
expect_type(lmm$model_output$imputed_trt, "list")
expect_length(lmm$model_output$imputed_trt, 2)
expect_named(lmm$model_output$imputed_trt, c("effects", "costs"))
expect_type(lmm$model_output$imputed_trt$effects, "list")
expect_length(lmm$model_output$imputed_trt$effects, 4)
expect_named(lmm$model_output$imputed_trt$effects, c("avg", "ql", "qu", "index"))
expect_type(lmm$model_output$imputed_trt$effects$avg, "list")
expect_length(lmm$model_output$imputed_trt$effects$avg, n.trt)
expect_named(lmm$model_output$imputed_trt$effects$avg, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$effects$ql, "list")
expect_length(lmm$model_output$imputed_trt$effects$ql, n.trt)
expect_named(lmm$model_output$imputed_trt$effects$ql, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$effects$qu, "list")
expect_length(lmm$model_output$imputed_trt$effects$qu, n.trt)
expect_named(lmm$model_output$imputed_trt$effects$qu, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$effects$index, "list")
expect_length(lmm$model_output$imputed_trt$effects$index, n.trt)
expect_named(lmm$model_output$imputed_trt$effects$index, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$costs, "list")
expect_length(lmm$model_output$imputed_trt$costs, 4)
expect_named(lmm$model_output$imputed_trt$costs, c("avg", "ql", "qu", "index"))
expect_type(lmm$model_output$imputed_trt$costs$avg, "list")
expect_length(lmm$model_output$imputed_trt$costs$avg, n.trt)
expect_named(lmm$model_output$imputed_trt$costs$avg, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$costs$ql, "list")
expect_length(lmm$model_output$imputed_trt$costs$ql, n.trt)
expect_named(lmm$model_output$imputed_trt$costs$ql, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$costs$qu, "list")
expect_length(lmm$model_output$imputed_trt$costs$qu, n.trt)
expect_named(lmm$model_output$imputed_trt$costs$qu, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$imputed_trt$costs$index, "list")
expect_length(lmm$model_output$imputed_trt$costs$index, n.trt)
expect_named(lmm$model_output$imputed_trt$costs$index, n.trt.names, ignore.case = TRUE)
expect_type(lmm$model_output$loglik, "list")
expect_length(lmm$model_output$loglik, 4)
expect_named(lmm$model_output$loglik, c("effects", "costs",
"missing indicators effects", "missing indicators costs"))
expect_shape(lmm$model_output$loglik$effects, dim = c(n.iter, n.ind, n.time))
expect_shape(lmm$model_output$loglik$costs, dim = c(n.iter, n.ind, n.time))
expect_shape(lmm$model_output$loglik$`missing indicators effects`, dim = c(n.iter, n.ind, n.time))
expect_shape(lmm$model_output$loglik$`missing indicators costs`, dim = c(n.iter, n.ind, n.time))
expect_equal(lmm$model_output$type, type)
expect_equal(lmm$model_output$method, "LMDM")
expect_equal(lmm$model_output$ind_fixed, "e" %in% lmm$data_set$model_formula$mf_model.c_fixed)
expect_equal(lmm$model_output$ind_random, !"e" %in% lmm$data_set$model_formula$mf_model.c_random)
expect_equal(lmm$model_output$dist_e, dist_e)
expect_equal(lmm$model_output$dist_c, dist_c)
expect_type(lmm$model_output$model, "list")
expect_length(lmm$model_output$model, 6)
expect_named(lmm$model_output$model, c("model", "BUGSoutput", "parameters.to.save",
"model.file", "n.iter", "DIC"))
expect_true(lmm$model_output$model$DIC)
expect_equal(lmm$model_output$model$n.iter, n.iter)
expect_equal(lmm$model_output$model$model.file, lmm$model_output$filein)
expect_type(lmm$model_output$model$parameters.to.save, "character")
expect_vector(lmm$model_output$model$parameters.to.save)
expect_type(lmm$model_output$model$model, "list")
expect_named(lmm$model_output$model$model, c("ptr", "data", "model", "state", "nchain",
"iter", "sync", "recompile"))
expect_type(lmm$model_output$model$BUGSoutput, "list")
expect_named(lmm$model_output$model$BUGSoutput, c("n.chains", "n.iter", "n.burnin", "n.thin", "n.keep",
"n.sims", "sims.array", "sims.list", "sims.matrix",
"summary", "mean", "sd", "median", "root.short",
"long.short", "dimension.short", "indexes.short",
"last.values", "program", "model.file", "isDIC",
"DICbyR", "pV", "DIC", "time2run" ))
expect_gt(lmm$model_output$model$BUGSoutput$time2run, 0)
expect_length(lmm$model_output$model$BUGSoutput$DIC, 1)
expect_length(lmm$model_output$model$BUGSoutput$pV, 1)
expect_equal(lmm$model_output$model$BUGSoutput$DICbyR, lmm$model_output$model$DIC)
expect_equal(lmm$model_output$model$BUGSoutput$isDIC, lmm$model_output$model$DIC)
expect_equal(lmm$model_output$model$BUGSoutput$model.file, lmm$model_output$filein)
expect_equal(lmm$model_output$model$BUGSoutput$program, "jags")
expect_type(lmm$model_output$model$BUGSoutput$last.values, "list")
expect_type(lmm$model_output$model$BUGSoutput$indexes.short, "list")
expect_vector(lmm$model_output$model$BUGSoutput$dimension.short)
expect_type(lmm$model_output$model$BUGSoutput$long.short, "list")
expect_vector(lmm$model_output$model$BUGSoutput$root.short)
expect_type(lmm$model_output$model$BUGSoutput$median, "list")
expect_type(lmm$model_output$model$BUGSoutput$sd, "list")
expect_type(lmm$model_output$model$BUGSoutput$mean, "list")
expect_true(is.matrix(lmm$model_output$model$BUGSoutput$summary))
expect_contains(colnames(lmm$model_output$model$BUGSoutput$summary), c("mean", "sd", "2.5%", "25%", "50%",
"75%", "97.5%", "Rhat", "n.eff"))
expect_shape(lmm$model_output$model$BUGSoutput$summary, ncol = 9)
expect_shape(lmm$model_output$model$BUGSoutput$sims.matrix, nrow = n.iter)
expect_type(lmm$model_output$model$BUGSoutput$sims.list, "list")
expect_shape(lmm$model_output$model$BUGSoutput$sims.array, dim = c(n.iter - lmm$model_output$model$BUGSoutput$n.burnin,
lmm$model_output$model$BUGSoutput$n.chains,
dim(lmm$model_output$model$BUGSoutput$sims.matrix)[2]))
expect_equal(lmm$model_output$model$BUGSoutput$n.sims, n.iter)
expect_equal(lmm$model_output$model$BUGSoutput$n.keep, n.iter - lmm$model_output$model$BUGSoutput$n.burnin)
expect_equal(lmm$model_output$model$BUGSoutput$n.iter, n.iter)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.