Learn R Programming

TSVC (version 1.7.2)

predict.TSVC: Prediction from Varying Coefficient Trees

Description

Obtains predictions from a fitted TSVC object.

Usage

# S3 method for TSVC
predict(object, X_new = NULL, ...)

Arguments

object

a fitted object of class TSVC.

X_new

optionally, data frame of class data.frame which contains the variables with which to predict. If NULL, the fitted linear predictors are use.

...

further arguments passed to predict.glm.

Author

Moritz Berger <moritz.berger@imbie.uni-bonn.de>
https://www.imbie.uni-bonn.de/people/dr-moritz-berger/

Details

predict.TSVC is a wrapper function of predict.glm, which obtains predictions for objects of class glm. Further arguments can be passed to predict.glm via the '...'-argument.

References

Berger, M., G. Tutz and M. Schmid (2019). Tree-Structured Modelling of Varying Coefficients. Statistics and Computing 29, 217-229, https://doi.org/10.1007/s11222-018-9804-8.

See Also

TSVC, plot.TSVC, summary.TSVC

Examples

Run this code
# Swiss Labour Market 
library(AER)
data("SwissLabor")

# recode factors
sl <- SwissLabor
sl$participation <- as.numeric(sl$participation)-1
sl$foreign       <- as.numeric(sl$foreign)-1

X_new <- data.frame("income"=c(10,12), "age"=c(4.5,5.8))

if (FALSE) {
fit1 <- TSVC(participation~income+age, data=sl, family=binomial(link="logit"), 
             nperm=1000, trace=TRUE)
predict(fit1, X_new, type="response")
}


Run the code above in your browser using DataLab