Hi everyone, I need some help. I have a simple model and I want to be able to calculate the estimated error for monotonic coefficients. Here is my example:
income_options <- c("below_20", "20_to_40", "40_to_100", "greater_100")
income <- factor(sample(income_options, 100, TRUE),
levels = income_options, ordered = TRUE)
mean_ls <- c(30, 60, 70, 75)
ls <- mean_ls[income] + rnorm(100, sd = 7)
dat <- data.frame(income, ls)
fit1 <- brm(ls ~ 1 + mo(income), data = dat)
dat$pred <- fitted(fit1)
here is the posterior_summary:
Estimate Est.Error Q2.5 Q97.5
b_Intercept 30.3849000 1.33510065 27.77938194 33.0276504
bsp_moincome 14.1119454 0.60042426 12.95246803 15.2755253
sigma 6.0846812 0.45255326 5.25143077 7.0541269
simo_moincome1[1] 0.6873463 0.03251676 0.62288940 0.7524714
simo_moincome1[2] 0.2595453 0.03722957 0.18389726 0.3304227
simo_moincome1[3] 0.0531084 0.03246610 0.00360139 0.1249914
lprior -8.0978209 0.10938685 -8.31065097 -7.8836692
lp__ -333.2370354 1.75089262 -337.45131061 -330.9131288
I use fitted function to get exact estimates but that’s not the point. When I execute the last line of code, it adds 4 columns to my dataframe, “Estimate”, “Est.Error”, “Q2.5” and “Q97.5”. For the category “below_20” Est.Error is 1.33510065, that is the error of the intercept. For other categories, the estimated error is something else, like 1.174854 for “greater_100” and I don’t know how it’s computed. Is there a mathematical formula to calculate estimated error for monotonic effects?