1
$\begingroup$

Suppose I have a dataset in which I am trying to model "asthma prevalence" using explanatory variables such as "age", "profession" and "geographical location" using a regression model. Currently, I have the "geographical location" variable as a categorical variable (e.g. the City code in which each person lives).

 id profession   city gender age   salary asthma
1  1    student City A      M  23 41648.96    YES
2  2    student City B      F  27 23863.39     NO
3  3   engineer City A      F  29 36141.04     NO
4  4 contractor City C      M  34 41432.74     NO
5  5    student City A      F  29 33897.44    YES

Imagine I have access to the full address where each person in this dataset lives - this means that in theory, I have the ability to convert this "geographical categorical" variable into two "geographical continuous" variables, i.e. longitude and latitude. The dataset would look something like this:

  id profession   city Longitude Latitude gender age   salary asthma
1  1    student City A -75.10793 44.92730      M  23 41648.96    YES
2  2    student City B -75.16746 44.41723      F  27 23863.39     NO
3  3   engineer City A -75.54285 44.59074      F  29 36141.04     NO
4  4 contractor City C -75.04271 45.34247      M  34 41432.74     NO
5  5    student City A -74.46469 44.83997      F  29 33897.44    YES

This leads me to my question - in general, could the argument be made that it is likely more beneficial to convert this "geographical categorical" variable into "geographical continuous variables"?

This is the following argument that comes to mind: Within the same City, it is not unreasonable to believe that similar types of people with similar asthma prevalence rates may live closer to one another compared to people with different types of characteristics (e.g. poor areas vs. rich areas - people in poorer areas might be likely to smoke more, work in factories ... all factors that may contribute to asthma). Only using the City - the regression model would likely miss out on these within pattern cities (e.g. https://ichef.bbci.co.uk/news/976/cpsprodpb/59C4/production/_103108922_mdrum_rich_meets_poor-10.jpg.webp).

Thus - could this be considered a valid approach - converting "geographical categorical variables" into "geographical continuous variables"?

At the moment, the only disadvantage I can see are complications relating to statistical inference. For example, suppose I built a Logistic Regression and I had wanted to calculate the Odds Ratio which showed the difference in asthma for residents in City A vs. City B. If the geographical categorical variable were to be made continuous - as I understand, you would now be forced to compare the change in odds for developing asthma "per unit change in degree longitude", and the interpretation of this might be less intuitive compared to the City level interpretation. However, I think it might be possible to still use longitude/latitudes and account for individual cities at the aggregate level by using a "Nested Mixed Effects Model" (e.g. the model assigns a Random Effect to each city) - this seems like the "best of both worlds": the regression model has the ability to benefit from the information contained with the granularities longitude and latitude, and standard inference tasks such as the Odds Ratio can still be calculated and interpreted in the standard sense. But then again - I am not sure if what I just described could be considered as "Statistical Double Dipping" and add unwanted noise/effects such as multicollinearity.

Can someone please comment on this?

$\endgroup$

3 Answers 3

2
+50
$\begingroup$

Longitude and latitude tend to be substitutes for the likely underlying things like air quality, pollution (closeness to major roads/other sources like factories), sources of allergens (e.g. local plants), socioeconomic factors, local weather etc., although with a huge amount of data and a sufficiently flexible model you'd eventually get something almost as good. If you could get information on some of these (e.g. closeness to green areas/parks/forest/roads/census information would obviously be something one can obtain with enough effort, details on local flora might be harder, pollution information might be available, weather information is available with some granularity etc.), those might be better than city as a categorical variable or longitude/latitude on their own.

Additionally, these things would potentially generalize better to new unseen locations. I.e. knowing that New York is worse than Boston for asthma would not help you for saying anything about Los Angeles, if all you have is a category. And going by e.g. just latitude, while Los Angeles and Myrtle Beach, SC, (similarly, New York and Madrid) are on the same latitude their climate (as well as other details) are quite different.

One can also try to create embeddings that capture all of the information available on cities or specific locations (e.g. an embedding layer trained to output known information about the location).

Of course, the big limitation here is usually data availability.

$\endgroup$
2
$\begingroup$

I think the answer depends on how risk factors for asthma vary with geography. If asthma is related to things like moisture and mold, which vary smoothly with geography, then including lat and lon may work well. If asthma is exacerbated by a local pollution emitter, like a factory, than city effects make sense since the relationship will no longer be smooth. This is where domain knowledge really helps.

I think the interpretation of the coefficients as moving residence north or west is fairly intuitive, though I prefer to calculate the effects on the probability scale rather than the OR.

$\endgroup$
2
  • $\begingroup$ @ dimitry: thank you for your answer! What do you think of this idea that I posted : a mixed effects logistic regression where each there is both a fixed effect and a mixed effect for the city, as well as a longitude/latitude variable? thanks! $\endgroup$
    – stats_noob
    Commented Dec 2, 2022 at 2:52
  • $\begingroup$ In my experience, the meanings of random and mixed are inconsistent across fields, so I am a bit wary of giving advice, but I am on board with including both if there is theory to back that up. $\endgroup$
    – dimitriy
    Commented Dec 2, 2022 at 6:36
1
$\begingroup$

I don't think you have to worry about collinearity when including both cities and coordinates unless you are doing something complex with the coordinates or have very few cities. Whether you should include cities as random effects can hopefully be answered by Ben Bolkers fantastic glmmFAQ: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#should-i-treat-factor-xxx-as-fixed-or-random

I'm assuming that you probably don't have enough data to get a solid estimation of the geographic asthma prevalence within each city, but you could construct a model with spatial correlation. This means that the correlation between 2 observation within a city falls with their distance. Again Ben Bolkers FAQ gives you good start on that: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#spatial-and-temporal-correlation-models-heteroscedasticity-r-side-models

$\endgroup$

Your Answer

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

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