MixSIAR
MixSIAR copied to clipboard
Not saving output for long models
Hi Brian,
I seem to be having an issue with MixSIAR when I am running a more complex model. My model is similar to the alligator example when "id" is included as a random effect. I am trying to do the same, but also have a random effect of year. The model runs fine but when I try and get the output, it will only print the posterior density plots and none of the plots or statistics or diagnostics save.
Can you please point me in the right direction?
Thanks!
Hi,
It's impossible to help unless you at least post your code, and better would be a reproducible example: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example .
On Mon, Mar 14, 2022, 1:25 AM morgandobroski @.***> wrote:
Hi Brian,
I seem to be having an issue with MixSIAR when I am running a more complex model. My model is similar to the alligator example when "id" is included as a random effect. I am trying to do the same, but also have a random effect of year. The model runs fine but when I try and get the output, it will only print the posterior density plots and none of the plots or statistics or diagnostics save.
Can you please point me in the right direction?
Thanks!
— Reply to this email directly, view it on GitHub https://github.com/brianstock/MixSIAR/issues/304, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHDA42ZRF2C4EEZY63OFHLU72IPVANCNFSM5QUB3PKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi Brian,
I seem to be having an issue with MixSIAR when I am running a more complex model. My model is similar to the alligator example when "id" is included as a random effect. I am trying to do the same, but also have a random effect of year. The model runs fine but when I try and get the output, it will only print the posterior density plots and none of the plots or statistics or diagnostics save.
Can you please point me in the right direction?
Thanks!
Hi Brian, I'm currently having the same issue as stated above. I'm including my code below, but as the user above mentioned, I'm trying to print the xy_plot but it isn't saving. The only things that are printing are the summary statistics, diagnostics, pairs plot and posterior distributions.
Something else that's interesting is the summary statistics used to print the global model, but that's no longer showing up. I'm also not seeing the global model along with the posterior distributions.
Any help would be appreciated. I included screenshots of what my data looks like, but if you'd prefer to have the files so you can run the code yourself, let me know. Thanks! Sarah
`remotes::install_github("brianstock/MixSIAR", dependencies=T)
mix.swth.dets <- load_mix_data(filename = "mixsiarcons_SWTH.csv", iso_names = c("d13C","d15N"), factors = c("bin"), fac_random = c(FALSE), fac_nested = c(FALSE), cont_effects = NULL)
source.swth.dets <- load_source_data(filename = "mixsiarsource_SWTH_dets.csv", source_factors = c("bin"), conc_dep = (FALSE), data_type = "means", mix.swth.dets)
discr.swth <- load_discr_data(filename = "tef_SWTH.csv", mix.swth.dets)
plot_prior(alpha.prior=c(1),source.swth.dets)
model_filename.swth2 <- "MixSIAR_swthmodel2.txt" # Name of the JAGS model file resid_err.swth2 <- TRUE process_err.swth2 <- TRUE write_JAGS_model(model_filename.swth2, resid_err.swth2, process_err.swth2, mix.swth.dets, source.swth.dets)
jags.dets<-run_model(run="test", mix.swth.dets, source.swth.dets, discr.swth, model_filename.swth2, alpha.prior= c(1), resid_err.swth2, process_err.swth2)
output_options.swth2 <- list(summary_save = TRUE, summary_name = "summary_statistics", sup_post = FALSE, plot_post_save_pdf = TRUE, plot_post_name = "posterior_density", sup_pairs = FALSE, plot_pairs_save_pdf = TRUE, plot_pairs_name = "pairs_plot", sup_xy = TRUE, plot_xy_save_pdf = TRUE, plot_xy_name = "xy_plot", gelman = TRUE, heidel = FALSE, geweke = TRUE, diag_save = TRUE, diag_name = "diagnostics", indiv_effect = FALSE, plot_post_save_png = TRUE, plot_pairs_save_png = TRUE, plot_xy_save_png = TRUE)
output_JAGS(jags.dets, mix.swth.dets, source.swth.dets, output_options.swth2)
`
head(mix.swth.dets)
head(source.swth.dets)
head(discr.swth)
Summary stats
Diagnostics
################################################################################
Gelman-Rubin Diagnostic
################################################################################
Generally the Gelman diagnostic should be < 1.05
Out of 106 variables: 104 > 1.01
104 > 1.05
104 > 1.1
The worst variables are:
Point est. Upper C.I.
p.fac1[2,3] 45.616914 88.48271
p.fac1[3,3] 23.918062 69.52050
p.fac1[3,2] 22.692781 65.97245
p.fac1[4,3] 19.712118 67.45530
p.fac1[4,2] 18.483503 55.42586
p.fac1[3,1] 18.179911 45.91732
p.fac1[2,2] 14.274893 78.90709
p.fac1[4,1] 14.243575 35.41613
p.fac1[1,1] 5.928809 14.03839
p.global[1] 5.928809 14.03839