s-news
[Top] [All Lists]

FW: How to show the probabilities in Rpart tree graph?

To: <s-news@lists.biostat.wustl.edu>
Subject: FW: How to show the probabilities in Rpart tree graph?
From: "J. Philip Miller" <JPhilipMiller@WUstl.edu>
Date: Tue, 22 Aug 2006 21:06:21 -0500
Organization: WUMS Biostatistics
Thread-index: AcbGM7or1/bkPrd7T56NAVFxK0LDOwAAB91AAADArlAAAaPyAAAFyjTgAABMrwAAALPogA==
Note that I am posting this for a user that is having trouble subscribing.
Please reply to him, not me.

-phil




-----Original Message-----
From: Li, Xiaoxi [mailto:Li.Xiaoxi@principal.com] 
Sent: Tuesday, August 22, 2006 20:47 PM
To: J. Philip Miller
Subject: How to show the probabilities in Rpart tree graph?

Hi Phil,

Can I ask you a question? Here is my situation:

I fitted my data into Rpart to generate a Classification tree, and then
I printed out the Rpart objective, or best.tree. As you can see in the
attachment, with the < print(best.tree) command we can see the "yprob"
column. 

 
I want to show the "yprob" or the Probabilities information in the final
tree graph. However, when I use the following command 
> plot(best.tree);text(best.tree,label="yprob",use.n=T,splits=T), it
generated the following error message: 

Error in text.rpart(best.tree1M, use.n = T, splits = T, label =
"yprob"): 
Label must be a column label of the frame component of the tree

As you can see, the tree does have a column "(yprob)" after I input the
print(best.tree) command such as (0.500000 0.500000) and (0.5525950
0.4474050). 

Can you help me solve the problem and show me how to get the
probabilities or the "yprob" column content into the final tree? 

Thank you for all your help.

Xiaoxi

-----
Please see the detailed problem. Thank you.

>> printcp(best.tree1M)

Classification tree:
 
rpart(formula = OP1M ~ .,data = dat, method = "class", parms =list(split
= "gini"))

Variables actually used in tree construction:
[1] F_5YE F_PCF ....

Root node error: 8645/17551 = 0.49256

n=17551 (489 observations deleted due to missing)
     CP nsplit rel error  xerror      xstd
1 0.0253326      0   1.00000 1.00000 0.0076614
2 0.0135338      1   0.97467 0.99445 0.0076607
3 0.0045113      2   0.96113 0.98427 0.0076587
........

> print(best.tree)
n=17530 (510 observations deleted due to missing)

node),  split,  n,  loss,    yval,   (yprob)

* denotes terminal node

1) root 17530 8765.0000 1 (0.5000000 0.5000000)  
     2) Q_1PE< 1.5 2817 1252.5980 0 (0.5525950 0.4474050) *

     3) Q_1PE>=1.5 14713 7217.9020 1 (0.4900036 0.5099964)  
       6) H_SGG< 1.5 2800 1244.0990 0 (0.5529161 0.4470839)  
        12) F_PCF< 3.5 1699  655.5158 0 (0.6092234 0.3907766) *
.........

> plot(best.tree);text(best.tree,label="yprob",use.n=T,splits=T)

Error in text.rpart(best.tree1M, use.n = T, splits = T, label = "yprob")
: 
Label must be a column label of the frame component of the tree




-----Original Message-----
From: J. Philip Miller [mailto:JPhilipMiller@WUstl.edu] 
Sent: Tuesday, August 22, 2006 8:37 PM
To: Li, Xiaoxi
Subject: RE: Majordomo results: 6CF5-A6F8-04DB

This suggests that you did not first subscribe to the list.  Only after
you
have subscribed can you set the options for your subscription.

-phil

J. Philip Miller, Professor of Biostatistics
Division of Biostatistics
Washington University School of Medicine
Director of Biostatistics Core, Siteman Cancer Center
Mail: Campus Box 8067, 660 S. Euclid Ave
St. Louis, MO 63110
Physical Address: 3349 Barnard
Phone: 314-362-3617, 314-362-3728 (fax)
email: jphilipmiller@wustl.edu 
web: http://www.biostat.wustl.edu/~phil

-

The materials contained in this e-mail are private and confidential and
are
the property of the sender. If you are not the intended recipient, be
advised that any unauthorized use, disclosure, copying, distribution, or
the
taking of any action in reliance on the contents of this information is
strictly prohibited. If you have received this e-mail transmission in
error,
please immediately notify the sender.

 

-----Original Message-----
From: Li, Xiaoxi [mailto:Li.Xiaoxi@principal.com] 
Sent: Tuesday, August 22, 2006 17:52 PM
To: J. Philip Miller
Subject: RE: Majordomo results: 6CF5-A6F8-04DB

Thank for your reply, Phil. Attached is the error message.

Xiaoxi


>>>> accept
Token 6CF5-A6F8-04DB has been accepted for the following command:
  Command:  set s-news digest "Li, Xiaoxi" <Li.Xiaoxi@principal.com>
  From:     "Li, Xiaoxi" <Li.Xiaoxi@principal.com>
  Date:     Tue Aug 22 16:38:47 2006
  Session:  024e537b9e6170d9252174ba154bcf09fa81213a

The results of the command are:

"Li, Xiaoxi" <Li.Xiaoxi@principal.com> is not subscribed to the s-news
list.









-----Original Message-----
From: J. Philip Miller [mailto:JPhilipMiller@WUSTL.edu] 
Sent: Tuesday, August 22, 2006 5:04 PM
To: Li, Xiaoxi
Subject: RE: Majordomo results: 6CF5-A6F8-04DB

What error messages are you receiving?

Are you following the instructions on www.biostat.wustl.edu/s-news?

-phil

J. Philip Miller, Professor of Biostatistics
Division of Biostatistics
Washington University School of Medicine
Director of Biostatistics Core, Siteman Cancer Center
Mail: Campus Box 8067, 660 S. Euclid Ave
St. Louis, MO 63110
Physical Address: 3349 Barnard
Phone: 314-362-3617, 314-362-3728 (fax)
email: jphilipmiller@wustl.edu 
web: http://www.biostat.wustl.edu/~phil

-

The materials contained in this e-mail are private and confidential and
are
the property of the sender. If you are not the intended recipient, be
advised that any unauthorized use, disclosure, copying, distribution, or
the
taking of any action in reliance on the contents of this information is
strictly prohibited. If you have received this e-mail transmission in
error,
please immediately notify the sender.


-----Original Message-----
From: Li, Xiaoxi [mailto:Li.Xiaoxi@principal.com] 
Sent: Tuesday, August 22, 2006 4:44 PM
To: s-news-owner@lists.biostat.wustl.edu
Subject: FW: Majordomo results: 6CF5-A6F8-04DB

Dear Sir or Madam,

Could you please put me on the mailing list with my email address of
li.xiaoxi@principal.com. I tried to subscribe the mailing list online
for three times, but failed. Thank you for your help.

Best regards,
Xiaoxi Li




-----Original Message-----
From: mj2-owner@lists.biostat.wustl.edu
[mailto:mj2-owner@lists.biostat.wustl.edu] 
Sent: Tuesday, August 22, 2006 4:41 PM
To: Li, Xiaoxi
Subject: Majordomo results: 6CF5-A6F8-04DB


>>>> accept
Token 6CF5-A6F8-04DB has been accepted for the following command:
  Command:  set s-news digest "Li, Xiaoxi" <Li.Xiaoxi@principal.com>
  From:     "Li, Xiaoxi" <Li.Xiaoxi@principal.com>
  Date:     Tue Aug 22 16:38:47 2006
  Session:  024e537b9e6170d9252174ba154bcf09fa81213a

The results of the command are:

"Li, Xiaoxi" <Li.Xiaoxi@principal.com> is not subscribed to the s-news
list.


****  

>>>> end
End of commands.  No more commands will be processed.


Valid commands processed: 1
0 succeeded, 0 stalled, and 1 failed.


Use the following command: 
  sessioninfo 61ead35dfa5bf87c0ac15cadc29cf1043d97c3ce
to see technical information about this session.


-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect@principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.


<Prev in Thread] Current Thread [Next in Thread>