florianhartig / BayesianTools

General-Purpose MCMC and SMC Samplers and Tools for Bayesian Statistics
https://cran.r-project.org/web/packages/BayesianTools/index.html
117 stars 29 forks source link

Gelman Diagnostics for population MCMCs (DE, DREAM) indicates convergences, trace plot does not #197

Closed fkrauer closed 4 years ago

fkrauer commented 4 years ago

Hi Florian

I am using BT since 2 years, but I have a problem since the last update:

The gelmanDiagnostics() would indicate convergence for some parameters, but the plot() does not look like they converged (for example param bhv or K)

Potential scale reduction factors:

      Point est. Upper C.I.
bhp         1.00       1.00
bhv         1.00       1.01
bvh         1.00       1.01
ca          1.00       1.01
da          1.05       1.16
delta       1.04       1.06
Ihp0        1.00       1.00
Ihs0        1.05       1.08
Iv0         1.18       1.53
k           1.00       1.00
K           1.00       1.00
rho         1.08       1.14
sigma       1.00       1.00

Multivariate psrf
1.18

I am now using BayesianTools_0.1.7 and the DEzs sampler. Has anyone else had this problem? The trace obviously needs burn-in, but there is no stable segment for some of the parameters. This has not happened before.

Thanks

trace1 trace2

florianhartig commented 4 years ago

Hi Fabienne,

I assume that this is done with a population MCMC, such as DEzs?

First of all, Gelman diagnostics should generally be calculated after burn-in, but usually, it will not show you convergence if you are still in the burn-in.

In your specific case, the issue is that, although Cajo te Braak proved in a paper that DE etc. sample independent AFTER the burn-in, they do not sample independent during the burn-in ... you can see this very clearly in your plots.

We therefore warn in the help somewhere that you shouldn't use the Gelman Diagnostic on a singe DEzs, or you have to remove burn-in. So, for the entire DE and DREAM family

Cheers, Florian

fkrauer commented 4 years ago

Okay, that makes sense. I will assess convergence visually first, remove burn-in and then check Gelman Diagnostics. Thanks for the explanation. Cheers, Fabienne

florianhartig commented 4 years ago

Yeah, but I would also definitely run at least 2 separate samplers.

fkrauer commented 4 years ago

I thought that DEzs runs 3 chains per default (even if I have nrChains = 1 in the settings)? At least that was the case in previous versions, but maybe this has changed?

florianhartig commented 4 years ago

Yes, they have 3 chains, but with the nrChains, we count the number of samplers that are run. The internal chains are a separate parameter.

If you set nrChains = 3, you will have 9 chains. In retrospect, we should have named the argument nrMCMCs, you are not the first one to be confused about this.

fkrauer commented 4 years ago

oh I see, then I have been doing it wrong all this time...will change nrChains=2. Thanks