Displaying 20 results from an estimated 30000 matches similar to: "rpart vs. tree and deviance calculations"
2011 Aug 17
0
How to calculate residual mean deviance in rpart
Hi,
I am doing a regression tree using the package 'rpart' but could not able to
calculate the residual mean deviance.
Please help.
Narayan
[[alternative HTML version deleted]]
2017 Oct 05
0
fraction of null deviance explained by each node/variable in regression trees
I have used packages rpart, mvpart and tree for classification and
regression trees. I want to calculate fraction of null deviance explained
by each node and variable in the tree. For instance, at the first split,
this would be (1 - (sum of residual deviance in each of the two
leaves)/deviance at the root). In the subsequent splits, this formula is
slightly different.
There probably is a function
2007 Dec 19
1
library(rpart) or library(tree)
Hi,
I have a problem with library (rpart) (and/or library(tree)).
I use a data.frame with variables
"pnV22" (observation: 1, 0 or yes, no)
"JTemp" (mean temperature)
"SNied" (summer rain)
I used function "rpart" to build a model:
library(rpart)
attach(data.frame)
result <- rpart(pnV22 ~ JTemp + SNied)
I got the following tree:
n=55518 (50
2010 Aug 31
0
rpart - interpretation of results of tree on survival data
Hi All,
I am fitting a tree to censored survival data using the rpart package and
wanted to better understand the results.
I am trying to interpret the output from the tree. I am interested in
understanding what "yval" is for a survival tree. I see in the output of
summary, the phrase "estimated rate". The estimated rate is 1 for the entire
tree, and more of less for each
2009 May 08
1
Get (feature, threshold) from Output of rpart() for Stump Tree
Hi,
I have a question regarding how to get some partial information
from the output of rpart, which could be used as the first argument to
predict. For example, in my code, I try to learn a stump tree (decision
tree of depth 2):
"fit <- rpart(y~bx, weights = w/mean(w), control = cntrl)
print(fit)
btest[1,] <- predict(fit, newdata = data.frame(bx)) "
I found
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).
2011 Jun 13
1
In rpart, how is "improve" calculated? (in the "class" case)
Hi all,
I apologies in advance if I am missing something very simple here, but since
I failed at resolving this myself, I'm sending this question to the list.
I would appreciate any help in understanding how the rpart function is
(exactly) computing the "improve" (which is given in fit$split), and how it
differs when using the split='information' vs split='gini'
2001 Jul 24
0
bug in residuals.rpart?
The following code
tr <- rpart(Y ~ ., dat, method="class")
dev <- residuals(tr, "deviance")
produces the following error
Error in log(x) : Non-numeric argument to mathematical function
> .Traceback
[[1]]
[1] "log(yhat)" # line 588 of rpart
[[2]]
[1] "switch(type, usual = as.integer(y != yhat), pearson = (1 -
yhat)/yhat, "
[2] "
2005 Aug 26
1
Help in Compliling user -defined functions in Rpart
I have been trying to write my own user defined function in Rpart.I
imitated the anova splitting rule which is given as an example.In the
work I am doing ,I am calculating the concentration index(ci) ,which
is in between -1 and +1.So my deviance is given by
abs(ci)*(1-abs(ci)).Now when I run rpart incorporating this user
defined function i get the following error message:
Error in
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
2011 Jan 11
0
Some questions concerning survival tree analysis using the rpart module
All the documentation that I have on survival splitting is found in the
technical report you mention. However, there is both a short form and a
long form of this on our web site, did you get the larger one (52
pages)? I admit it is not a lot.
There are no other split algorithms implimented for survival data. It
would be possible to add your own. Attached is a slightly updated
version of the
2005 May 25
0
Error with user defined split function in rpart (PR#7895)
Full_Name: Bill Wheeler
Version: 2.0.1
OS: Windows 2000
Submission from: (NULL) (67.130.36.229)
The program to reproduce the error is below. I am calling rpart with a
user-defined split function for a binary response variable and one continuous
independent variable. The split function works for some datasets but not
others.
The error is:
Error in "$<-.data.frame"(`*tmp*`,
2009 May 12
1
questions on rpart (tree changes when rearrange the order of covariates?!)
Greetings,
I am using rpart for classification with "class" method. The test data is
the Indian diabetes data from package mlbench.
I fitted a classification tree firstly using the original data, and then
exchanged the order of Body mass and Plasma glucose which are the
strongest/important variables in the growing phase. The second tree is a
little different from the first one. The
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
2002 Jan 07
1
is then an equivalent of partition.tree for rpart?
partition.tree plots in 2d the partition of a classification tree produced by the function
tree (assuming the data frame from which it was computed has two continuous predictors).
I get an error when I feed a tree produced by rpart to partition.tree (since trees
produced by rpart are superclasses of those produced by tree). Is there an equivalent of
partition.tree for objects of class rpart?
2007 Feb 18
3
User defined split function in rpart
Dear R community,
I am trying to write my own user defined split function for rpart. I read
the example in the tests directory and I understand the general idea of the
how to implement user defined splitting functions. However, I am having
troubles with addressing the data frame used in calling rpart in my split
functions.
For example, in the evaluation function that is called once per node,
2011 Nov 04
1
Decision tree model using rpart ( classification
Hi Experts,
I am new to R, using decision tree model for getting segmentation rules.
A) Using behavioural data (attributes defining customer behaviour, ( example
balances, number of accounts etc.)
1. Clustering: Cluster behavioural data to suitable number of clusters
2. Decision Tree: Using rpart classification tree for generating rules for
segmentation using cluster number(cluster id) as target
2007 Jan 03
1
User defined split function in Rpart
Dear all,
I'm trying to manage with user defined split function in rpart
(file rpart\tests\usersplits.R in
http://cran.r-project.org/src/contrib/rpart_3.1-34.tar.gz - see bottom of
the email).
Suppose to have the following data.frame (note that x's values are already
sorted)
> D
y x
1 7 0.428
2 3 0.876
3 1 1.467
4 6 1.492
5 3 1.703
6 4 2.406
7 8 2.628
8 6 2.879
9 5 3.025
10 3 3.494
2008 Oct 27
0
Displaying number of Y/N affected by tree in rule form RE: R question/request on rules from rpart
Hi Prof. Williams,
thanks for your suggestion. The updated code is below.
It turns out it was a matter of displaying the second column in
yval to get the number of N and subtracting it from the n column in the
frame to get the number of Y remaining in a binary example.
once this is added now the function returns the rules along with
Y and N count affected by the resulting rule.
I am ccing
2007 Jun 15
2
method of rpart when response variable is binary?
Dear all,
I would like to model the relationship between y and x. y is binary
variable, and x is a count variable which may be possion-distribution.
I think it is better to divide x into intervals and change it to a
factor before calling glm(y~x,data=dat,family=binomail).
I try to use rpart. As y is binary, I use "class" method and get the
following result.
>