Stacey Buckelew
2007-Feb-02 05:03 UTC
[R] Regression trees with an ordinal response variable
Hi, I am working on a regression tree in Rpart that uses a continuous response variable that is ordered. I read a previous response by Pfr. Ripley to a inquiry regarding the ability of rpart to handle ordinal responses in 2003. At that time rpart was unable to implement an algorithm to handle ordinal responses. Has there been any effort to rectify this in recent years? Thanks! Stacey On Mon, 2 Jun 2003, Andreas Christmann wrote:> >>> 1. RE: Ordinal data - Regression Trees & Proportional Odds > (Liaw, Andy) > > > AFAIK there's no implementation (or description) of tree algorithm > > that handles ordinal response. > > > > Regression trees with an ordinal response variable can be computed with > SPSS Answer Tree 3.0.They *can* be handled by tree or rpart in R. I think Andy's point was that there is no consensus as to the right way to handle them: certainly using the codes of categories works and may often be reasonable, and treating ordinal responses as categorical is also very often perfectly adequate. Note that rpart is user-extensible, so it would be reasonably easy to write an extension for a proportional-odds logistic regression model, if that is thought appropriate (and it seems strange to me to impose such strong structure on the model with such a general `linear predictor': POLR models are often in my experience a poor reflection of real problems). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595
Henric Nilsson (Public)
2007-Feb-02 08:30 UTC
[R] Regression trees with an ordinal response variable
Den Fr, 2007-02-02, 06:03 skrev Stacey Buckelew:> Hi, > > I am working on a regression tree in Rpart that uses a continuous response > variable that is ordered. I read a previous response by Pfr. Ripley to a > inquiry regarding the ability of rpart to handle ordinal responses in > 2003. At that time rpart was unable to implement an algorithm to handle > ordinal responses. Has there been any effort to rectify this in recent > years?The `ctree' function in the `party' package is able to handle ordered responses, but note that there are fundamental differences between the former and `rpart'. Reading the package vignette and the relevant references will help. However, at the moment there seems to be a problem related to the ordinal case (predicted probabilities > 1) and I've CC:ed the package's maintainer (Torsten Hothorn). HTH, Henric - - - - - Torsten, consider the following:> ### ordinal regression > mammoct <- ctree(ME ~ ., data = mammoexp)Warning message: no admissible split found> ### estimated class probabilities > treeresponse(mammoct, newdata = mammoexp[1:5, ])[[1]] [1] 1.822115 [[2]] [1] 1.265487 [[3]] [1] 1.822115 [[4]] [1] 1.560440 [[5]] [1] 1.822115> sessionInfo()R version 2.4.1 Patched (2007-01-06 r40399) i386-pc-mingw32 locale: LC_COLLATE=Swedish_Sweden.1252;LC_CTYPE=Swedish_Sweden.1252;LC_MONETARY=Swedish_Sweden.1252;LC_NUMERIC=C;LC_TIME=Swedish_Sweden.1252 attached base packages: [1] "stats4" "grid" "splines" "stats" "graphics" "grDevices" [7] "utils" "datasets" "methods" "base" other attached packages: party vcd colorspace MASS strucchange sandwich "0.9-8" "1.0-2" "0.95" "7.2-31" "1.3-1" "2.0-1" zoo coin mvtnorm modeltools survival "1.2-2" "0.5-2" "0.7-5" "0.2-10" "2.30">> > Thanks! > > Stacey > > > > On Mon, 2 Jun 2003, Andreas Christmann wrote: >> >>> 1. RE: Ordinal data - Regression Trees & Proportional Odds >> (Liaw, Andy) >> >> > AFAIK there's no implementation (or description) of tree algorithm >> > that handles ordinal response. >> > >> >> Regression trees with an ordinal response variable can be computed with >> SPSS Answer Tree 3.0. > They *can* be handled by tree or rpart in R. > I think Andy's point was that there is no consensus as to the right way to > handle them: certainly using the codes of categories works and may often > be reasonable, and treating ordinal responses as categorical is also very > often perfectly adequate. > Note that rpart is user-extensible, so it would be reasonably easy to > write > an extension for a proportional-odds logistic regression model, if that is > thought appropriate (and it seems strange to me to impose such strong > structure on the model with such a general `linear predictor': POLR > models are often in my experience a poor reflection of real problems). > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272860 (secr) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >
Torsten Hothorn
2007-Feb-03 10:25 UTC
[R] Regression trees with an ordinal response variable
On Fri, 2 Feb 2007, Henric Nilsson (Public) wrote:> Torsten, consider the following: > >> ### ordinal regression >> mammoct <- ctree(ME ~ ., data = mammoexp) > Warning message: > no admissible split found >> ### estimated class probabilities >> treeresponse(mammoct, newdata = mammoexp[1:5, ]) > [[1]] > [1] 1.822115 > > [[2]] > [1] 1.265487 > > [[3]] > [1] 1.822115 > > [[4]] > [1] 1.560440 > > [[5]] > [1] 1.822115 >works again as advertised in party 0.9-9. Thanks for pointing this out! Best wishes, Torsten