# NOT RUN {
# Model 1 = wolf diet by Region + Pack
mix.1 <- load_mix_data(filename=mix.filename,
iso_names=c("d13C","d15N"),
factors=c("Region","Pack"),
fac_random=c(TRUE,TRUE),
fac_nested=c(FALSE,TRUE),
cont_effects=NULL)
source.1 <- load_source_data(filename=source.filename, source_factors="Region",
conc_dep=FALSE, data_type="means", mix.1)
discr.1 <- load_discr_data(filename=discr.filename, mix.1)
# Run Model 1
jags.1 <- run_model(run="test", mix.1, source.1, discr.1, model_filename,
alpha.prior = 1, resid_err=T, process_err=T)
# Model 2 = wolf diet by Region (no Pack)
mix.2 <- load_mix_data(filename=mix.filename,
iso_names=c("d13C","d15N"),
factors=c("Region"),
fac_random=c(TRUE),
fac_nested=c(FALSE),
cont_effects=NULL)
source.2 <- load_source_data(filename=source.filename, source_factors="Region",
conc_dep=FALSE, data_type="means", mix.2)
discr.2 <- load_discr_data(filename=discr.filename, mix.2)
# Run Model 2
jags.2 <- run_model(run="test", mix.2, source.2, discr.2, model_filename,
alpha.prior = 1, resid_err=T, process_err=T)
# Compare models 1 and 2 using LOO
compare_models(x=list(jags.1, jags.2), loo=TRUE)
# Compare models 1 and 2 using WAIC
compare_models(x=list(jags.1, jags.2), loo=FALSE)
# Get WAIC for model 1
compare_models(x=list(jags.1), loo=FALSE)
# Create named list of rjags objects to get model names in summary
x <- list(jags.1, jags.2)
names(x) <- c("Region + Pack", "Region")
compare_models(x)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab