Learn R Programming

TDMR (version 2.2)

predict.TDMenvir: Make a prediction using the last model.

Description

Make a prediction with objects of class TDMenvir, TDMclassifier, TDMregressor. The prediction is based on the (last) model trained during unbiasedRun.

Usage

# S3 method for TDMenvir
predict(object, ...)

# S3 method for TDMclassifier predict(object, ...)

# S3 method for TDMregressor predict(object, ...)

Arguments

object

an object of class TDMenvir, TDMclassifier, TDMregressor containing in element lastModel the relevant model.

...

arguments passed on to the model's predict function. Usually the first argument of ... should be newdata, a data frame for which new predictions are desired.

Value

a vector with length nrow(newdata) containing the new predictions.

Examples

Run this code
# NOT RUN {
   
# }
# NOT RUN {
   ## This example requires that demo04cpu.r is executed first (it will write demo04cpu.RData)
   path <- paste(find.package("TDMR"), "demo01cpu/",sep="/");
   tdm <- list(  filenameEnvT="demo04cpu.RData" );   # file with environment envT 
   load(paste(path,tdm$filenameEnvT,sep="/"));
              
   # take only the first 15 records:
   newdata=read.csv2(file=paste(path,"data/cpu.csv", sep=""), dec=".")[1:15,];     
   z=predict(envT,newdata);
   print(z);
   
# }

Run the code above in your browser using DataLab