Simple analysis of incentives data. See Chapter 19 in Regression and Other Stories.
library("rprojroot")
root<-has_dirname("ROS-Examples")$make_fix_file()
library("rstanarm")
library("ggplot2")
library("bayesplot")
theme_set(bayesplot::theme_default(base_family = "sans"))
incentives <- read.csv(root("Incentives/data","incentives.csv"))
head(incentives)
rr_diff value prepay gift burden
1 3 1.241506 1 0 0
2 6 2.466235 1 1 0
3 9 14.713524 0 0 1
4 4 24.628795 0 0 1
5 6 43.117169 0 0 1
6 13 17.313976 0 0 1
fit <- stan_glm(rr_diff ~ value + prepay + gift + burden, data=incentives, refresh=0)
print(fit, digits=2)
stan_glm
family: gaussian [identity]
formula: rr_diff ~ value + prepay + gift + burden
observations: 62
predictors: 5
------
Median MAD_SD
(Intercept) 1.60 1.75
value 0.12 0.05
prepay 3.92 2.10
gift -5.25 2.29
burden 2.91 1.56
Auxiliary parameter(s):
Median MAD_SD
sigma 5.99 0.59
------
* For help interpreting the printed output see ?print.stanreg
* For info on the priors used see ?prior_summary.stanreg