Learn R Programming

plsRcox (version 1.0)

predict.plsRcoxmodel: Print method for plsRcox models

Description

This function provides a predict method for the class "plsRcoxmodel"

Usage

## S3 method for class 'plsRcoxmodel':
predict(object,newdata,comps=object$computed_nt,
type=c("lp", "risk", "expected", "terms", "scores"),se.fit=FALSE,
weights,methodNA="adaptative",...)

Arguments

object
An object of the class "plsRcoxmodel".
newdata
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.
comps
A value with a single value of component to use for prediction.
type
Type of predicted value. Choices are the linear predictor ("lp"), the risk score exp(lp) ("risk"), the expected number of events given the covariates and follow-up time ("expected"), the terms of the linear predictor
se.fit
If TRUE, pointwise standard errors are produced for the predictions using the Cox model.
weights
Vector of case weights. If weights is a vector of integers, then the estimated coefficients are equivalent to estimating the model from data with the individual cases replicated as many times as indicated by weights.
methodNA
Selects the way of predicting the response or the scores of the new data. For complete rows, without any missing value, there are two different ways of computing the prediction. As a consequence, for mixed datasets, with complete and incomplete rows, ther
...
Arguments to be passed on to survival::coxph and to plsRglm::PLS_lm.

Value

  • When type is "response", a matrix of predicted response values is returned. When type is "scores", a score matrix is returned.

References

Fr?d?ric{Fr'ed'eric} Bertrand, Myriam Maumy-Bertrand et Nicolas Meyer (2011). R?gression{R'egression} B?ta{B^eta} PLS. Preprint.

See Also

predict.coxph

Examples

Run this code
data(micro.censure)
data(Xmicro.censure_compl_imp)

X_train_micro <- apply((as.matrix(Xmicro.censure_compl_imp)),FUN="as.numeric",MARGIN=2)[1:80,]
Y_train_micro <- micro.censure$survyear[1:80]
C_train_micro <- micro.censure$DC[1:80]

modpls <- plsRcox(X_train_micro,time=Y_train_micro,event=C_train_micro,nt=3)

predict(modpls)    
#Identical to predict(modpls,type="lp")    

predict(modpls,type="risk")    
predict(modpls,type="expected")    
predict(modpls,type="terms")    
predict(modpls,type="scores")    

predict(modpls,se.fit=TRUE)    
#Identical to predict(modpls,type="lp")    
predict(modpls,type="risk",se.fit=TRUE)    
predict(modpls,type="expected",se.fit=TRUE)    
predict(modpls,type="terms",se.fit=TRUE)    
predict(modpls,type="scores",se.fit=TRUE)    


#Identical to predict(modpls,type="lp")    
predict(modpls,newdata=X_train_micro[1:5,],type="risk")    
#predict(modpls,newdata=X_train_micro[1:5,],type="expected")    
predict(modpls,newdata=X_train_micro[1:5,],type="terms")    
predict(modpls,newdata=X_train_micro[1:5,],type="scores")    

#Identical to predict(modpls,type="lp")    
predict(modpls,newdata=X_train_micro[1:5,],type="risk",se.fit=TRUE)    
#predict(modpls,newdata=X_train_micro[1:5,],type="expected",se.fit=TRUE)    
predict(modpls,newdata=X_train_micro[1:5,],type="terms",se.fit=TRUE)    
predict(modpls,newdata=X_train_micro[1:5,],type="scores")    

predict(modpls,newdata=X_train_micro[1:5,],type="risk",comps=1)    
predict(modpls,newdata=X_train_micro[1:5,],type="risk",comps=2)    
predict(modpls,newdata=X_train_micro[1:5,],type="risk",comps=3)    
predict(modpls,newdata=X_train_micro[1:5,],type="risk",comps=4)

predict(modpls,newdata=X_train_micro[1:5,],type="terms",comps=1)    
predict(modpls,newdata=X_train_micro[1:5,],type="terms",comps=2)    
predict(modpls,newdata=X_train_micro[1:5,],type="terms",comps=3)    
predict(modpls,newdata=X_train_micro[1:5,],type="terms",comps=4)

predict(modpls,newdata=X_train_micro[1:5,],type="scores",comps=1)    
predict(modpls,newdata=X_train_micro[1:5,],type="scores",comps=2)    
predict(modpls,newdata=X_train_micro[1:5,],type="scores",comps=3)    
predict(modpls,newdata=X_train_micro[1:5,],type="scores",comps=4)

Run the code above in your browser using DataLab