Jan van der Laan
2011-Apr-14 08:01 UTC
[R] Automatic splitting/combining nested categorical variable in glm
I have a categorical variable with a nested structure. For example, region: a country is split into parts, which in turn contain provinces, which contain municipalities: Part -> Province -> Municipality North Province A Municipality 1 Municipality 2 Municipality 3 ... Province B Municipality 1 ... ... West Province A ... Province B ... ... ... What I would like to do is to automatically split/combine regions in a forward (starting with parts and then splitting) or backward (starting with municipalities and collapsing) manner. Do there exists methods for this in R? Googling I couldn't find anything, but perhaps I have been using the wrong terms. Please note that I do not want to choose between using Part as covarate OR e.g. Province. I want to allow for different levels in one covariate, e.g. West split into Provinces and the remaining parts not. Also: I am using logistig regression (glm). Thank you for your help. With regards, Jan
Possibly Parallel Threads
- Strange output daply with empty strata
- Multilevel analysis using nlme (lme) . Error using z-scores
- Change state names to abbreviations in an irregular list of names, abbreviations, null values, and foreign provinces
- shapefiles manipulations ??
- Labelling a fortified GADM map plotted with ggplot and geom_map