Displaying 20 results from an estimated 30000 matches similar to: "Question about Rpart function"
2013 Jun 25
0
confidence interval in rpart
Hi,
I am using rpart with method="anova".Can we compute 95% confidence
intervals and prediction interval for the predicted mean at each node?
Thanks,
Puja
[[alternative HTML version deleted]]
2006 Aug 10
0
QUestion on prediction of class from rpart
Hello,
I am trying to predict the classes of a test data set after training an
rpart tree.
When I run:
predict(rpart_object_based_on_training_data, newdata = "testdata", type
= "class", na.action = na.pass)
I get an error message saying that a variable that is present in both
training and test data sets has new
levels in the test set. This is true that there are new levels
2006 Mar 07
3
how to use the rpart function?
Hi all,
What parameter do I normally change in the rpart function? How do I set the
"cp" option?
Is there a way to read off error rate directly from the "rpart" function for
training data; I imagine for testing data I have to apply a "predict", but
for training data I guess the error count would be somewhere existing once
the "rpart" function is
2003 Feb 12
1
rpart v. lda classification.
I've been groping my way through a classification/discrimination
problem, from a consulting client. There are 26 observations, with 4
possible categories and 24 (!!!) potential predictor variables.
I tried using lda() on the first 7 predictor variables and got 24 of
the 26 observations correctly classified. (Training and testing both
on the complete data set --- just to get started.)
I
2011 Dec 20
0
rpart weight parameter and random forest based on rpart
Hi all,
I am very new to R (only two days of studies). I know a little bit of
statistical learning and looking for an implementation of CART and random
forest and therefore I am now studying R.
I tested with rpart and randomForest package, they are quite good.
However, I need a classification tree and for each training data, there is
different loss. (i.e. the loss function is not purely 0-1,
2010 Mar 24
0
how to solve error in precict( ) while using with rpart?
Hello,
I am working with rpart function but geting some error in prediction.
the same code works fine with iris dataset.
but applying other dataset it doesn't work.
sample code is given for reference.
> acc_model<-rpart(V1~V2+V3+V4+V5+V6+V7+V8, data=accEx.train)
> plotcp(acc_model)
>
2009 May 26
0
cross-validation in rpart
Dear R users,
I know cross-validation does not work in rpart with user defined split
functions. As Terry Therneau suggested, one can use the xpred.rpart function
and then summarize the matrix of the predicted values into a single
"goodness" value.
I need only a confirmation: set for example xval=10, if I correctly
understood a single column of the matrix obatined by xpred.rpart gives
2009 Apr 30
1
unexpected behavior of rpart 3.1-43, loss matrix
Hi,
I just noticed that rpart behaves unexpectecly, when performing
classification learning and specifying a loss matrix.
if the response variable y is a factor and if not all levels of the
factor occur in the observations, rpart exits with an error:
> df=data.frame(attr=1:5,class=factor(c(2,3,1,5,3),levels=1:6))
> rpart(class~attr,df,parms=list(loss=matrix(0,6,6)))
Error in
2004 May 07
0
rpart for CART with weights/priors
Hi,
I have a technical question about rpart:
according to Breiman et al. 1984, different costs for misclassification in
CART can be modelled
either by means of modifying the loss matrix or by means of using different
prior probabilities for the classes,
which again should have the same effect as using different weights for the
response classes.
What I tried was this:
library(rpart)
2007 Jan 25
1
rpart question
I make classification tree like this code
p.t2.90 <- rpart(y~aa_three+bas+bcu+aa_ss,
data=training,method="class",control=rpart.control(cp=0.0001))
Here I want to set weight for 4 predictors(aa_three,bas,bcu,aa_ss).
I know that there is a weight set-up in rpart.
Can this set-up satisfy my need?
If so, could someone give me an example?
Thanks,
Aimin Yan
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
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
2002 Nov 26
0
degenerate cases in RPART
RPART doesn't seem to handle the degenerate case when all training
samples are drawn from a single class:
> TrainType
[1] 0 0 0 0
> TrainDat
V1 V2 V3 V4 V5
1 0.6434392 0.5105860 0.3048803 0.3161728 0.5449632
2 0.1710005 0.5973921 0.1267061 0.6146834 0.7299928
3 0.6919125 0.8880789 0.9123243 0.9061885 0.9553663
4 0.3094843 0.6475508
2011 Mar 06
1
transaction list transformation to use rpart.
So there are a couple parts to this question. I am trying to implement the
rpart/random forest algorithms on a transaction lists. That is to say i am
trying to train models in order to deduce what are the most predictive
transactions within a customers history in order apply this model to future
test data and identify accounting irregularities(ie. this account had x and
y so they should have also
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
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
2001 Jul 26
0
tree and rpart
There have been various messages about packages tree and rpart whilst
I have been travelling, and I have now prepared updates.
tree
====
Tree is one of the oldest packages on CRAN (Feb 2000 apart from adding
the maintainer field), and I had been hoping that it would fade away
in favour of rpart.
1) sys.parent needed to be replaced by parent.frame in all but the
most recent R (post 1.3.0).
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
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
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