Learn R Programming

LARF (version 1.3)

npse: Nonparametric Power Series Estimation

Description

Use the optimal order of power series of covariates to predict outcome. The optimal order of power series is determined by cross-validation.

Usage

npse(formula, order = 3, m = 10, seed = 178)

Arguments

formula
specification of the outcome model in the form like either z ~ x1 + x2 or z ~ X where X is the covariate matrix.
order
the maximal order of power series to be used.
m
the number of folds to be used in cross-validation.
seed
random starting number used to replicate cross-validation.

Value

fitted
Predicted outcomes based on the estimated model. They are probabilities when the outcome is binary.
Lambda
The optimal order of power series determined by cross-validation.
Data.opt
The data including z and the optimal covariates power series.
CV.Res
The residual sum of squares of the cross-validations.

Details

This function predicts the outcome based on the optimal order of covariates power series. The optimal order of the power series is determined by cross-validation. For example, it can be used to predict the probabilty of receiving treatment inducment based on covariates.

References

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

See Also

larf, larf.fit

Examples

Run this code
data(c401k)
attach(c401k)

## Not run: 
# # binary outcome
# Z <- c401k$e401k
# 
# # covariates
# X <- as.matrix(c401k[,c("inc", "male", "fsize"  )])
# 
# # get nonparametric power series estimation of the regression of Z on X
# zp <- npse(Z~X, order = 5, m = 10, seed = 681)
# 
# # sum of residual squares of the cross-validations
# zp$CV.Res
# 
# # the opitimal order of the power series
# zp$Lambda
# 
# # summary of the predictions based on the optimal power series
# summary(zp$fitted)
# ## End(Not run)

Run the code above in your browser using DataLab