Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: hazreg
See also: stree plotstree

Quantlet: grstree
Description: generates a survival tree

Reference(s):

Link:
Usage: {cdata,bdata,aldata,ardata,ctext,btext,atext} = grstree(streedata{,col{,fontsize{,varname}}})
Input:
streedata list of various parameters given from <a href="stree.html">stree</a> and which are necessary for the plotting
col n x 1 vector of colors, col[1] corresponds to the color of the circles, col[2] to the color of their descriptions, col[3] to the color of the boxes, col[4] to the color of their descriptions, col[5] represents the color of the arrows and col[6] their descriptions
fontsize scalar, size of the font used
varname string vector, names of the split variables
Output:
cdata graphical object representing the circles (internal nodes) in the tree
bdata graphical object, the boxes (terminal nodes) in the tree
aldata graphical object, the left arrows in the tree
ardata graphical object, the right arrows in the tree
ctext coordinates of the text in the circles
btext coordinates of the text in the boxes
atext coordinates of the text at the arrows

Note:

Example:
library("hazreg")
randomize(666)
n = 100
p = 4
beta = 1|2|1|2                  ; regression parameter
z = 1 + uniform(n,p)            ; covariates
y = -log(1-uniform(n))          ; exponential survival
y = y./exp(z*beta)              ; covariate effects
c = 4*uniform(n)                ; uniform censoring
t = min(y~c,2)                  ; censored time
delta =(y<=c)                  ; censoring indicator
nom = 0*matrix(30)|matrix(30)
nom = nom|2*matrix(40)
ctypes = 0|0|0|0|1		     ; types of covariates
method = "logrank"
st=stree(100*z~nom, t, delta, ctypes, method,0)	; no display will be returned
streedata=st.groutput           ; get the graphical object
col = 0*matrix(6)		     ; black Stree for print
fontsize = 12
varname = "apple"|"pear"|"orange"|"lemon"|"dog"
gr=grstree(streedata,col,fontsize,varname)
c  = gr.cdata
b  = gr.bdata
al = gr.aldata
ar = gr.ardata
ct = gr.ctext
bt = gr.btext
at = gr.atext
sdisp = createdisplay(1,1)
axesoff()
show(sdisp,1,1,c,b,al,ar)
setgopt(sdisp,1,1,"title","Example of a survival tree")
axeson()

Result:
A black survival tree without any description is plotted together
with the following text output.

The Survival Tree:
----------------------------------------------------------
----------------------------------------------------------
             Log rank method (before Prune)
----------------------------------------------------------
      |       |daughter-nodes|   median |split  |  split
node #| cases |left    right |   value  | var # |  value
----------------------------------------------------------
   1     100      2      3       0.00       2    171.02
   2      67      4      5       0.00       1    138.41
   3      33      6      7       0.00       4    157.87
   4      29      8      9       0.00       4    126.47
   5      38     10     11       0.00       4    153.24
   7      19     12     13       0.00       3    158.98
   9      18     14     15       0.00       3    145.61
  10      19     16     17       0.00       5     {2}
  11      19     18     19       0.00       3    160.77
----------------------------------------------------------
             Log rank method (after Prune)
----------------------------------------------------------
      |       |daughter-nodes|   median |split  |  split
node #| cases |left    right |   value  | var # |  value
----------------------------------------------------------
   1     100      2      3       0.00       2    171.02
   2      67      4      5       0.00       1    138.41
   3      33      6      7       0.00       4    157.87
   4      29      8      9       0.00       4    126.47
   5      38     10     11       0.00       4    153.24
  11      19     18     19       0.00       3    160.77
----------------------------------------------------------
----------------------------------------------------------



Author: K. Komorad, W. Haerdle, 20020322 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006