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.

11.2. POISSON 3010.15 0.30 -0.3 0.0 0.30.15 0.30 -0.4 0.0 0.4a-0.5 0.5 1.5a3.0 3.2 3.4 3.60.15 0.25 0.35-0.98bp0.15 0.25 0.35-0.46bp-0.14 0.14bc-3 -1 1 3-0.76 0.35bc0.0 0.4-0.3 0.0 0.30.08 -0.1-0.99bcp-0.4 0.0 0.40.09 -0.19-0.26bcp-0.5 0.5 1.5-3 -1 1 33.0 3.3 3.60.0 0.4FIGURE 11.11. Posterior distributions for models m10.11stan (le) andm10.11stan.c (right).bcp ~ dnorm(0,1)) ,data=d ,start=list(a=log(mean(d$Total.Tools)),bp=0,bc=0,bcp=0) ,iter=1e4 , warmup=1000 )e estimates are going to look different, because of the centering, but the predictions remainthe same. But we’re interested in the shape of the posterior distribution. Look now at therighthand pairs plot in FIGURE 11.11. Now those strong correlations are gone. And theMarkov chain also was more efficient, resulting in a greater number of effective samples. Stanprovides some numerical advice about how well the chain is mixing. We’ll focus on n_eff,which is a crude estimate of the effective number of samples. When the chain explores theposterior well, n_eff will be larger. at means you’ll need fewer samples to get a goodpicture of the posterior distribution. In these models, they sample so quickly that you mightnot care—you could take 100-thousand samples in under a minute. But with more data andmore complex models, you might now want to wait the hours it takes to get a good picture.So recoding the data a little pays off.To see Stan’s n_eff estimates, use summary:summary(m10.11stan)R code11.37mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhata 0.9 0.0 0.4 0.2 0.7 0.9 1.2 1.7 2092 1bp 0.3 0.0 0.0 0.2 0.2 0.3 0.3 0.3 2115 1bc -0.1 0.0 0.8 -1.8 -0.7 -0.1 0.5 1.5 2118 1

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

Saved successfully!

Ooh no, something went wrong!