I would like to fit some multilevel models to my data. In several places Dr. Gelman has suggested that one can fit a two-stage regression as a prelude to a multilevel model, to see if a more flexible model is warranted:

Before doing multilevel modeling, I would do a so-called “two-stage regression”–that is, fitting the regression model separately in each country, then estimating level-2 effects by running regressions on the country-level regression. By fitting the models separately, you’re automatically allowing slopes as well as intercepts to vary by country. (If you then want to interpret the intercepts, you have to make sure that your level-1 predictors are coded so that their zero-levels are interpretable.)


Yes, the first stage is the regression in each country using only the level-1 covariates. You then take the coefs from this first stage (ignoring the se’s) and regress them on the country-level predictors.

Even after this re-explanation I am quite confused about what Dr. Gelman means.

Consider a set of $k$ countries. Suppose one is trying to understand a country's sovereign bond spread $s^T_t$ (yield over treasury's) as a function of ten economic variables $x_{t,1},...,x_{t,p}$. For any country one can fit the model

$s_t \sim \mathbf{\beta}^T \mathbf{x}_t.$

For each country one then has $p$ coefficients. Dr. Gelman says to regress the these, i.e. the $p\times k$ coefficients, against the country-level predictors, by which I think he means the indicator variable for each country.

This doesn't make sense to me. The way it is set up it sounds like he is regressing a vector on an indicator variable, which doesn't seem like a sensible thing. The only thing I can guess he means is that one performs $p$ regressions, one for each coefficient, to determine the variation for each of these across countries. But if that were the case I would think he would say that directly, and in any case I'm not sure this is a sensible thing to do either.

Whatever he is doing must be very obvious because he has made the same suggestion repeatedly and everyone seems to understand what he is saying. Can someone help me set up this two-stage regression?

  • 1
    $\begingroup$ two stage regression was used before high speed computer was available. Now it is time to put that into statistical museum. $\endgroup$
    – user158565
    Nov 27, 2018 at 15:20
  • 2
    $\begingroup$ @user158565 I am more than anything interested in the intuition here, so I can better understand multilevel modeling. $\endgroup$ Nov 27, 2018 at 15:21
  • $\begingroup$ @user158565: Gelman is obviously very aware that high speed comuters are available, his idea is to use this descriptively (and for plots), and maybe pedagogically. Used such it is nt only a museum item! See also statmodeling.stat.columbia.edu/2005/03/07/the_secret_weap $\endgroup$ Jan 13, 2022 at 16:16

1 Answer 1


I think your entirely understandable confusion might be due to the term "regress them on the country-level predictors" (emphasis mine). Seems like a better choice of words would be "regress them with the country-level predictors."

Let's simplify the problem and assume you have data from two countries: Syldavia and Borduria. Furthermore, you have only one economic predictor: average mustache length. You would first fit your within-country regression models $s_{t} \sim \mathbf{\beta} x_{t}$ for each country. This would give you two elements in $\mathbf{\beta}$, a slope and an intercept term. Your regression software would likely output things like standard errors and p-values, but all you really want are the coefficients or values in $\mathbf{\beta}$.

You then construct a new design matrix with an intercept (the country-level mean for Borduria) and an indicator variable for Syldavia. You also include the slope and intercept values from the first regression and then regress these covariates on sovereign bond spread. Using your notation the final regression would be something like

$s_{t} \sim \alpha + \beta x_{\text{Syldavia}} + \gamma x_{\text{intercept}} + \delta x_{\text{slope}}$.

The point is that $s_t$ always stays on the left-hand side of the equation and you just have to build the right-hand side to your liking.

  • $\begingroup$ Do you mean to say that you include the intercept and slope means, across countries, in the final regression? I think your first regression should be $s_t \sim \alpha + \beta x_t$. The second regression then should have subscripts for $\alpha$ and $\beta$ indicating which country-specific regression produced them, right? $\endgroup$ Nov 28, 2018 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.