[R] impcat='tree'
Laura Bonnett
l.j.bonnett at googlemail.com
Fri Mar 6 12:53:12 CET 2009
Dear All,
I am going through a worked example provided by Harrell, Lee and Mark
(1996, Stats in Medicine, 15, 361-387). I know that the code provided
is for S-PLUS and R but the languages don't differ enough for this to
be a problem.
I am using the Hmisc and Design libraries and have used the following
code (as shown in the example provided in the referenced paper):
'%in%' <- function(a,b)match(a,b,nomatch=0)>0 # Define function for
easy determination of whether a value is in a list
levels(ekg)[levels(ekg)%in%c('oldMI','recentMI')] <- 'MI' # Combines
last 2 levels and uses a new name, MI
pf.coded <- as.integer(pf) # Save original pf, re-code to 1-4
levels(pf) <- c(levels(pf)[1:3],levels(pf)[3]) # Combine last 2 levels
of original
This is where I have the problem. I am writing an imputation rule:
w <- transcan(~sz+sg+ap+sbp+dbp+age+wt+hg+ekg+pf+bm+hx,imputed=TRUE,data=prostate,impcat='tree')
However I get the following error message(s)
Convergence criterion:1.511 0.787 0.41 0.215 0.115 0.062 Error: could
not find function "tree"
In addition: Warning messages:
1: In approx(y, x, xout = aty, rule = rule) :
collapsing to unique 'x' values
2: In approx(y, x, xout = aty, rule = rule) :
collapsing to unique 'x' values
3: In approx(y, x, xout = aty, rule = rule) :
collapsing to unique 'x' values
4: In approx(y, x, xout = aty, rule = rule) :
collapsing to unique 'x' values
Has anyone had a similar problem? If so, any solution?
Thank you,
Laura
More information about the R-help
mailing list