R/Predict.OTReg.R

Defines functions Predict.OTReg

Documented in Predict.OTReg

Predict.OTReg <-
function(Opt.Trees,XTesting, YTesting){
  
  
  Predictions=predict(Opt.Trees$t.object, XTesting)
  if(is.null(YTesting)){
    mylist <- list("Pr.Values"=Predictions)
    return(mylist)
  }
  
  else{
  SST <- sum((YTesting-mean(YTesting))^2)
  SSE <- sum((YTesting-Predictions)^2)
  R.Squared=1-SSE/SST
  Unexplained <- SSE/SST #R-squared=1-SSE/SST
  
  mylist <- list("R.Squared"=R.Squared,"Unexp.Variations"=Unexplained,"Pr.Values"=Predictions, "Trees.Used"=Opt.Trees$t.object$ntree)
  return(mylist)
  }
}

Try the OTE package in your browser

Any scripts or data that you put into this service are public.

OTE documentation built on April 20, 2020, 5:05 p.m.