# Regressing a response on predictors at a lower level of aggregation: combined election and survey data

Combining two secondary datasets, we are interested in finding out the effect of political outcome variables (e.g. mayor's party and percentage of vote) at a low administrative level (e.g. township) on the quality of supply of public goods (e.g. hours of electricity, etc.) at a higher level (e.g. county) in a developing country. There are also control variables such as income at the higher level, and "distance to state capital" or "area to be serviced" at the lower level.

The linear model (written in R code) would be something like:

lm(hours_electricity ~  as.factor(party_t) + majority_t + income_c  + area_t, ...)


with _t denoting township (n = 3141) and _c denoting county (n = 434) arranged in a tidy dataset. The response variable does have a somewhat odd distribution:

  Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.00   18.00   24.00   20.73   24.00   24.00


Regardless of common transformations, it yields, as I feared, horrible-looking residuals plots, which don't help me in finding a solution.

This paper describes a similar problem in psychology research with group-level responses relying on individual-level predictors. However, in our study, there is no latent variable complementing the individual-level variables (i.e. we know the exact scores for all townships as opposed to a sample of them). I understand they suggest a Structural Equation Model would work if scores are known for individuals but they elaborate on their more complex problem with latent variables.

Is a Structural Equation Model what is required here? How should I go about applying that?

Otherwise, what is causing the problems with the residuals and how could it be solved?

Apologies if I'm missing something obvious, I'm out of my depth here. Accordingly, also sorry if I haven't provided enough information to answer properly. Happy to clarify, I'm just mindful of post length! Thank you very much for any pointers!

• What is supply_qual_t and what are it's possible values? Do you have repeated measurements? – user2974951 Jan 16 '19 at 9:02
• Thanks so much for taking the time! I've added the distribution of the response variable that yields the residuals below and renamed it to reflect its actual nature: hours of electricity access per day. On "repeated measurements", that's the crux of my question really. Because hours of electricity are only measured at the county level, the same value is repeated for all townships within each county. I understand "repeated measurements" are often done by design and over time, but I'm not sure if this merger of datasets is creating similar problems with similar solutions? – Fons MA Jan 16 '19 at 10:38
• The residuals are indicative of a fundamental problem in your data, it would appear that one of your independent variables remains constant while your dependent variable changes. A GLM might help here. – user2974951 Jan 17 '19 at 8:44