similar to: predict.rpart help

Displaying 20 results from an estimated 8000 matches similar to: "predict.rpart help"

2008 Jul 22
2
rpart$where and predict.rpart
Hello there. I have fitted a rpart model. > rpartModel <- rpart(y~., data=data.frame(y=y,x=x),method="class", ....) and can use rpart$where to find out the terminal nodes that each observations belongs. Now, I have a set of new data and used predict.rpart which seems to give only the predicted value with no information similar to rpart$where. May I know how
2003 Jun 24
1
errorest: Error in cv.numeric()
Hi, I am trying to get an error estimation for a classification done using lda. The examples work fine, however I don't get my own code to work. The data is in object d > d class hydrophobicity charge geometry 1 2 6490.0400 1434.9700 610.99902 2 2 1602.0601 400.6030 -5824.00000 3 2 969.0060 260.1360 -415.00000 4 1
2009 Jul 26
3
Question about rpart decision trees (being used to predict customer churn)
Hi, I am using rpart decision trees to analyze customer churn. I am finding that the decision trees created are not effective because they are not able to recognize factors that influence churn. I have created an example situation below. What do I need to do to for rpart to build a tree with the variable experience? My guess is that this would happen if rpart used the loss matrix while creating
2013 Jan 27
2
rpart
Hi, When I look at the summary of an rpart object run on my data, I get 7 nodes but when I plot the rpart object, I get only 3 nodes. Should the number of nodes not match in the results of the 2 functions (summary and plot) or it is not always the same? Look forward to your reply, Carol -------------------------------------------- ?summary(rpart.res) Call: rpart(formula = mydata$class ~ ., data
2003 Apr 10
1
Classification problem - rpart
I am performing a binary classification using a classification tree. Ironically, the data themselves are 2483 tree (real biological ones) locations as described by a suite of environmental variables (slope, soil moisture, radiation load, etc). I want to separate them from an equal number of random points. Doing eda on the data shows that there is substantial difference between the tree and random
2011 Jul 29
1
help with predict.rpart
? data=read.table("http://statcourse.com/research/boston.csv", , sep=",", header = TRUE) ? library(rpart) ? fit=rpart (MV~ CRIM+ZN+INDUS+CHAS+NOX+RM+AGE+DIS+RAD+TAX+ PT+B+LSTAT) predict(fit,data[4,]) plot only reveals part of the tree in contrast to the results on obtains with CART or C5 -------- Original Message -------- Subject: Re: [R] help with rpart From: Sarah
2012 Aug 01
1
rpart package: why does predict.rpart require values for "unused" predictors?
After fitting and pruning an rpart model, it is often the case that one or more of the original predictors is not used by any of the splits of the final tree. It seems logical, therefore, that values for these "unused" predictors would not be needed for prediction. But when predict() is called on such models, all predictors seem to be required. Why is that, and can it be easily
2012 May 15
2
rpart - predict terminal nodes for new observations
Dear useRs: Is there a way I could predict the terminal node associated with a new data entry in an rpart environment? In the example below, if I had a new data entry with an AM of 5, I would like to link it to the terminal node 2. My searches led to http://tolstoy.newcastle.edu.au/R/e4/help/08/07/17702.html but I do not seem to be able to operationalize Professor Ripley's suggestions. Many
2005 Oct 08
1
Rpart -- using predict() when missing data is present?
I am doing > library(rpart) > m <- rpart("y ~ x", D[insample,]) > D[outsample,] y x 8 0.78391922 0.579025591 9 0.06629211 NA 10 NA 0.001593063 > p <- predict(m, newdata=D[9,]) Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid result from na.action How do I persuade him to give me NA
2008 Feb 26
1
predict.rpart question
Dear All, I have a question regarding predict.rpart. I use rpart to build classification and regression trees and I deal with data with relatively large number of input variables (predictors). For example, I build an rpart model like this rpartModel <- rpart(Y ~ X, method="class", minsplit =1, minbucket=nMinBucket,cp=nCp); and get predictors used in building the model like
2006 Apr 07
1
rpart.predict error--subscript out of bounds
Hi, I am using rpart to do leave one out cross validation, but met some problem, Data is a data frame, the first column is the subject id, the second column is the group id, and the rest columns are numerical variables, > Data[1:5,1:10] sub.id group.id X3262.345 X3277.402 X3369.036 X3439.895 X3886.935 X3939.054 X3953.777 X3970.352 1 32613 HAM_TSP 417.7082 430.4895 619.4776 720.8246
2002 Nov 06
1
predict.rpart and large datasets
Hi folks, I'm getting the following error message when using predict.rpart on a large dataset (say 100,000 records) within Splus: Terminating S Session: Signal: bad address signal Has anyone run into this error, discovered a work-around, etc.? More generally, I'm trying to use predict.rpart to generate predictions from very large, geographic datasets (we're talking all of
2008 Jul 31
1
predict rpart: new data has new level
Hi. I uses rpart to build a regression tree. Y is continuous. Now, I try to predict on a new set of data. In the new set of data, one of my x (call Incoterm, a factor) has a new level. I wonder why the error below appears as the guide says "For factor predictors, if an observation contains a level not used to grow the tree, it is left at the deepest possible node and
2012 Jan 08
2
rpart question
We are trying to make a decision tree using rpart and we are continually running into the following error: > fit_rpart=rpart(ENROLL_YN~MINORITY,method="class") > summary(fit_rpart) Call: rpart(formula = ENROLL_YN ~ MINORITY, method = "class") n= 5725 CP nsplit rel error 1 0 0 1 Error in yval[, 1] : incorrect number of dimensions ENROLL_YN is a
2010 Nov 18
1
predict() an rpart() model: how to ignore missing levels in a factor
I am using an algorigm to split my data set into two random sections repeatedly and constuct a model using rpart() on one, test on the other and average out the results. One of my variables is a factor(crop) where each crop type has a code. Some crop types occur infrequently or singly. when the data set is randomly split, it may be that the first data set has a crop type which is not present in
2007 Sep 15
1
Class probabilities in rpart
Hi, the predict.rpart() function from the rpart library allows for calculating the class probabilities for a given test case instead of a discrete class label. How are these class probabilities derived? Is it simply the proportion of the majority class to all cases in a leaf node? Thanks in advance, Chris
2007 Feb 20
1
text.rpart for the "class" method doesn't act on label="yprob"
Hello All, Am I misreading the documentation? The text.rpart documentation says: "label a column name of x$frame; values of this will label the nodes. For the "class" method, label="yval" results in the factor levels being used, "yprob" results in the probability of the winning factor level being used, and ?specific yval level? results in the probability of
2008 Mar 06
1
Rpart and bagging - how is it done?
Hi there. I was wondering if somebody knows how to perform a bagging procedure on a classification tree without running the classifier with weights. Let me first explain why I need this and then give some details of what I have found out so far. I am thinking about implementing the bagging procedure in Matlab. Matlab has a simple classification tree function (in their Statistics toolbox) but
2005 Oct 14
1
Predicting classification error from rpart
Hi, I think I'm missing something very obvious, but I am missing it, so I would be very grateful for help. I'm using rpart to analyse data on skull base morphology, essentially predicting sex from one or several skull base measurements. The sex of the people whose skulls are being studied is known, and lives as a factor (M,F) in the data. I want to get back predictions of gender, and
2005 Aug 04
1
Puzzled at rpart prediction
I'm in a situation where I say: > predict(m.rpart, newdata=D[N1+t,]) 0 1 173 0.8 0.2 which I interpret as meaning: an 80% chance of "0" and a 20% chance of "1". Okay. This is consistent with: > predict(m.rpart, newdata=D[N1+t,], type="class") [1] 0 Levels: 0 1 But I'm puzzled at the following. If I say: > predict(m.rpart,