Re: [R] ctree

From: Joris Meys <jorismeys_at_gmail.com>
Date: Mon, 21 Jun 2010 16:03:44 +0200

You can't get them out of the plot function, but you can calculate them from the fit. This code returns a matrix with the appropriate rownames and colnames.

x1 <- treeresponse(iris.ct)
p <- matrix(

      unlist(unique(x1)),
      ncol=3,
      byrow=T

)

colnames(p) <- levels(iris$Species)
rownames(p) <- unique(where(iris.ct))
p

On Mon, Jun 21, 2010 at 3:28 PM, <Steve_Friedman_at_nps.gov> wrote:
>
> Hello,
>
> This is a re-submittal of question I submitted last week, but haven't rec'd
> any responses.
>
> I need to extract the probabilities used to construct the barplots
> displayed as part of the graph produced by plot("ctree").
>
> For example,
>
> library(party)
>
> iris.ct <- ctree(Species ~ . , data = iris)
> plot(iris.ct)
>
> Instead of a simple example with only 4 terminal nodes, my analysis
> produces 55 terminal nodes, so unless someone is really interested I'm only
> using the iris data as an example.
>
> This is the model I am sending to ctree. The graph produced is very
> informative, but I need the information from the plot(Marshct)
>
> Marshct <- ctree(Physiogomy ~ meanAnnualDepthAve + meanAnnualDepthWetAve +
> medAnnualDepthAve + medianAnnualDepthWetAve + medianAnnualDepthDryAve +
> continHydroWetAve + DCHperiodAverage + DCHydroDryAve +
> threeDayWaterDepthMinAve + threeDayWaterDepthMaxAve + sevenDayDryFreqAve +
> sevenDayWaterDepthMaxAve + sevenDayWaterDepthMinAve +
> seventeenDayWaterDepMaxAve + seventeenDayWaterDepMinAve +
> thirtyoneDayWaterDepthMaxAve + wetIntensityAve + BulkDensity + LOI + TP +
> TN + TC + Total_Mg, data = Marsh)
>
> plot(Marshct)
>
>
> Working in Windows XP with R2.11.1 (2010-05-31)
>
> Thanks
> Steve
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman_at_nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys_at_Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 21 Jun 2010 - 14:06:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jun 2010 - 15:20:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive