Re: [R] ctree (party) - select a specific variable in the first split

2013-04-02 Thread Salvatore Loguercio

Hi Achim,

Thank you for the quick suggestion. I actually did the first split 
manually, then grew two trees in the two subsets, it worked.


Best,
Sal


Hello,

My question is related to ctree() function from the library 'party'.

See fortune(58).


Yeah, package 'party' - sorry for the confusion.




Is there a way to force ctree() to use a specific variable in the first
split?

No way that does this automatically.


I am asking because the first split contains two variables with very
similar scores, and choosing the alternative variable would induce a
tree somewhat easier to interpret.

If both variables are closely correlated and you believe one of the
variables to be more meaningful for partitioning, then omit the other from
tree construction.

Alternatively, you can grow two trees in the two subsets based on the






first variable.

hth,
Z


Thanks,
Sal

__
R-help@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.




--
Salvatore Loguercio, Ph.D.
Research Associate - Su Lab
Department of Molecular and
 Experimental Medicine
The Scripps Research Institute
http://sulab.org
logue...@scripps.edu
858-784-2112

__
R-help@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.


Re: [R] ctree (party) - select a specific variable in the first split

2013-04-02 Thread Achim Zeileis

On Mon, 1 Apr 2013, Salvatore Loguercio wrote:


Hello,

My question is related to ctree() function from the library 'party'.


See fortune(58).

Is there a way to force ctree() to use a specific variable in the first 
split?


No way that does this automatically.

I am asking because the first split contains two variables with very 
similar scores, and choosing the alternative variable would induce a 
tree somewhat easier to interpret.


If both variables are closely correlated and you believe one of the 
variables to be more meaningful for partitioning, then omit the other from

tree construction.

Alternatively, you can grow two trees in the two subsets based on the 
first variable.


hth,
Z


Thanks,
Sal

__
R-help@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.



__
R-help@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.


Re: [R] ctree

2012-11-14 Thread Achim Zeileis
Did you try the example that I sent you? I think it does what you ask for...


(sent from mobile phone)mia88  wrote:Hey thanks 
for your help. Im afraid its a little bit too complicated for me..
Before I do al lot of research in the next days to finally understand it I
would like to make sure that it does help me with my problem. 
Maybe I explain it once again : For example in the first node I can read
that group 2 is selected between 0.3 and 0.4 but I need the exact number so
that I can use it to get the sensitivity and specifity...



--
View this message in context: 
http://r.789695.n4.nabble.com/ctree-tp4649478p4649538.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] ctree

2012-11-14 Thread mia88
Hey thanks for your help. Im afraid its a little bit too complicated for me..
Before I do al lot of research in the next days to finally understand it I
would like to make sure that it does help me with my problem. 
Maybe I explain it once again : For example in the first node I can read
that group 2 is selected between 0.3 and 0.4 but I need the exact number so
that I can use it to get the sensitivity and specifity...



--
View this message in context: 
http://r.789695.n4.nabble.com/ctree-tp4649478p4649538.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] ctree

2012-11-14 Thread Achim Zeileis

On Wed, 14 Nov 2012, mia88 wrote:

Hello, I plotted a nice tree with "ctree" . It shows 3 nodes with the 
prediction of my 2 groups. (see picture) Unfortunately I need a larger 
scale to read the exact prediction of my groups to get the specificity 
and sensitivity. I tried to change the scale with "axis" but it didn't 
work, my guess because it's not a normal graph with x and y axis. Has 
someone an idea how to change the scales in the nodes of my tree?


I'm not exactly sure how you would like to improve the visualization. I 
could think of two options: (1) Use a y-axis labeling with only the 
predicted probability (rounded to some precision). (2) Add some label, 
e.g., at the bottom of the bars, with the predicted probability.


While both options are in principle possible, neither is available out of 
the box. It requires some programming using the "grid" package in which 
the party plots are created. However, if you start out from the 
node_barplot() function provided in the package, not a lot of programming 
is necessary. As an example, I have created a function node_barplot2() 
with a modified grid.yaxis() call to implement option (1) outlined above. 
See the code below. To try it out, please source the entire function 
_including_ the class() assignment at the end. And then you can do:


## package and tree for Pima Indians Diabetes data
library("party")
data("PimaIndiansDiabetes", package = "mlbench")
ct <- ctree(diabetes ~ ., data = PimaIndiansDiabetes)

## visualizations: default and alternative y-axis and more spaces
plot(ct)
plot(ct, terminal_panel = node_barplot2)
plot(ct, terminal_panel = node_barplot2,
  tp_args = list(ylines = c(2, 4)))

Hope that helps,
Z


node_barplot2 <- function(ctreeobj,
 col = "black",
 fill = NULL,
 beside = NULL,
 ymax = NULL,
 ylines = NULL,
 widths = 1,
 gap = NULL,
 reverse = NULL,
 id = TRUE)
{
getMaxPred <- function(x) {
  mp <- max(x$prediction)
  mpl <- ifelse(x$terminal, 0, getMaxPred(x$left))
  mpr <- ifelse(x$terminal, 0, getMaxPred(x$right))
  return(max(c(mp, mpl, mpr)))
}

y <- response(ctreeobj)[[1]]

if(is.factor(y) || class(y) == "was_ordered") {
ylevels <- levels(y)
if(is.null(beside)) beside <- if(length(ylevels) < 3) FALSE else TRUE
if(is.null(ymax)) ymax <- if(beside) 1.1 else 1
if(is.null(gap)) gap <- if(beside) 0.1 else 0
} else {
if(is.null(beside)) beside <- FALSE
if(is.null(ymax)) ymax <- getMaxPred(ctreeobj@tree) * 1.1
ylevels <- seq(along = ctreeobj@tree$prediction)
if(length(ylevels) < 2) ylevels <- ""
if(is.null(gap)) gap <- 1
}
if(is.null(reverse)) reverse <- !beside
if(is.null(fill)) fill <- gray.colors(length(ylevels))
if(is.null(ylines)) ylines <- if(beside) c(3, 4) else c(1.5, 2.5)

### panel function for barplots in nodes
rval <- function(node) {

## parameter setup
pred <- node$prediction
if(reverse) {
  pred <- rev(pred)
  ylevels <- rev(ylevels)
}
np <- length(pred)
nc <- if(beside) np else 1

fill <- rep(fill, length.out = np)
widths <- rep(widths, length.out = nc)
col <- rep(col, length.out = nc)
ylines <- rep(ylines, length.out = 2)

gap <- gap * sum(widths)
yscale <- c(0, ymax)
xscale <- c(0, sum(widths) + (nc+1)*gap)

top_vp <- viewport(layout = grid.layout(nrow = 2, ncol = 3,
   widths = unit(c(ylines[1], 1, ylines[2]), c("lines", "null", 
"lines")),
   heights = unit(c(1, 1), c("lines", "null"))),
   width = unit(1, "npc"),
   height = unit(1, "npc") - unit(2, "lines"),
   name = paste("node_barplot", node$nodeID, sep = ""))

pushViewport(top_vp)
grid.rect(gp = gpar(fill = "white", col = 0))

## main title
top <- viewport(layout.pos.col=2, layout.pos.row=1)
pushViewport(top)
mainlab <- paste(ifelse(id, paste("Node", node$nodeID, "(n = "), "n = 
"),
 sum(node$weights), ifelse(id, ")", ""), sep = "")
grid.text(mainlab)
popViewport()

plot <- viewport(layout.pos.col=2, layout.pos.row=2,
 xscale=xscale, yscale=yscale,
 name = paste("node_barplot", node$nodeID, "plot",
 sep = ""))

pushViewport(plot)

if(beside) {
  xcenter <- cumsum(widths+gap) - widths/2
  for (i in 1:np) {
grid.rect(x = xcenter[i], y = 0, height = pred[i],
  width = widths[i],
  just = c("center", "bottom"), default.units 

Re: [R] Ctree plot

2012-08-09 Thread Weidong Gu
Hi,

You may want to check grid.arrange in gridExtra package.

Weidong

On Thu, Aug 9, 2012 at 7:36 AM, rodrock  wrote:
> HI everybody!
>
> Has anybody figure out how would be possible to plot several ctree plots
> beside each other?
> I would really appreciate it
>  My idea would be like this, but the par() function seem to be lower in
> hierarchy
> Thanks in advance
> #
> library(party)
>
> mtree <- ctree(Species ~ ., data=iris)
> sep.tree<-ctree(Sepal.Length ~ ., data=iris)
>
> par(mfrow=c(1,2)) # Does not work
> plot(mtree)
> plot(sep.tree)
>
>
>
>
> -
> Rodrigo Vargas G.
> -
> Silviculture Institute
> Freiburg University
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Ctree-plot-tp4639750.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.

__
R-help@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.


Re: [R] ctree for suvival analysis problem

2012-05-17 Thread ofraam
Thanks David!!!
Sorry for the stupid question...

Seems like I still have issues with pec, but I will work on it some more...

--
View this message in context: 
http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362p4630408.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] ctree for suvival analysis problem

2012-05-17 Thread David Winsemius


On May 17, 2012, at 11:04 AM, ofraam wrote:


Thanks very much Achim!
I was indeed using "pec" which requires "rms"...

I see now that the old version of pec that I used didn't require rms  
and
therefore I had no problem.. I'm guessing I don't need the rms  
methods for

my use of pec, but am not sure how I can remove the dependency or
alternatively mask back the "Surv" object to survival package. Any  
ideas for

that?


Perhaps:

GBSG2ct <- ctree(survival::Surv(time, cens) ~ .,data = GBSG2)

--
David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] ctree for suvival analysis problem

2012-05-17 Thread ofraam
Thanks very much Achim!
I was indeed using "pec" which requires "rms"... 

I see now that the old version of pec that I used didn't require rms and
therefore I had no problem.. I'm guessing I don't need the rms methods for
my use of pec, but am not sure how I can remove the dependency or
alternatively mask back the "Surv" object to survival package. Any ideas for
that?

Thanks again!

Ofra


--
View this message in context: 
http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362p4630403.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] ctree for suvival analysis problem

2012-05-17 Thread Achim Zeileis

On Thu, 17 May 2012, ofraam wrote:


Hi All,

I'm using the party package to grow conditional inference trees for survival
analysis.
When I used party version  party_0.9-9991 everything worked well, but when I
update to party_1.0-2 (due to using 64bit R), I get an error. For simplicity
I will show the error I get for the example in the party documentation:
### survival analysis
if (require("ipred")) {
data("GBSG2", package = "ipred")
GBSG2ct <- ctree(Surv(time, cens) ~ .,data = GBSG2)
plot(GBSG2ct)
treeresponse(GBSG2ct, newdata = GBSG2[1:2,])
}


Works for me without a problem.


for the plot(GBSG2ct) line I get the following error:
Error in Summary.Surv(c(1814, 2018, 712, 1807, 772, 448, 2172, 2161, 471,  :
 Invalid operation on a survival time

and for treeresponse(GBSG2ct, newdata = GBSG2[1:2,]) I get this error:
Error: extends(class(y), "Surv") is not TRUE

(I care more about treeresponse but assume it is related).


My guess is that you have loaded package "rms" but haven't told us so. 
This overwrites Surv() in a way that is incompatible with the usage in 
ctree().


Best,
Z



Any help would be highly appreciated!

Thanks,
Ofra

--
View this message in context: 
http://r.789695.n4.nabble.com/ctree-for-suvival-analysis-problem-tp4630362.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] ctree question

2012-01-18 Thread Achim Zeileis

On Wed, 18 Jan 2012, seanstcl...@verizon.net wrote:



  Hello.  I have used the "party" package to generate a regression tree as
  follows:

  >origdata<-read.csv("origdata.csv")
  >ctrl<-ctree_control(mincriterion=0.99,maxdepth=10,minbucket=10)
  >test.ct<-ctree(Y~X1+X2+X3,data=origdata,control=ctrl)

  The above works fine.  Orig data was my training data.  I now have a test
  data file (testdata), and would like to run the testdata through the above
  tree to see predictions.  I tried using the following function

  >predict(test.ct,newdata=testdata)

  but I get the following error:

  Error in checkData(oldData, RET) :
Levels in factors of new data do not match original data

  I've looked at the testdata file closely and it does not appear to contain
  any levels of factors that were not in the original.


Did you check carefully enough? compare

levels(origdata$X1)
levels(testdata$X1)

and so on for X2 and X3. Maybe the _observed_ levels in the testdata are 
ok but not all levels.

Z


  What might I be doing
  incorrectly, and how can i use the tree that was generated above to
  generate predictions for this new file testdata?

  THanks.
  sean
__
R-help@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.



__
R-help@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.


Re: [R] ctree and survival problem

2011-04-28 Thread moleps
Yup, thats the culprit. Thx.

//M


On 28. apr. 2011, at 18.36, Achim Zeileis wrote:

> On Thu, 28 Apr 2011, moleps wrote:
> 
>> sessionInfo yields the following:
> 
> OK, the "Design" package causes the problem here. When you load the Design 
> package, it provides a new Surv() and related methods. This clashes with the 
> computations of ctree() based on Surv(). So it's better not to load both 
> packages simultaneously...
> Z
> 
>>> sessionInfo()
>> R version 2.11.1 (2010-05-31)
>> x86_64-apple-darwin9.8.0
>> 
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>> 
>> attached base packages:
>> [1] stats4tcltk splines   grid  stats graphics  grDevices 
>> utils datasets  methods   base
>> 
>> other attached packages:
>> [1] ipred_0.8-8class_7.3-3mlbench_2.1-0  rpart_3.1-46
>>party_0.9-1vcd_1.2-9  colorspace_1.0-1   
>> strucchange_1.4-3  coin_1.0-18mvtnorm_0.9-95
>> [11] modeltools_0.2-17  Design_2.3-0   car_2.0-8  nnet_7.3-1 
>> sandwich_2.2-6 boot_1.2-43Amelia_1.2-18  lmtest_0.9-27   
>>zoo_1.6-4  MASS_7.3-7
>> [21] mgcv_1.7-2 cem_1.0.142randomForest_4.6-2 
>> lattice_0.19-17nlme_3.1-97rgl_0.92.798   Hmisc_3.8-3
>> survival_2.36-2ggplot2_0.8.9  proto_0.3-8
>> [31] reshape_0.8.3  plyr_1.4   foreign_0.8-41
>> 
>> loaded via a namespace (and not attached):
>> [1] cluster_1.13.2 digest_0.4.2   Matrix_0.999375-46 tools_2.11.1
>> 
>> 
>> As i described in the original post I ran
>> 
>>> example(ctree)
>> 
>> and the following part yields an error:
>> 
>> 
>> if (require("ipred")) {
>>   data("GBSG2", package = "ipred")
>>   GBSG2ct <- ctree(Surv(time, cens) ~ .,data = GBSG2)
>>   plot(GBSG2ct)
>>   treeresponse(GBSG2ct, newdata = GBSG2[1:2,])
>>   }
>> 
>> Error in Summary.Surv(c(1814, 2018, 712, 1807, 772, 448, 2172, 2161, 471,  :
>> Invalid operation on a survival time
>> 
>> 
>> //M
>> 
>> 
>> 
>> 
>> 
>> On 28. apr. 2011, at 14.19, Jonathan Daily wrote:
>> 
>>> It would help people who know more about R's guts than me if you
>>> posted your sessionInfo() output and exactly what commands produced
>>> your error.
>>> 
>>> It is also recommended that you try simply upgrading R to the latest
>>> version and see if you get an error with the latest version of
>>> 'party'. My guess is that the error will go away.
>>> 
>>> On Wed, Apr 27, 2011 at 3:40 PM, moleps  wrote:
 Forgot to mention that the ctree command is from the party library.
 //M
 
 __
 R-help@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.
 
>>> 
>>> 
>>> 
>>> --
>>> ===
>>> Jon Daily
>>> Technician
>>> ===
>>> #!/usr/bin/env outside
>>> # It's great, trust me.
>> 
>> __
>> R-help@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.
>> 

__
R-help@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.


Re: [R] ctree and survival problem

2011-04-28 Thread Achim Zeileis

On Thu, 28 Apr 2011, moleps wrote:


sessionInfo yields the following:


OK, the "Design" package causes the problem here. When you load the Design 
package, it provides a new Surv() and related methods. This clashes with 
the computations of ctree() based on Surv(). So it's better not to load 
both packages simultaneously...

Z


sessionInfo()

R version 2.11.1 (2010-05-31)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4tcltk splines   grid  stats graphics  grDevices utils 
datasets  methods   base

other attached packages:
[1] ipred_0.8-8class_7.3-3mlbench_2.1-0  rpart_3.1-46   
party_0.9-1vcd_1.2-9  colorspace_1.0-1   strucchange_1.4-3  
coin_1.0-18mvtnorm_0.9-95
[11] modeltools_0.2-17  Design_2.3-0   car_2.0-8  nnet_7.3-1
 sandwich_2.2-6 boot_1.2-43Amelia_1.2-18  lmtest_0.9-27  
zoo_1.6-4  MASS_7.3-7
[21] mgcv_1.7-2 cem_1.0.142randomForest_4.6-2 lattice_0.19-17   
 nlme_3.1-97rgl_0.92.798   Hmisc_3.8-3survival_2.36-2
ggplot2_0.8.9  proto_0.3-8
[31] reshape_0.8.3  plyr_1.4   foreign_0.8-41

loaded via a namespace (and not attached):
[1] cluster_1.13.2 digest_0.4.2   Matrix_0.999375-46 tools_2.11.1


As i described in the original post I ran


example(ctree)


and the following part yields an error:


 if (require("ipred")) {
   data("GBSG2", package = "ipred")
   GBSG2ct <- ctree(Surv(time, cens) ~ .,data = GBSG2)
   plot(GBSG2ct)
   treeresponse(GBSG2ct, newdata = GBSG2[1:2,])
   }

Error in Summary.Surv(c(1814, 2018, 712, 1807, 772, 448, 2172, 2161, 471,  :
 Invalid operation on a survival time


//M





On 28. apr. 2011, at 14.19, Jonathan Daily wrote:


It would help people who know more about R's guts than me if you
posted your sessionInfo() output and exactly what commands produced
your error.

It is also recommended that you try simply upgrading R to the latest
version and see if you get an error with the latest version of
'party'. My guess is that the error will go away.

On Wed, Apr 27, 2011 at 3:40 PM, moleps  wrote:

Forgot to mention that the ctree command is from the party library.
//M

__
R-help@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.





--
===
Jon Daily
Technician
===
#!/usr/bin/env outside
# It's great, trust me.


__
R-help@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.



__
R-help@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.


Re: [R] ctree and survival problem

2011-04-28 Thread moleps
sessionInfo yields the following:

> sessionInfo()
R version 2.11.1 (2010-05-31) 
x86_64-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
 [1] stats4tcltk splines   grid  stats graphics  grDevices 
utils datasets  methods   base 

other attached packages:
 [1] ipred_0.8-8class_7.3-3mlbench_2.1-0  rpart_3.1-46  
 party_0.9-1vcd_1.2-9  colorspace_1.0-1   strucchange_1.4-3  
coin_1.0-18mvtnorm_0.9-95
[11] modeltools_0.2-17  Design_2.3-0   car_2.0-8  nnet_7.3-1
 sandwich_2.2-6 boot_1.2-43Amelia_1.2-18  lmtest_0.9-27  
zoo_1.6-4  MASS_7.3-7
[21] mgcv_1.7-2 cem_1.0.142randomForest_4.6-2 lattice_0.19-17   
 nlme_3.1-97rgl_0.92.798   Hmisc_3.8-3survival_2.36-2
ggplot2_0.8.9  proto_0.3-8   
[31] reshape_0.8.3  plyr_1.4   foreign_0.8-41

loaded via a namespace (and not attached):
[1] cluster_1.13.2 digest_0.4.2   Matrix_0.999375-46 tools_2.11.1  


As i described in the original post I ran

> example(ctree) 

and the following part yields an error:


  if (require("ipred")) {
data("GBSG2", package = "ipred")
GBSG2ct <- ctree(Surv(time, cens) ~ .,data = GBSG2)
plot(GBSG2ct)
treeresponse(GBSG2ct, newdata = GBSG2[1:2,])
}

Error in Summary.Surv(c(1814, 2018, 712, 1807, 772, 448, 2172, 2161, 471,  : 
  Invalid operation on a survival time


//M





On 28. apr. 2011, at 14.19, Jonathan Daily wrote:

> It would help people who know more about R's guts than me if you
> posted your sessionInfo() output and exactly what commands produced
> your error.
> 
> It is also recommended that you try simply upgrading R to the latest
> version and see if you get an error with the latest version of
> 'party'. My guess is that the error will go away.
> 
> On Wed, Apr 27, 2011 at 3:40 PM, moleps  wrote:
>> Forgot to mention that the ctree command is from the party library.
>> //M
>> 
>> __
>> R-help@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.
>> 
> 
> 
> 
> -- 
> ===
> Jon Daily
> Technician
> ===
> #!/usr/bin/env outside
> # It's great, trust me.

__
R-help@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.


Re: [R] ctree and survival problem

2011-04-28 Thread Jonathan Daily
It would help people who know more about R's guts than me if you
posted your sessionInfo() output and exactly what commands produced
your error.

It is also recommended that you try simply upgrading R to the latest
version and see if you get an error with the latest version of
'party'. My guess is that the error will go away.

On Wed, Apr 27, 2011 at 3:40 PM, moleps  wrote:
> Forgot to mention that the ctree command is from the party library.
> //M
>
> __
> R-help@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.
>



-- 
===
Jon Daily
Technician
===
#!/usr/bin/env outside
# It's great, trust me.

__
R-help@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.


Re: [R] Ctree Model Variables

2011-03-24 Thread Achim Zeileis

On Thu, 24 Mar 2011, jdanielnd wrote:


Hello!

I am not familiar to deal with S4 objects in R, so this question can be
stupid, but I hope I can get an answer. :P

I'm trying to extract what are the response and explanatory variables from a
Binary Tree and Random Forest.

I could already extract the response variable from a Binary Tree using the
response method specified on documentation. But Random Forest didn't had a
similar method.

And regarding the explanatory variables, I couldn't find any solution at
all. It seems to be a simple task to extract the explanatory variables from
a Binary Tree, I just don't know how to deal with the "Slots". In the case
of the Random Forest, the task can be more complicated since it deal with
several trees. What I want is the name of all variables used in any tree.

Does someone have any clue on how should I try to solve this?


ctree() contains a "data" slot which contains an object of 
"ModelEnvFormula". This provides the data along with meta-information 
which variables are input and response variables. See


  help("ModelEnvFormula", package = "modeltools")

for details and examples. As a simple application using ctree(), do the 
following: (1) Fit a ctree() named ct. (2) Extract the associated 
ModelEnvFormula call mf. (3) Inspect the components...


R> ct <- ctree(Species ~ ., data = iris)
R> mf <- ct@data
R> mf

A ModelEnvFormula with

  response variable(s):   Species
  input variable(s):  Sepal.Length Sepal.Width Petal.Length Petal.Width
  number of observations: 150

R> head(mf@get("response"))
  Species
1  setosa
2  setosa
3  setosa
4  setosa
5  setosa
6  setosa
R> head(mf@get("input"))
  Sepal.Length Sepal.Width Petal.Length Petal.Width
1  5.1 3.5  1.4 0.2
2  4.9 3.0  1.4 0.2
3  4.7 3.2  1.3 0.2
4  4.6 3.1  1.5 0.2
5  5.0 3.6  1.4 0.2
6  5.4 3.9  1.7 0.4

Best,
Z


Many thanks!

Joao Daniel Duarte
UFMG - Brazil

--
View this message in context: 
http://r.789695.n4.nabble.com/Ctree-Model-Variables-tp3402604p3402604.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Ctree Question

2010-07-09 Thread Achim Zeileis

On Fri, 9 Jul 2010, steve_fried...@nps.gov wrote:



Hello,

I've been using ctree and have developed a 55 node - 28 terminal solution.
As can be imagined, the plot is difficult to travel down each of the major
branches.

I've read the help files for ctree I saw where terminal nodes can be color
coded.

plot(airct, type = "simple")

plot(airct, terminal_panel = node_boxplot(airct, col = "blue",  + fill =

hsv(2/3, 0.5, 1)))

Here is my question:

Since my model has 55 nodes and 28 terminal nodes,(ie many branches)  is it
feasible to color code the each of the major branches and track the paths
down the decision tree?


I'm not sure what exactly you want: Is it to plot Node XY in a certain 
color, say blue, and also have all branches that lead to that node in 
blue?


If so, you could in principle write a panel function for that but it 
wouldn't be easy, I'm afraid.


Sorry,
Z


R 2.11.1, Windox XP


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_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
R-help@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.



__
R-help@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.


Re: [R] Ctree Question

2010-07-09 Thread Horace Tso
Steve, I'm not sure if your task could be accomplished with a ready-made 
function in party. But, if you could manage to convert your tree structure to a 
dendrogram, then it's straightforward using dendrapply. In fact, there is an 
example in dendrapply help page showing how leaves are colored. 

?dendrapply

HTH.

H

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of steve_fried...@nps.gov
Sent: Friday, July 09, 2010 10:22 AM
To: r-help@r-project.org
Subject: [R] Ctree Question


Hello,

I've been using ctree and have developed a 55 node - 28 terminal solution.
As can be imagined, the plot is difficult to travel down each of the major
branches.

I've read the help files for ctree I saw where terminal nodes can be color
coded.

 plot(airct, type = "simple")
> plot(airct, terminal_panel = node_boxplot(airct, col = "blue",  + fill =
hsv(2/3, 0.5, 1)))

Here is my question:

Since my model has 55 nodes and 28 terminal nodes,(ie many branches)  is it
feasible to color code the each of the major branches and track the paths
down the decision tree?

 R 2.11.1, Windox XP


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_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
R-help@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.

__
R-help@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.


Re: [R] ctree ordering nodes

2010-07-07 Thread Achim Zeileis

On Tue, 6 Jul 2010, Paras Sharma wrote:


Hello,

When using the ctree function, from library (party) what is the syntax to
order the Variables in the nodes in a specific way?

For example, how would I specify to make a binary come first, then a
continuous variable?


Not sure what you mean here. There is only one splitting variable in each 
node... The order in which the variables are tested is simply the order in 
which they appear in the model formula.


If you want to force ctree() to use a specific variable in the first split 
and a specific variable in the second split, this is currently not 
possible. ctree() always selects the locally optimal splitting variable.



Also is there a way to force ctree to show variables which are not
significant?


You can inspect the fitted ctree in various ways. See
  vignette("party", package = "party")
for a few helpful examples, especially Section 5.3.

If you want to construct your own trees using different algorithms, the 
package "partykit" might be of interest which is currently under 
development on R-Forge.


hth,
Z

__
R-help@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.


Re: [R] ctree

2010-06-21 Thread Steve_Friedman
Joris,

Thank you, your solution did what I needed.


Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147


   
 Joris Meys
To 
   steve_fried...@nps.gov  
 06/21/2010 10:03   cc 
 AMr-help@r-project.org
   Subject 
   Re: [R] ctree   
   
   
   
   
   
   




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,   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_fried...@nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> __
> R-help@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.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

__
R-help@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.


Re: [R] ctree

2010-06-21 Thread Joris Meys
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,   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_fried...@nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> __
> R-help@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.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

__
R-help@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.


Re: [R] ctree

2010-06-21 Thread Achim Zeileis

On Mon, 21 Jun 2010, steve_fried...@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_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
R-help@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.



__
R-help@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.


Re: [R] ctree - party package multivariate response variables

2010-03-09 Thread Henric (Nilsson) Winell

On 2010-03-09 04:40, valeriano.parravic...@unige.it wrote:

Hi,

I have a problem with ctree of party package.
I have data on distribution of more than one species (about 50 species) and I
would like identify the relation of this multivariate object (species
distribution) with a number of explanatory variables.

rs is the name of my dataframe containing the species (columns from 2 to 51) and
the explanatory variables (columns 52 and 53). Rows are my sampling sites.

I wrote:

species<-rs[,2:51]
v1<-rs[,52]
v2<-rs[53]
tree<-ctree(species~v1+v2)

It does not work , but when I use the same formula for the univariate case (i.e.
a single column - e.g. the total number of species in each samplig sites) it
works. I know that ctree can handle multivariate response variables, but I
cannot figure out how to do that.


The response variables needs to be explicitly specified, e.g. ctree(y1 + 
y2 ~ x1 + x2) gives you a bivariate response.



HTH,
Henric




Someone can help me?

Thank you



Valeriano

__
R-help@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.



__
R-help@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.


Re: [R] ctree - party package multivariate response variables

2010-03-08 Thread Peter Ehlers

Your description of your data isn't clear to me.
What are the values in column 2, for example?
Are you trying to construct regression or classification trees?

A reproducible example would really help.

 -Peter Ehlers

On 2010-03-08 20:40, valeriano.parravic...@unige.it wrote:

Hi,

I have a problem with ctree of party package.
I have data on distribution of more than one species (about 50 species) and I
would like identify the relation of this multivariate object (species
distribution) with a number of explanatory variables.

rs is the name of my dataframe containing the species (columns from 2 to 51) and
the explanatory variables (columns 52 and 53). Rows are my sampling sites.

I wrote:

species<-rs[,2:51]
v1<-rs[,52]
v2<-rs[53]
tree<-ctree(species~v1+v2)

It does not work , but when I use the same formula for the univariate case (i.e.
a single column - e.g. the total number of species in each samplig sites) it
works. I know that ctree can handle multivariate response variables, but I
cannot figure out how to do that.

Someone can help me?

Thank you



Valeriano

__
R-help@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.




--
Peter Ehlers
University of Calgary

__
R-help@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.


Re: [R] ctree (party) changing font sizes in plots

2009-11-20 Thread Achim Zeileis

On Fri, 20 Nov 2009, Sam Thomas wrote:


When plotting Binary Trees (ctree) from the party package, is there a
way to adjust the font sizes of the leaves?


Currently, this is not implemented in "party". In interactive usage it is 
not easy to change the fontsize. If you're printing to PDF, you could 
easily increase/decrease the height and width which will decrease/increase 
the relative size of the text, respectively. Not elegant but works.


Alternatively, you could obtain the "partykit" package from R-Forge which 
has a new implementation of general infrastructure for tree. With that you 
can do


library("partykit")
irisct <- ctree(Species ~ ., data = iris)
plot(irisct, gp = gpar(fontsize = 20))

Note that "party" and "partykit" should not be used together, partykit has 
a slightly enhanced/modified ctree() function.


hth,
Z




require(party)

irisct <- ctree(Species ~ ., data = iris)

plot(irisct)



I want to adjust the font sizes for "Node 2", "Node 5", etc.  I'd also
like to be able to adjust the font sizes for the x-axis and y-axis
labels of the histograms.



Thanks,



Sam Thomas

Revelant Technologies, LLC.

sam.tho...@revelanttech.com 

317-696-9214




[[alternative HTML version deleted]]

__
R-help@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.




__
R-help@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.


Re: [R] ctree (party) plot meaning question

2008-06-30 Thread Gavin Simpson
On Mon, 2008-06-30 at 10:41 -0700, Birgitle wrote:
> I tried to use ctree but am not sure about the meaning of the plot.
> 
> My.data.ct<-ctree(Resp~., data=My.data)
> plot(My.data.ct)
> 
> My data.frame contains 88 explanatory variables (continous,ordered/unordered
> multistate,count data) and one response with two groups.
> 
> In the plot are only two variables shown (2 internal nodes) and 3 final
> nodes. Does it mean that only these two variables show a significant
> asssociation with the response?
> 
> :confused:
> 
> Many thanx in advance

Yes, very simply. Nodes are only split if a split has a p-value of less
than 1-mincriterion, where mincriterion is 0.95 by default, in a test of
independence between the response variable and the predictor.

Using an internal data set:

mod <- ctree(Species ~ . , data = iris)
plot(mod)

The plot (on my machine) shows 3 internal nodes resulting in 4 leaves.
Petal length and petal width are the two selected variables. The Sepal
length and width variables are not selected.

Now what happens if we reduce mincriterion? (This is a silly example -
you wouldn't want to select a split with a p-value that high):

mod1 <- ctree(Species ~ . , data = iris, 
  control = ctree_control(mincriterion = 0.8))
plot(mod1)

Now we see that a further split on Petal width has been made, but notice
the p-value for this split.

So nodes are only split if the null hypothesis of independence between a
the response and the predictors cannot be rejected at the given level of
significance (1 - mincriterion).

This is a different approach to rpart/mvpart, where splitting is based
on a few simple stopping rules and then cross-validation is used to
prune the tree back.

You'd be best to read the cited references in ?ctree for more background
on these conditional inference trees.

HTH

G

> 
> B.
> 
> 
> 
> 
> 
> -
> The art of living is more like wrestling than dancing.
> (Marcus Aurelius)

__
R-help@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.