Am Stat
2006-Aug-09 05:16 UTC
[R] How to draw the decision boundaries for LDA and Rpart object
Hello useR, Could you please tell me how to draw the decision boundaries in a scatterplot of the original data for a LDA or Rpart object. For example:> library(rpart) >fit.rpart <- rpart(as.factor(group.id)~., data=data.frame(Data) )How can I draw the cutting lines on the orignial Data? Or is there any built in functions that can read the rpart object 'fit.rpart' to do that? Thanks very much in advance! Leon [[alternative HTML version deleted]]
Prof Brian Ripley
2006-Aug-09 07:04 UTC
[R] How to draw the decision boundaries for LDA and Rpart object
On Wed, 9 Aug 2006, Am Stat wrote:> Hello useR, > > Could you please tell me how to draw the decision boundaries in a > scatterplot of the original data for a LDA or Rpart object.There are examples in MASS (the book).> For example: > > library(rpart) > >fit.rpart <- rpart(as.factor(group.id)~., data=data.frame(Data) ) > > > How can I draw the cutting lines on the orignial Data? > > Or is there any built in functions that can read the rpart object > 'fit.rpart' to do that?See partition.tree in package tree.> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
hadley wickham
2006-Aug-09 23:51 UTC
[R] How to draw the decision boundaries for LDA and Rpart object
> Could you please tell me how to draw the decision boundaries in a scatterplot of the original data for a LDA or Rpart object. > > For example: > > library(rpart) > >fit.rpart <- rpart(as.factor(group.id)~., data=data.frame(Data) ) >You might want to have a look a classifly (http://had.co.nz/classifly/) which will do this in high dimensions. (You will need to install ggobi for it to work, however) Hadley