ctev <- function(y, wt,parms) {
out = node_evaluate(y)
list(label= out[1], deviance=out[2])
}
ctsplit <- function(y, wt, x, parms, continuous) {
if (continuous) {
n = nrow(y)
res = splitc(y)
list(goodness=res[1:(n-1)], direction=res[n:(2*(n-1))])
}
else{
res = splitnc(y,x)
n=(length(res)+1)/2
list(goodness=res[1:(n-1)], direction=res[n:(2*n-1)])
}
}
ctinit <- function(y, offset, parms, wt) {
sfun <- function(yval, dev, wt, ylevel, digits ) {
print(yval)
paste("events=", round(yval[,1]),
", coef= ", format(signif(yval[,2], digits)),
", deviance=" , format(signif(dev, digits)),
sep = '')}
environment(sfun) <- .GlobalEnv
list(y =y, parms = 0, numresp = 1, numy = 4,
summary = sfun)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.