Use the optimal order of power series of covariates to predict outcome. The optimal order of power series is determined by cross-validation.
npse(formula, order =3, m =10, seed =NULL)
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.
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.
Returns
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.
seed: The random seed.
References
Abadie, Alberto. 2003. "Semiparametric Instrumental Variable Estimation of Treatment Response Models." Journal of Econometrics 113: 231-263.
Author(s)
Weihua An, Departments of Sociology and Statistics, Indiana University Bloomington, weihuaan@indiana.edu .
Xuefu Wang, Department of Statistics, Indiana University Bloomington, wangxuef@umail.iu.edu .
See Also
larf, larf.fit
Examples
data(c401k)attach(c401k)## Not run:# binary outcomeZ <- c401k$e401k
# covariatesX <- as.matrix(c401k[,c("inc","male","fsize")])# get nonparametric power series estimation of the regression of Z on Xzp <- npse(Z~X, order =5, m =10, seed =681)# sum of residual squares of the cross-validationszp$CV.Res
# the opitimal order of the power serieszp$Lambda
# summary of the predictions based on the optimal power seriessummary(zp$fitted)## End(Not run)