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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to