# What can you do when you have predictor variables that are based on group averages with different sample sizes?

Consider a classical data analysis problem where you have an outcome $Y_{i}$ and how it is related to a number of predictors $X_{i1}, ..., X_{ip}$. The basic type of application in mind here is that

1. $Y_{i}$ is some group-level outcome such as the crime rate in city $i$.

2. The predictors are group level characteristics such as demographic features of city $i$.

The basic goal is to fit a regression model (perhaps with random effects but forget that for now):

$$E(Y_{i} | {\bf X}_{i} ) = \beta_0 + \beta_1 X_{i1} + ... + \beta_p X_{ip}$$

Does some technical difficulty arise when one (or more) of the predictors are the result of a survey that has different sample sizes for each unit? For example, suppose $X_{i1}$ is a summary score for city $i$ that is the average response from a sample of individuals from city $i$ but the sample sizes these averages were based on are wildly different:

\begin{array}{c|c} {\rm City} & {\rm Sample \ size} \\ \hline 1 & 20 \\ 2 & 100 \\ 3 & 300 \\ 4 & 5 \\ 5 & 3 \\ \vdots & \vdots \\ \end{array}

Since the predictor variables do not all have the same meaning, in some sense, for each city, I'm afraid that conditioning on these variables in a regression model as though they are all "created equal" could cause some misleading inferences.

Is there a name for this type of problem? If so, is there research on how to handle this?

My thought is to treat it as a predictor variable measured with error and do something along these lines but there is heteroskedasticity in the measurement errors, so that would be very complicated. I could be thinking of this the wrong way or may be making this more complicated than it is but any discussion here would be helpful.

• This is called the "heteroscedastic errors-in-variables" problem. (This phrase is a good target for a Google search.) Recently (2007), Delaigle and Meister proposed a nonparametric kernel density estimator in a JASA article. An abstract about some parametric methods (method of moments and MLE) suggests some additional approaches: sciencedirect.com/science/article/pii/S1572312709000045. (I am not familiar enough with the research to give you an authoritative answer about how to handle your particular dataset.) – whuber Jul 10 '12 at 22:11
• @whuber +1 for both comments. I think "errors-in-variables" was the missing keyword I was looking for. If no one gives a strong answer below that I can accept then I'll look into the literature and come back to post whatever I end up doing as an answer. – Macro Jul 10 '12 at 22:40

## 2 Answers

The paper "A heteroscedastic structural errors-in-variables model with equation error" can be downloaded at the author's page:

http://www.ime.usp.br/~patriota/curriculo-eng.html#Published_papers

basically you must take into account the variability of both variables to avoid inconsistent estimators, non-reliable hypothesis tests and confidence intervals.

One way to deal with this would be to suppose that every city has a distribution with the same variance $σ^2$ for the individual responses. Then each city's average measurement $X_i$ for the predictor would have variance $σ^2/n_i$, where $n_i$ is the number of individuals in the average for city $i$. That would be a simple way to deal with the heteroskedasticity. I don't know any special name for this form of the regression problem.

• That seems reasonable although I was hoping to avoid having to model the measurement error at all. If I did go in that direction, what would you use to estimate the effect of a predictor measured with error? I've used one method called SIMEX but this seems uncommon and I'm wondering if there are other options. – Macro Jul 10 '12 at 20:54
• @Macro I am not familiar with specific software for modeling regression with a variance function to estimate. – Michael R. Chernick Jul 10 '12 at 21:34
• Macro, as a rule of thumb in homoscedastic errors-in-variables regression, if the errors in the IVs are small compared to errors in the DV, you can safely ignore the former and resort to ordinary regression. That gives you a quick, simple way to triage the problem. – whuber Jul 10 '12 at 22:17
• @whuber, thanks - that's useful. It seems that if that rule of thumb makes sense then it would make sense in the heteroskedastic case to use "if the largest error variance in the IVs is small compared to the error variance in the DV, you can safely ignore the problem" would be a reasonable rule of thumb which is a condition that may actually be satisfied in the data I'm looking at. – Macro Jul 10 '12 at 22:50
• @Michael, in the data I'm looking at the variance of the measurement that is being averaged is not huge. I'd have to check but let's say $\sigma^2 \approx 1$, so the variance of the averages (if its reasonable to say the variance is constant across units - another thing I'd have to check) is $\approx 1/n$, so it ranges between $(.05,1)$ for the sample sizes in my data set. The error variance in $Y_i$ is likely to be one, maybe two orders of magnitude larger than this (again, I'll have to check). – Macro Jul 11 '12 at 1:59