Weights in stanarm


#1

Dear stan community, thank you for your great work. I have two questions:

1. How to specify weights in a binomial rstanarm model?
Specifically, how would I specify this brms model in stanarm?

mod<-brm(r | trials(n) + weights(w) ~ treat*c2, data=dt, family=binomial(link=logit))
dt = read.table(header = TRUE, text = "
n r r/n group treat c2 c1 w
62 3 0.048387097 1 0 0.1438 1.941115288 1.941115288
96 1 0.010416667 1 0 0.237 1.186583128 1.186583128
17 0 0 0 0 0.2774 1.159882668 3.159882668
41 2 0.048780488 1 0 0.2774 1.159882668 3.159882668
212 170 0.801886792 0 0 0.2093 1.133397521 1.133397521
143 21 0.146853147 1 1 0.1206 1.128993008 1.128993008
143 0 0 1 1 0.1707 1.128993008 2.128993008
143 33 0.230769231 0 1 0.0699 1.128993008 1.128993008
73 62 1.260273973 0 1 0.1351 1.121927228 1.121927228
73 17 0.232876712 0 1 0.1206 1.121927228 1.121927228")

2. How does stanarm handle weights?

Specifically, does stanarm “take the weights literally, which means that an observation with weight 2 receives 2 times more weight than an observation with weight 1. It also means that using a weight of 2 is equivalent to adding the corresponding observation twice to the data frame” like brms as explained by @paul.buerkner?

Thank you in advance.