RJAGS के साथ Bayesian Modeling
Alicia Johnson
Associate Professor, Macalester College


एक "अच्छी" Markov chain कैसी दिखती है?
posterior की Markov chain approximation कितनी सटीक है?
कितनी iterations तक chain चलाएँ?


अच्छा: स्थिरता!

खराब: अस्थिरता
# COMPILE the model
sleep_jags <- jags.model(..., n.chains = 1)

# COMPILE the model
sleep_jags <- jags.model(..., n.chains = 2)

# COMPILE the model
sleep_jags <- jags.model(..., n.chains = 4)

# COMPILE the model
sleep_jags <- jags.model(..., n.chains = 4)

summary(sleep_sim)
1. Empirical mean and standard deviation for each variable,
plus standard error of the mean:
Mean SD Naive SE Time-series SE
m 29.10 8.968 0.2836 0.2820
s 40.07 7.887 0.2494 0.4227
2. Quantiles for each variable:
2.5% 25% 50% 75% 97.5%
m 11.42 23.27 28.85 34.76 46.76
s 28.31 34.65 38.93 43.91 57.56
$m$ के posterior mean का अनुमान = 29.10 ms
इस अनुमान की (naive) standard error = 0.2836 ms
SD / $\sqrt{\text{number of iterations}}$

अनुमानित mean = 29.10 ms
(naive) standard error = 0.2836 ms

मॉडल परिभाषित करें, compile करें, simulate करें
ये diagnostics जाँचें:
simulation finalize करें
sleep_jags <- jags.model(textConnection(sleep_model),
data = list(Y = sleep_study$diff_3),
inits = list(.RNG.name = "base::Wichmann-Hill",
.RNG.seed = 1989))
RJAGS के साथ Bayesian Modeling