R/predict.itrfit.R

Defines functions predict.itrfit

Documented in predict.itrfit

predict.itrfit=function(obj, newdata=NULL, option='refine', delta=NULL, fence=NULL, ...) {
 inner=getInner(obj, newdata)
 c=obj$c
 if (option=='refine' & c>1) {
  if (is.null(delta)) {
   if (is.null(obj$refine_par)) stop('tunning parameter "delta" is missing!')
   else delta=obj$refine_par[1]
  }
  if (is.null(fence)) {
   if (is.null(obj$refine_par)) stop('tunning parameter "fence" is missing!')
   else fence=obj$refine_par[2]
  }
  rule=pred_refine(inner, delta, fence)
  attr(rule, 'outcome.ratio')=c
  class(rule)=c('ITR', 'matrix')
 } else {
  rule=pred(inner)
 }
 return(rule)
}
menghaomiao/itrrnr documentation built on June 21, 2020, 2:22 a.m.