Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effective number of parameters #13

Closed
dianalafferty opened this issue Jan 29, 2015 · 4 comments
Closed

Effective number of parameters #13

dianalafferty opened this issue Jan 29, 2015 · 4 comments
Labels

Comments

@dianalafferty
Copy link

Is it possible to get pD (effective number of parameters) in the output files?

@brianstock
Copy link
Owner

Yes. If you're running the GUI, the raw rjags output exists in the "mixsiar" environment. You can print it to the screen with:

mixsiar$jags.1

To output the pD by itself with:

mixsiar$jags.1$BUGSoutput$pD

@robynpaice
Copy link

The mixsiar$jags.1 command still gives summary statistics, can I access raw data for all iterations somehow to combine sources and determine the statistics myself?

@brianstock
Copy link
Owner

mixsiar$jags.1 is the rjags object, which contains the MCMC chains. To access the MCMC chains (p.global, p.fac1, p.fac2, depending on the random/fixed effects you included), use:

attach.jags(mixsiar$jags.1)

Now if you type dim(p.global) you should see that p.global is a matrix, where the number of columns is n.sources, and the number of rows is chain.length*n.chains. Full chain for proportion source 2 (overall/global population):

p.global[,2]

If you have random/fixed effects in your model, you'll see that p.fac1 and p.fac2 are 3-D arrays, where the dimensions are chain.length*n.chains x factor level x source.

Full chain for proportion source 1, level 1 of factor 1 (Region 1 Deer in wolves ex):

p.fac1[,1,1]

Full chain for proportion source 3, level 8 of factor 2 (Pack 8 Salmon in wolves ex):

p.fac2[,8,3]

To confirm you understand the indexing correctly, quickly plot a histogram of the chain and compare it to the output plot, e.g.

hist(p.fac2[,8,3])

should match the blue curve in "posterior_density_diet_p_Pack 8.pdf".

@robynpaice
Copy link

Thank you very much Brian that worked perfectly.

@brianstock brianstock mentioned this issue Oct 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants