Prior yang Ditentukan Pengguna

Pemodelan Regresi Bayesian dengan rstanarm

Jake Thompson

Psychometrician, ATLAS, University of Kansas

Mengapa mengubah prior bawaan?

  • Alasan kuat bahwa parameter bernilai tertentu
  • Kendala pada parameter
Pemodelan Regresi Bayesian dengan rstanarm

Menentukan prior

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = normal(location = 0, scale = 10),
  prior = normal(location = 0, scale = 2.5),
  prior_aux = exponential(rate = 1)
)
Pemodelan Regresi Bayesian dengan rstanarm

Menentukan prior

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = normal(location = 0, scale = 10, autoscale = FALSE),
  prior = normal(location = 0, scale = 2.5, autoscale = FALSE),
  prior_aux = exponential(rate = 1, autoscale = FALSE)
)
Pemodelan Regresi Bayesian dengan rstanarm

Menentukan prior

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = normal(location = 3, scale = 2),
  prior = cauchy(location = 0, scale = 1))
  • Banyak jenis prior
    • normal()
    • exponential()
    • student_t()
    • cauchy()
  • ?priors
Pemodelan Regresi Bayesian dengan rstanarm

Prior datar

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = NULL,
  prior = NULL,
  prior_aux = NULL)
prior_summary(stan_model)
Priors for model 'stan_model' 
 ------
Intercept (after predictors centered)
 ~ flat

Coefficients
 ~ flat

Auxiliary (sigma)
 ~ flat
 ------
See help('prior_summary.stanreg') for more details
Pemodelan Regresi Bayesian dengan rstanarm

Ayo berlatih!

Pemodelan Regresi Bayesian dengan rstanarm

Preparing Video For Download...