11.07.2015 Views

statisticalrethinkin..

statisticalrethinkin..

statisticalrethinkin..

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

302 11. COUNTING AND CLASSIFICATIONbcp 0.0 0.0 0.1 -0.1 0.0 0.0 0.1 0.2 2118 1dev 74.3 0.1 2.6 71.3 72.4 73.6 75.4 80.9 2415 1lp__ 915.4 0.0 1.5 911.7 914.8 915.8 916.5 917.2 2123 1And for the model with centered population size:R code11.38summary(m10.11stan.c)mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhata 3.3 0 0.1 3.1 3.3 3.3 3.4 3.5 3157 1bp 0.3 0 0.0 0.2 0.2 0.3 0.3 0.3 3568 1bc 0.3 0 0.1 0.0 0.2 0.3 0.4 0.5 3079 1bcp 0.1 0 0.2 -0.3 0.0 0.1 0.2 0.4 4112 1dev 74.9 0 2.8 71.4 72.8 74.2 76.3 81.7 3262 1lp__ 915.4 0 1.4 911.9 914.7 915.7 916.4 917.1 3260 1Compare the two n_eff columns. It’s like getting more than a thousand free samples, justby centering the predictor.Another reason to do this is that it makes DIC more accurate. ese models have 4parameters each, and the priors are quite uninformative. So the estimated number of parametersshould be very close to 4. Comparing the two:R code11.39DIC(m10.11stan)DIC(m10.11stan.c)[1] 77.59912attr(,"pD")[1] 3.339596[1] 78.82325attr(,"pD")[1] 3.962123So the model with centered log.pop gets it right, because it’s posterior distribution bettermatches DIC’s assumptions.11.3. MultinomialExample: categorize wines by score, data(Wines2012)y i ∼ Multinomial(n, p 1i , p 2i , ..., p mi )Basic notion: Each category gets a score, and that score is used to generate an unorderedprobability distribution, through standardization. So if we have m categories in the outcomedistribution, then probability of observing category y i = k is:Pr(y i = k) =exp(ϕ ki)∑j exp(ϕ kj)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!