Giter VIP home page Giter VIP logo

Comments (3)

brianstock avatar brianstock commented on August 12, 2024

Hi Adam,

The posterior densities are probability distributions for the proportion of each source. The values of the y-axis cannot be interpreted as probabilities--probabilities are measured over intervals by taking the integral (area under the curve). So yes, if the curve is higher there, then more area will be under the curve nearby. Yes, you're right that the width of the distributions are used to calculate the quantiles. The 95% credible interval is the middle portion of the distribution, with 2.5% of the area to the left and 2.5% of the area to the right.

Short answer: The y-axis units are pretty much meaningless in both scaled and unscaled plots. I scaled the posterior densities because in some situations the y-axis would be very high for one source (ex. when one source is known to be close to 0, the y-axis can be very high), and you couldn't see the other sources well. The scaled posterior densities are no longer true probability distributions, because they don't integrate to 1. But visually they are the same, in that 95% of the area under the curve shows you 95% probability.

To demonstrate, let's say we just fit the Wolves example in MixSIAR.
region2
In the summary statistics, we see the following line for Region 2 Deer:

p.Region 2.Deer           0.594 0.083 0.431 0.457 0.540 0.594 0.651 0.727 0.753

Above, the 2.5% and 97.5% quantiles are given as 0.431 and 0.753. We can report the median as 0.59 with a 95% CI of (0.43, 0.75). The MCMC chain for Region 2 Deer diet proportion is mixsiar$jags.1$p.fac1[,2,1], and we can calculate the 95% CI limits with:

attach.jags(mixsiar$jags.1) # attach.jags(jags.1) if using mixsiar_script.r
median(p.fac1[,2,1])
quantile(p.fac1[,2,1],.025)
quantile(p.fac1[,2,1],.975)

If you wanted the probability that the Region 2 Deer diet proportion is greater than 0.7:

# Total num draws
(tot <- length(p.fac1[,2,1]))
# Num draws above 0.7
(above <- length(which(p.fac1[,2,1]>0.7)))
# Prob that the diet proportion is above 70%
(prob <- above/tot)

Or maybe we want the probability that Pack 4 eats more Deer than Pack 7:

                           Mean    SD  2.5%    5%   25%   50%   75%   95% 97.5%
p.Pack 4.Deer             0.466 0.051 0.362 0.379 0.435 0.469 0.503 0.543 0.555
p.Pack 7.Deer             0.369 0.046 0.266 0.284 0.342 0.374 0.401 0.432 0.442
prob.Deer.Pack4.Pack7 <- sum(p.fac2[,4,1] > p.fac2[,7,1])/dim(p.fac2)[1]
> prob.Deer.Pack4.Pack7
[1] 0.938

We can also get a complete posterior probability for the difference between Pack 4 and Pack 7 (i.e. is Pack4 - Pack7 greater than 0?)

p.Deer.Pack4.Pack7 <- p.fac2[,4,1] - p.fac2[,7,1]
hist(p.Deer.Pack4.Pack7,breaks=50,col="grey")
abline(v=0,col="red",lty=2,lwd=3)

pdeerpack4pack7

See also: http://www.sumsar.net/blog/2014/10/probable-points-and-credible-intervals-part-one/

from mixsiar.

AdamDuBour avatar AdamDuBour commented on August 12, 2024

Thanks for the quick reply Brian. That was extremely helpful.
-Adam

On Mon, Mar 2, 2015 at 2:46 PM, Brian Stock [email protected]
wrote:

Closed #21 #21.

β€”
Reply to this email directly or view it on GitHub
#21 (comment).

from mixsiar.

christina-cheung avatar christina-cheung commented on August 12, 2024

Hi, I am trying to do this (MixSIAR v. 3.1.10.9000) but the console just says "could not find function "attach.jags"" and then the rest won't work. Or am I missing an additional package? or something else? Thanks in advance for your answer!

from mixsiar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.