Learn R Programming

LARF (version 1.1)

predict.larf: Local Average Response Functions

Description

Predict new outcomes based on a regression fitted by larf.

Usage

## S3 method for class 'larf':
predict(object, newCov, newTreatment, \dots)

Arguments

object
an object of class larf as fitted by larf.
newCov
A matrix containing the new covariates.
newTreatment
A vector containing the new binary treatment variable.
...
currently not used.

Value

  • predicted.valuesThe function returns a vector of the predicted outcomes given the new data.

Details

Predicted outcomes are based on the estimated coefficients and new covariates and/or new treatment variable. The predicted outcomes are probabilities when the outcome is binary.

References

Abadie, Alberto. 2003. "Semiparametric Instrumental Variable Estimation of Treatment Response Models." Journal of Econometric 113: 231-263.

See Also

larf, larf.fit

Examples

Run this code
data(c401k)

# Choose the first 500 units for a small example
c401k <- c401k[1:500,]

Y <- c401k$pira
X <- as.matrix(c401k[c("inc", "incsq", "marr",  "male", "age", "agesq",  "fsize"  )])
D <- c401k$p401k
Z <- c401k$e401k

# high-level interface
est <- larf(Y~X, D, Z)

# make prediction based on new treatment status
D <- sample(D, 500, replace = TRUE)
prediction <- predict(est, cbind(1,X), D)

Run the code above in your browser using DataLab