11.07.2015 Views

statisticalrethinkin..

statisticalrethinkin..

statisticalrethinkin..

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.3. EASY HMC: MAP2STAN 257FIGURE 8.6. Trace plot of the Markov chain from the ruggedness model,m8.1stan. is is a clean, healthy Markov chain, both stationary and wellmixing.e gray region is warmup, during which the Markov chain wasadapting to improve sampling efficiency. e white region contains thesamples used for inference. In lower-right, a close look at the first 100 samplesaer warmup.motion of each path, as the trace traverses the posterior density without getting mired anyplace.It doesn’t sit still for long.To really understand these points, though, you’ll have to see some trace plots for unhealthychains. at’s the project of the next section.Overthinking: Raw Stan model code. All map2stan does is translate a list of formulas into Stan’smodeling language. en Stan does the rest. Learning how to write Stan code is not necessary formost of the models in this book. But other models do require some direct interaction with Stan,because it is capable of much more than map2stan allows you to express. And even for simple models,you’ll gain additional comprehension and control, if you peek into the machine. You can alwaysaccess the raw Stan code that map2stan produces by using the function stancode. For example,stancode(m8.1stan) prints out the Stan code for the ruggedness model. Before you’re familiarwith Stan’s language, it’ll look long and weird. So let’s focus on just the most important part, the“model block”:model{real mu[N];a ~ normal( 0 , 100 );

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

Saved successfully!

Ooh no, something went wrong!