Displaying 20 results from an estimated 10000 matches similar to: "rpart: Writing values of the leaves to a dateset"
2007 Feb 02
1
Adding Histograms to Leaves of Rpart Tree or other Dendrogram
Hi - I'm trying to append simple density histograms of a continuous
variable to the leaves of an rpart tree.
The splits in the tree are all levels of a factor and I'm hoping to make
the histograms out of the subsets of the dataframe corresponding to the
splits and for them to be attached to the appropriate leaf of the final
tree.
Any help would be much appreciated,
thanks,
Jon Zelner
2009 Nov 30
3
rpart: how to assign observations to nodes in regression trees
Hi,
I am building a regression tree (method=anova) by using rpart package
and as a final result I get the final leaves characterized by
different means and standard deviations for the dependent variable.
However, differently from the classification tree for categorical
variables I cannot find a way to assign each observation to a leaf,
i.e. I can find no frame whcih contains the observation id
2011 Sep 07
2
rpart/tree issue
I am trying to create a classification tree using either tree or rpart
but when it comes to plotting the results the formatting I get is
different than what I see in all the tutorials. What I would like to
see is the XX/XX format but all I get is a weird decimal value. I was
also wondering how you know which is yes and which is no in each leaf of
the tree? Is yes always on the left?
2011 Mar 23
2
predict.rpart help
Hi Everyone,
Is there a way to get predict.rpart() to return the nodes reached by the new examples in addition to the predicted probabilities it already returns? In other words, I would like to know the leaf node in the tree object that each new example data drops down to.
Thanks in advance for your help.
Osei
2012 Mar 04
1
rpart package, text function, and round of class counts
I run the following code:
library(rpart)
data(kyphosis)
fit <- rpart(Kyphosis ~ ., data=kyphosis)
plot(fit)
text(fit, use.n=TRUE)
The text labels represent the count of each class at the leaf node.
Unfortunately, the numbers are rounded and in scientific notation rather
than the exact number of examples sorted by that node in each class.
The plot is supposed to look like
2004 Aug 21
3
sweave and post "rpart"
Hi,
have anybody positive experience how
it is possible get the post output from a
rpart-object in a large sweave file or is only the
less nicely plot function instead of post possible???
\begin{figure}[htbp]
\begin{center}
<<fig=true,eps=T>>=
post(dtreeEB, title="Tree",digits=getOption("digits") - 0,use.n=TRUE)
@
\caption{Tree1}
\end{center}
2001 Jul 02
1
text.rpart: Unwanted NA labels on terminal nodes (PR#1009)
Brian
The following (which is new to rw1030) occurs with both
Windows 98 & Windows ME. I have not tested behaviour
under Unix or Linux, but I expect it is no different.
text.rpart() prints unwanted NAs (presumably in the
splitting criterion position) on terminal nodes.
Criterion <- factor(paste("Leaf", 1:5))
Node <- factor(1:5)
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
2006 Sep 10
1
Rpart, custom penalty for an error
Hello all R-help list subscribers,
I'd like to create a regression tree of a data set with binary response
variable. Only 5% of observations are a success, so the regression tree
will not find really any variable value combinations that will yield
more than 50% of probability of success. I am however interested in
areas where the probability of success is noticeably higher than 5%, for
2011 Sep 08
1
"rpart" or "tree" function issue
I am trying to create a classification tree using either tree or rpart
functions but when it comes to plotting the results the formatting I get is
different than what I see in all the tutorials (like
http://www.youtube.com/watch?v=9XNhqO1bu0A or
http://www.youtube.com/watch?v=m3mLNpeke0I&feature=related or
http://www.statmethods.net/advstats/cart.html "tree for kyphosis"). I am
2017 Oct 31
2
SamplingStrata R package
Hi all
I am hoping to use the SamplingStrata R package for a dataset describing a
population of businesses wherein I have information on the type of
business, as well as, for designated employment number bands, number of
employees and business turnover information. So in this context the
employment number bands can be described as micro, small, medium and large,
i.e. size of business. Hence I
2017 Oct 31
1
SamplingStrata R package
Hi Bert
thank you for the reply. Not a coding query as such. Just wanted some
pointers towards how to handle strata using the package in my situation,
i.e. business type X business size with information for count and financial
turnover.
many thanks
On 31 October 2017 at 14:37, Bert Gunter <bgunter.4567 at gmail.com> wrote:
> 1. There is no question here.
>
> 2. In any case, this
2007 Feb 26
2
survival analysis using rpart
Hello,
I use rpart to predict survival time and have a problem in interpreting the
output of ?estimated rate?. Here is an example of what I do:
> stagec <-
> read.table("http://www.stanford.edu/class/stats202/DATA/stagec.data",
> col.names=c("pgtime", "pgstat", "age","eet", "g2", "grade", "gleason",
>
2005 Sep 09
1
Finding a decision tree's leaf node from a new value
Dear mailinglist members,
I have the following problem: I run a decision tree using the rpart function and, afterwords, I try to find to which leaf node a new register (not used to build the decision tree) belongs to.
I will try to explain better:
rpart.tree <- rpart(target.value ~., data)
leaf.node <- new.function(rpart.tree, new.register)
The new register has all the explanatory values
2003 Jun 17
1
User-defined functions in rpart
This question concerns rpart's facility for user-defined functions that
accomplish splitting.
I was interested in modifying the code so that in each terminal node,
a linear regression is fit to the data.
It seems that from the allowable inputs in the user-defined functions,
that this may not be possible, since they have the form:
function(y, wt, parms) (in the case of the
2017 Oct 31
0
SamplingStrata R package
1. There is no question here.
2. In any case, this is not a code writing service, so a question about how
to code models without any offering of your own attempts might not be
replied to anyway.
3. For what sorts of queries you might expect replies to, please read and
follow the posting guide below. Also, if you do post, please post in plaint
text, not html, as the latter (especially code) can
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 Mar 21
1
Convert numeric to class
Dear all,
I have a script about iteration classification, like this below
data(iris)
N <- 5
ir.tr.iter <- vector('list',N)
ir.tr <- vector('list',N)
for (j in 1:N) {
ir.tr[[j]] <- rpart(Species ~., data=iris)
ir.tr.iter[j] <- ir.tr[[j]]$frame
result <- list(ir.tr=ir.tr, ir.tr.iter=ir.tr.iter)
}
as.data.frame(as.matrix(ir.tr.iter))
2006 Sep 19
3
Problem with rpart
Not sure if anyone has posted on this problem ... I want to use rpart to
build a binary tree on a relatively large dataset with ~1400 data points
and 15 predictors. But I've noticed that rpart fails almost immediately
in the call to C_s_to_rp, as that code returns nonsense. Looking at the
code itself isn't terribly helpful, and there don't seem to be any hard
limits coded anywhere.
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