使用 R Squared 統計量

使用 rstanarm 的貝葉斯迴歸建模

Jake Thompson

Psychometrician, ATLAS, University of Kansas

什麼是 R squared?

  • 決定係數

使用 rstanarm 的貝葉斯迴歸建模

什麼是 R squared?

  • 決定係數

使用 rstanarm 的貝葉斯迴歸建模

什麼是 R squared?

  • 決定係數

使用 rstanarm 的貝葉斯迴歸建模

計算 R squared 統計量

lm_model <- lm(kid_score ~ mom_iq, data = kidiq)
lm_summary <- summary(lm_model)
lm_summary$r.squared
0.2009512
ss_res <- var(residuals(lm_model))
ss_total <- var(residuals(lm_model)) + var(fitted(lm_model))
1 - (ss_res / ss_total)
0.2009512
使用 rstanarm 的貝葉斯迴歸建模

貝葉斯模型的 R squared 統計量

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq)

ss_res <- var(residuals(stan_model))
ss_total <- var(fitted(stan_model)) + var(residuals(stan_model))
1 - (ss_res / ss_total)
0.2004996
lm_summary$r.squared
0.2009512
使用 rstanarm 的貝葉斯迴歸建模

一起來練習吧!

使用 rstanarm 的貝葉斯迴歸建模

Preparing Video For Download...