# Quick example to run using subset of MenSS dataset
MenSS.subset <- MenSS[50:100, ]
# Run the model using the hurdle function assuming a SCAR mechanism
# Use only 100 iterations to run a quick check
model.hurdle <- hurdle(data = MenSS.subset, model.eff = e ~ 1,model.cost = c ~ 1,
model.se = se ~ 1, model.sc = sc ~ 1, se = 1, sc = 0, dist_e = "norm", dist_c = "norm",
type = "SCAR", n.chains = 2, n.iter = 50, ppc = FALSE)
# Print the results of the JAGS model
print(model.hurdle)
#
# Use dic information criterion to assess model fit
pic.dic <- pic(model.hurdle, criterion = "dic", module = "total")
pic.dic
#
# Extract regression coefficient estimates
coef(model.hurdle)
#
# \dontshow{
# Use waic information criterion to assess model fit
pic.waic <- pic(model.hurdle, criterion = "waic", module = "total")
pic.waic
# }
# Assess model convergence using graphical tools
# Produce histograms of the posterior samples for the mean effects
diag.hist <- diagnostic(model.hurdle, type = "histogram", param = "mu.e")
#
# Compare observed effect data with imputations from the model
# using plots (posteiror means and credible intervals)
p1 <- plot(model.hurdle, class = "scatter", outcome = "effects")
#
# Summarise the CEA information from the model
summary(model.hurdle)
# \donttest{
# Further examples which take longer to run
model.hurdle <- hurdle(data = MenSS, model.eff = e ~ u.0,model.cost = c ~ e,
model.se = se ~ u.0, model.sc = sc ~ 1, se = 1, sc = 0, dist_e = "norm", dist_c = "norm",
type = "SAR", n.chains = 2, n.iter = 500, ppc = FALSE)
#
# Print results for all imputed values
print(model.hurdle, value.mis = TRUE)
# Use looic to assess model fit
pic.looic<-pic(model.hurdle, criterion = "looic", module = "total")
pic.looic
# Show density plots for all parameters
diag.hist <- diagnostic(model.hurdle, type = "denplot", param = "all")
# Plots of imputations for all data
p1 <- plot(model.hurdle, class = "scatter", outcome = "all")
# Summarise the CEA results
summary(model.hurdle)
# }
#
#
Run the code above in your browser using DataLab