# Running a regression model where the observations' independent variables are only comparable to other observations within their group

I am curious about whether you can make statistical inferences when you have nested data, and the way your independent variable is measured makes it only comparable within its own group.

For example, you want to know the relationship between a town's investment in recreation and the level of physical fitness of the people in the town. Your towns are nested within states, and each state has a different way of allocating public funds for things like recreation to towns and each state classifies recreation a bit differently. So the level of recreation funding in Town A in State 1 includes Town 1's spending on, say the local public track, but the level of funding in Town B in State 2 does not include spending on running tracks. If we simply regress fitness on investment in recreation, then we could just be capturing the effect of different expenditure classification schemes. Spending on recreation is only comparable within states.

So instead of measuring gross per capita recreation spending in each town, let's say we measure the amount of revenue that each town spends on recreation per capita as a percentage the entire state's spending on recreation. For simplicity's sake, let's say every town is the same size and has the same characteristics (although you could obviously use population weights if this weren't the case). Let's also say that you have reasonable evidence that cross-state variation in recreation spending [according to a common definition of recreation] is not very large; that is, most states spend a similar amount and that the variation is mostly at the sub-state level. So a town in State 1 may have higher gross spending but a lower percentage than a town in State 2, since State A has a more expansive definition of recreation.

Could you run a random effects, fixed effects, or mixed model estimating the relationship between recreation investment as a percentage of total state rec. investment and overall fitness? I understand that you lose some insights, since you're no longer looking at gross spending. But my question stands: Is it possible to make inferences about the relationship between fitness and recreation spending with independent variables that are only comparable within the group they're nested in, or is it kind of impossible to draw any conclusions about this relationship?