Dealing with Postcode in Regression? I'm building a logistic regression model and one of the variables I have is postcode, I might be over thinking this but is it fine for me to leave postcode as is and regress it as:
fitlogit <- glm(target ~ postcode + ..., family="binomial", data = dat)

I was thinking it might be better to combine postcodes into 4 distinct areas and model it as dummy variables once I figure out rough ranges for the groups. 
 A: There are a couple approaches you can take here, from least to most laborious:


*

*If there are few enough post codes in your study, it's probably fine to leave it as is. A general rule of thumb is that there should be ten events per variable (where each postal code is a different variable, plus all the other variables you're considering). If each postal code has more than 10 residents and you don't have too many other features, this is probably fine, though you should of course test for overfitting.

*If you don't have enough events to make all postcodes into dummy variables, you could also dummify only the most-often-sampled post codes (for instance, every post code with more than 50 residents).

*You could take the solution that you mentioned and cluster postcodes in some way. Of course there are multiple ways to cluster them--geographically is the most obvious, but income, demographics, or population density might be more informative.

*If you have ideas about what attributes of the postal code might mediate the relationship between it and your dependent variable, you could use a multilevel model. This requires the most additional effort since it requires you to fit a more complex model and acquire post-code data, but it is potentially the most rewarding since it allows you to understand the postcode relationship better.
Finally, this is probably obvious, but make sure the postcode is encoded as a categorical rather than numerical variable--this one's bitten me too many times!
