[R] ctree
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Mon Jun 21 15:51:43 CEST 2010
On Mon, 21 Jun 2010, 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)
You can compute the information from
where(iris.ct) ## terminal node ids
treeresponse(iris.ct) ## associated predicted probabilities
So, you could do
tapply(treeresponse(iris.ct), where(iris.ct), unique)
hth,
Z
> 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.
>
More information about the R-help
mailing list