predict.PSM: Predict method for Partial Splines models

Description Usage Arguments Value Examples

View source: R/predict.PSM.R

Description

Predicted values based on a psm object

Usage

1
2
## S3 method for class 'PSM'
predict(object, x, tx)

Arguments

object

an object of class 'PSM'

x

dataframe containing the values for each linear variable in the model with which to predict

tx

a vector containing the values for the spline variable in the model with which to predict

Value

returns a vector containing predicted values

Examples

1
2
3
4
5
6
7
8
9
x <- data.frame(x = rnorm(100))
tx <- rnorm(100)
eps <- rnorm(100)
y <- x[,1] + tx^4 + eps
psm <- PartialSplines(y, x, tx)
x.new <- data.frame(x = rnorm(5))
tx.new <- rnorm(5)
y.pred <- predict(psm, x.new, tx.new)
y.pred

reealpeppe/PSM documentation built on Dec. 22, 2021, 2:06 p.m.