MulaiMulai sekarang secara gratis

Posterior probabilities

You've used RJAGS output to explore and quantify the posterior trend & uncertainty \(b\). You can also use RJAGS output to assess specific hypotheses. For example: What's the posterior probability that, on average, weight increases by more than 1.1 kg for every 1 cm increase in height? That is, what's the posterior probability that \(b > 1.1\)?

You will approximate this probability by the proportion of \(b\) Markov chain values that exceed 1.1. The weight_chains data frame with the 100,000 iteration Markov chain output is in your workspace.

Latihan ini adalah bagian dari kursus

Bayesian Modeling with RJAGS

Lihat Kursus

Petunjuk latihan

  • Construct a density plot of the \(b\) Markov chain values and use geom_vline() to superimpose a vertical line at 1.1.
  • Use table() to summarize the number of \(b\) Markov chain values that exceed 1.1.
  • Use mean() to calculate the proportion of \(b\) Markov chain values that exceed 1.1.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Mark 1.1 on a posterior density plot for b
ggplot(___, aes(x = ___)) + 
    geom_density() + 
    geom_vline(xintercept = ___, color = "red")

# Summarize the number of b chain values that exceed 1.1


# Calculate the proportion of b chain values that exceed 1.1
Edit dan Jalankan Kode