Description Usage Arguments Value See Also Examples
View source: R/predict.quint.R
Predicts for (new) subjects the treatment subgroups (P1, P2 or P3) based on a fitted
quint
object. The meaning of the subgroups are based on the two treatment categories
used to fit the quint
object.
1 2 |
object |
an object of the class “quint”. |
newdata |
a data frame with data on new subjects for whom predictions should be made. The data frame should contain at least the variables used in the splits of the fitted tree. It is not necessary to include the treatment variable. |
type |
character string denoting the type of predicted object to be returned. The default is
set to |
... |
optional additional arguments. |
One of the following objects is returned depending on output type specified in the function:
If type="class"
:
vector of predicted treatment classes for every individual in the data set. Returns NA
for subjects with missing values on one or more of the splitting variables.
If type="matrix"
:
a matrix with predicted locations of subjects within the fitted tree. The leaf numbers are
in the first column and the corresponding node numbers in the second column. Returns NA
for subjects with missing values on one or more of the splitting variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 | data(bcrp)
formula1<- I(cesdt1-cesdt3)~cond | nationality+marital+wcht1+age+
trext+comorbid+disopt1+uncomt1+negsoct1
set.seed(10)
control1<-quint.control(maxl=5,B=2)
quint1<-quint(formula1, data= subset(bcrp,cond<3),control=control1) #Grow a QUINT tree
prquint1<-prune(quint1) #Prune QUINT tree to optimal size
#Predict for the same data set the treatment classes for patients individually:
predquint1<-predict(prquint1, newdata=subset(bcrp,cond<3), type='class')
predquint1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.