brianstock / MixSIAR

A framework for Bayesian mixing models in R:
http://brianstock.github.io/MixSIAR/
94 stars 75 forks source link

Is my model converged? Gelman vs. Geweke diagnostics #91

Closed Pactzar closed 7 years ago

Pactzar commented 7 years ago

Hi! I wanted to ask about the Gelman-Rubi and Geweke diagnostics. Wen I run my data I get a very good Gelman-Rubin, but not so good Geweke. In the manual it says that large absolute z-scores indicate rejection so... How much is large? more than 5% or is it more tolerant? What is your oppinion about what to do when one diagnostic gives me the ok and the other ne doesn´t. Here is an image of my values Thanks! diagnostics

brianstock commented 7 years ago

Sorry for being so slow... I'd say chains 1 and 2 are fairly converged but chain 3 may not be. You can run longer chains (i.e. the next level) and your convergence diagnostics will look better, although it's unlikely your results will change much.

The diagnostics.pdf output shows the posterior densities by chain, so you could look there and see if chain 3 is giving a different answer than 1 and 2. The running mean plots in the same file should also show the differences by chain.

DEHewitt commented 5 years ago

Hi Brian,

I have a similar issue with convergence - all Gelman diagnostics are < 1.05, however chain 2 has 4 variables +/- 1.96 out of 48 (i.e. ~ 8%).

In my case I am modelling a 7 source system with 2 consumer groups and this was an "extreme" simulation run. All plots in the diagnostics.pdf look broadly similar. Are the results from this model valid and appropriate to be included in a manuscript?

Thank you for the help,

Dan

graceyee commented 5 years ago

Hi, I'm also having issues with this, I haven't managed to get any models with all variables <1.1, let alone <1.05 (the closest I've come is 5/48 variables > 1.05), and my Geweke diagnostics tend to be around 3, 3, 41 (chain 1, 2, 3, respectively) also.

The model will reach convergence without the prior but it comes out with an unlikely outcome so I would rather try to include my priors (from stomach content analysis). I've tried increasing the run time to extreme, grouping sources together, removing sources (6 down to 5 then to 4), adding sources (no more than 6), changing the TDFs I use several times and tried changing the weights of my priors, but to no avail.

Although all the models I've run (except uninf prior model) have similar outcomes so I was wondering if it was possible to use these models?

Cheers, Grace

AndrewLJackson commented 5 years ago

hi

It sounds like your prior is rather different to what the data want to say about the parameters.

I suggest some basic plotting of the raw data before modelling and some thinking about the geometry and how much data you have to inform a distribution (e.g. how many consumers you have and what their dispersion is like). For the models you have fitted (even if they haven’t converged) you should plot the prior and the posterior on the same graph (I’m not sure we have code to plot the likelihood or if thats an easy thing to do in these models) to see how they differ.

If your SIA data are really telling you something very different from your stomach content analysis, then at least one of your assumptions (and there are many for both approaches) for one of the methods is incorrect.

Best wishes

Andrew

--

Dr Andrew Jackson, PhD, FTCD Associate Professor Irish Research Council Laureate School of Natural Sciences, Department of Zoology Trinity College Dublin, the University of Dublin Dublin 2, Ireland.

+353 1 896 2728 | a.jackson@tcd.iemailto:a.jackson@tcd.ie Twitter: @yodacomplexhttps://twitter.com/yodacomplex http://www.tcd.ie/Zoology/research/http://www.tcd.ie/Zoology/research/groups/jackson/groups/jackson/

On 10 Sep 2019, at 09:56, Grace notifications@github.com<mailto:notifications@github.com> wrote:

Hi, I'm also having issues with this, I haven't managed to get any models with all variables <1.1, let alone <1.05 (the closest I've come is 5/48 variables > 1.05), and my Geweke diagnostics tend to be around 3, 3, 41 (chain 1, 2, 3, respectively) also.

The model will reach convergence without the prior but it comes out with an unlikely outcome so I would rather try to include my priors (from stomach content analysis). I've tried increasing the run time to extreme, grouping sources together, removing sources (6 down to 5 then to 4), adding sources (no more than 6), changing the TDFs I use several times and tried changing the weights of my priors, but to no avail.

Although all the models I've run (except uninf prior model) have similar outcomes so I was wondering if it was possible to use these models?

Cheers, Grace

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/brianstock/MixSIAR/issues/91?email_source=notifications&email_token=AAZLLME3OZCFXALMFXSD7X3QI5OL3A5CNFSM4CXG7G7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6KLYMQ#issuecomment-529841202, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAZLLMH5EQDAVAP2OSFG7RLQI5OL3ANCNFSM4CXG7G7A.

brianstock commented 5 years ago

@DEHewitt Without seeing all your diagnostics, it sounds like your model is converged - I think 4/48 Geweke > +/- 1.96 in one chain is fine. How many Rhat are > 1.01? If they are all < 1.05, probably ok as "...values below 1.1 are acceptable for most examples." [Gelman, A., J. B. Carlin, H. S. Stern, and D. B. Rubin. 2014. Bayesian data analysis. Taylor & Francis.]

@graceyee I've shared code to plot the prior and posterior together for an analysis of mantis shrimp diet. You'll need to modify to suit your data, but this should be a good start: Informative prior figure, code "Uninformative"/generalist prior figure, code

graceyee commented 5 years ago

Okay, thanks for the reply! I'll give that a try and see how I go, Cheers, Grace

graceyee commented 5 years ago

Hi Brian, I've been trying to run the code you shared with me but I can't find p.fac in my jags.1, is this because I don't have any factors in my dataset? What would I replace p.fac with instead in this case? Cheers, Grace

graceyee commented 5 years ago

Hi Brian, I've tried using p.global instead of p.fac1 but my plot is coming out with a lot of lines along it (as seen below), just wondering if you know what would be causing this? kioreliverRplot.pdf