LoslegenKostenlos loslegen

Altering chains

Let's practice changing the number and length of chains so that we can get a posterior distribution of different sizes. By changing the size of the posterior, we can change the number of samples used for the posterior summaries, and impact the estimation time. The songs data is already loaded.

Diese Übung ist Teil des Kurses

Bayesian Regression Modeling with rstanarm

Kurs anzeigen

Anleitung zur Übung

  • For all models, predict popularity from the song_age.
  • Estimate a model with 3 chains, each 1000 iterations long, with the first 500 discarded
  • Estimate a model with 2 chains, each 100 iterations long, discarding the first 50
  • Print a summary of each model

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 3 chains, 1000 iterations, 500 warmup
model_3chains <- stan_glm(___ ~ ___, data = songs,
    ___ = ___, ___ = ___, ___ = ___)

# Print a summary of model_3chains
___(model_3chains)

# 2 chains, 100 iterations, 50 warmup
model_2chains <- stan_glm(___ ~ ___, data = songs,
    ___ = ___, ___ = ___, ___ = ___)

# Print a summary of model_2chains
___(model_2chains)
Code bearbeiten und ausführen