Background
The MRP case studies include an example hierarchical logistic regression model:
Pr(y_i = 1) = logit^{-1} (\alpha_{\rm s[i]}^{\rm state} + \alpha_{\rm a[i]}^{\rm age} +
\alpha_{\rm r[i]}^{\rm eth} + \alpha_{\rm e[i]}^{\rm educ} + \beta^{\rm male} \cdot {\rm Male}_{\rm i} +
\alpha_{\rm g[i], r[i]}^{\rm male.eth} + \alpha_{\rm e[i], a[i]}^{\rm educ.age} + \alpha_{\rm e[i], r[i]}^{\rm educ.eth})
where
\alpha_{\rm s}^{\rm state} \sim {\rm normal}(\gamma^0 + \gamma^{\rm south} \cdot {\rm South}_{\rm s} + \gamma^{\rm northcentral} \cdot {\rm NorthCentral}_{\rm s} + \gamma^{\rm west} \cdot {\rm West}_{\rm s} \\ \quad + \gamma^{\rm repvote} \cdot {\rm RepVote}_{\rm s}, \sigma^{\rm state}) \textrm{ for s = 1,...,50}\\
\alpha_{\rm a}^{\rm age} \sim {\rm normal}(0,\sigma^{\rm age}) \textrm{ for a = 1,...,6}\\
\alpha_{\rm r}^{\rm eth} \sim {\rm normal}(0,\sigma^{\rm eth}) \textrm{ for r = 1,...,4}\\
\alpha_{\rm e}^{\rm educ} \sim {\rm normal}(0,\sigma^{\rm educ}) \textrm{ for e = 1,...,5}\\
\alpha_{\rm g,r}^{\rm male.eth} \sim {\rm normal}(0,\sigma^{\rm male.eth}) \textrm{ for g = 1,2 and r = 1,...,4}\\
\alpha_{\rm e,a}^{\rm educ.age} \sim {\rm normal}(0,\sigma^{\rm educ.age}) \textrm{ for e = 1,...,5 and a = 1,...,6}\\
\alpha_{\rm e,r}^{\rm educ.eth} \sim {\rm normal}(0,\sigma^{\rm educ.eth}) \textrm{ for e = 1,...,5 and r = 1,...,4}\\
The case study then explains this requires a linear model for the state intercept:
As we have a state-level predictor (RepVote), we need to build another model in which \alpha_{\rm s}^{\rm state} is the outcome of a linear regression with an expected value determined by an intercept \gamma^0, the effect of the region coded as indicator variables (with Northeast as the baseline level), and the effect of the Republican vote share \gamma^{repvote}.
However, it then notes that rstanarm
(and similarly brms
) do not appear to accept group-level predictors and so the model must be re-expressed as:
Pr(y_i = 1) = logit^{-1}(
\gamma^0 +
\alpha_{\rm s[i]}^{\rm state} +
\alpha_{\rm a[i]}^{\rm age}+
\alpha_{\rm r[i]}^{\rm eth}+
\alpha_{\rm e[i]}^{\rm educ}+
\beta^{\rm male} \cdot {\rm Male}_{\rm i}+
\alpha_{\rm g[i], r[i]}^{\rm male.eth}+
\alpha_{\rm e[i], a[i]}^{\rm educ.age}+
\alpha_{\rm e[i], r[i]}^{\rm educ.eth}+
\gamma^{\rm south} \cdot {\rm South}_{\rm s} +
\gamma^{\rm northcentral} \cdot {\rm NorthCentral}_{\rm s}+
\gamma^{\rm west} \cdot {\rm West}_{\rm s}+
\gamma^{\rm repvote} \cdot {\rm RepVote}_{\rm s})
Question
My understanding is that one could fit the first model in Stan and extract draws from the posterior of \gamma^{repvote}, which would capture the the marginal effect of a state’s Republican vote share on its expected Pr(y_i = 1) i.e., \alpha_{\rm s}^{\rm state}.
Is there a way to extract that same quantity from the “flattened” version of the model that does not have a separate equation for the group intercepts, i.e. the one coded in rstanarm
or brms
?