Don McKenzie wrote:
>> I would like to create a modified version of text.tree() to
>> write back-transformed fitted values at the terminal nodes.
>> ...
Add a new argument BACKTRANS to text.tree()
an insert the following lines before, e.g.,
cxy <- par("cxy")[2]
### ------------------------------------------------------------
if(is.null(ylevels)){ # only for regression trees
if(!missing(BACKTRANS)){
if(is.character(BACKTRANS))
BACKTRANS <- get(BACKTRANS, mode = "function")
else if(mode(BACKTRANS) != "function") {
farg <- substitute(BACKTRANS)
if(mode(farg) == "name")
BACKTRANS <- get(farg, mode = "function")
else stop(paste("\"", farg, "\" is not a function", sep = ""))
}
frame$yval <- BACKTRANS(frame$yval) # back transformation
}
}
### -------------------------------------------------------------
You can add these lines to the function post.tree() as well
(which does not call text.tree).
But I am not sure whether post.tree() is available in v. 4.5 for
Windows.
-- Christian
----------------------------------------------------------
Christian Keller Tel: +41 61 686 98 81
AICOS Technologies AG Fax: +41 61 686 98 88
Efringerstrasse 32 email: ckeller@aicos.com
CH-4057 Basel, Switzerland Web: http://www.aicos.com/
----------------------------------------------------------
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|