5. Bayes Factors (BIC approximation)
mpg qsec wt
Mazda RX4 21.0 16.46 2.620
Mazda RX4 Wag 21.0 17.02 2.875
Datsun 710 22.8 18.61 2.320
Hornet 4 Drive 21.4 19.44 3.215
Hornet Sportabout 18.7 17.02 3.440
Valiant 18.1 20.22 3.460
mtcars |>
ggplot(aes(x=mpg, y=qsec)) +
geom_point() +
geom_smooth(method="lm", formula = "y ~ x") +
theme_bw()
Call:
lm(formula = qsec ~ mpg, data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-2.8161 -1.0287 0.0954 0.8623 4.7149
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.35477 1.02978 14.911 2.05e-15 ***
mpg 0.12414 0.04916 2.525 0.0171 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.65 on 30 degrees of freedom
Multiple R-squared: 0.1753, Adjusted R-squared: 0.1478
F-statistic: 6.377 on 1 and 30 DF, p-value: 0.01708
mpg
is a significant predictor of qsec
(\(\beta\) = 0.12, p < .05)mtcars |>
ggplot(aes(x=wt, y=qsec)) +
geom_point() +
geom_smooth(method="lm", formula = "y ~ x") +
theme_bw()
wt
will improve the model?
Call:
lm(formula = qsec ~ mpg + wt, data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-2.1092 -0.9617 -0.2343 0.8399 4.2769
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.92949 3.53431 1.961 0.0596 .
mpg 0.32039 0.09138 3.506 0.0015 **
wt 1.39324 0.56286 2.475 0.0194 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.524 on 29 degrees of freedom
Multiple R-squared: 0.3191, Adjusted R-squared: 0.2722
F-statistic: 6.797 on 2 and 29 DF, p-value: 0.003796
bic1
and bic0
bayestestR
Bayes Factor (\(BF_{10}\)) | Interpretation |
---|---|
> 100 | Extreme evidence for H1 |
30 – 100 | Very strong evidence for H1 |
10 – 30 | Strong evidence for H1 |
3 – 10 | Moderate evidence for H1 |
1 – 3 | Anecdotal evidence for H1 |
1 | No evidence |
1/3 – 1 | Anecdotal evidence for H0 |
1/3 – 1/10 | Moderate evidence for null H0 |
1/10 – 1/30 | Strong evidence for null H0 |
1/30 – 1/100 | Very strong evidence for H0 |
< 1/100 | Extreme evidence for H0 |
effectsize
package provides many automated interpretation functionsexp()
qsec ~ wt
vs. a constant modeliris
built in dataset). Should I control for Species?”m1 <- lm(Sepal.Length ~ Sepal.Width, data = iris)
m2 <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris)
bayestestR::bayesfactor_models(m1, denominator=m2)
Bayes Factors for Model Comparison
Model BF
[m1] Sepal.Width 2.96e-40
* Against Denominator: [m2] Sepal.Width + Species
* Bayes Factor Type: BIC approximation
Thank you!