*! version 2.0.0 July 2019 Fernando Rios Avila

Title

vc_predict -- Command used to obtain predictions, Leave-one-out errors, and residuals for the Smooth varying coefficient model.

Syntax

vc_predict
[varlist]
[if] [in]
[, vcoeff(varname) bw(#) options]

Main
vcoeff(varname) Indicates the variable to be used for the estimation of smooth varying coefficients. The default option is to use the stored variable in global $vcoeff_ after using vc_bw or vc_bwalt

bw(#) Used to provide a Bandwidth for the estimation of the varying coefficient model. The default option is to use the stored value in global $opbw_ after using vc_bw or vc_bwalt

kernel(kernel) Indicates which kernel function to be used in the varying coefficient model. The default option is to use the stored value in global $kernel_ after using vc_bw or vc_bwalt

yhat(newvar) Provides the name of a new variable where to save the predicted values

res(newvar) Provides the name of a new variable where to save the predicted residuals

looe(newvar) Provides the name of a new variable where to save the predicted leave-one-out errors

lvrg(newvar) Provides the name of a new variable where to save the predicted leverage points

stest Option that requests specification test against parametric models that use interactions with linear, quadratic and cubic polynomials of the smooth coefficient, based on Hastie and Tibshirani (1990)

knots(#) This option request the estimation of #k bins that will be used for the estimation og the predicted values, and specification tests. The default is to use all distinct values in vcoeff.
Using this option provides gains in speed at a cost of lower precision. When knots(0) is specified, the number of knots is given by min{sqrt(N), 10*ln(N)/ln(10).

km(#) This option is ment to be used in combination with knots(0). When used, it requests to use knots=km* min{sqrt(N), 10*ln(N)/ln(10). Default its km(1)

All kernel functions are allowed.

kernel

gaussian Gaussian kernel function; The default

epan Epanechnikov kernel function

epan2 alternative Epanechnikov kernel function

biweight biweight kernel function

cosine cosine trace kernel function

parzen Parzen kernel function

rectan rectangle kernel function

trian triangle kernel function

Description

vc_predict is a command used obtain the model predictions, LOO errors and leverage for SVCM. The command also reports the R2 for the model, as well
as the average number of kernel observations, and degrees of freedom of the model and residuals.

The number of Kernel observaions is defined as the weighted sum of the standardized kernel weight of all observations used for regressions in a particular point of interest.

The number of degrees of freedom is defined as the sum of the leverage statistics. See Rios-Avila (2019) for details.

Remarks

This command is used to obtained predicted values, predicted errors, Leave-One-Out and leverage error for the varying coefficient model.

The command requires to specify all the variables for the model specification, as if using the commands vc_reg. By default, information about
the kernel, bandwidth and vcoeff are taken from the macros stored by vc_bw and vc_bwalt

The default option is to use all values defined in vcoeff, to obtain the model predictions, however, for an accelerated, but less accurate estimate prediction,
one can use knots() and km() options. This creates an internally used variable with less variation than the original variable, estimate the varying coefficient models.

The command reports two measures of R2. One based on the Sum of squares, and one based on the recommendation in Henderson and Parmeter (2015).

The expected number of Kernel Observations and degrees of freedom of the model and degrees of freedom of the error, are also reported.

The command also reports basic specification tests against a model with polynomial interactions following an approximate F statistic as described in Hastie and Tibshirani(1990).

Because the F-test does not have a known distribution function, one can use vc_test to implement the wildbootstrap J-statistic.

Examples

webuse motorcycle, clear

vc_bw accel, vcoeff(time)
vc_predict accel, vcoeff(time) yhat(accel_hat1)
scatter accel_hat1 time

** DUI dataset
webuse dui, clear
vc_bw citations i.csize college taxes, vcoeff(fines)
vc_predict citations i.csize college taxes, vcoeff(fines) stest

Author

Fernando Rios-Avila

Levy Economics Institute of Bard College

Blithewood-Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

References

Hastie, Trevor, and Robert Tibshirani. 1990. Generalized Additive Models. New York: Chapman and Hall.
Hastie, Trevor, and Robert Tibshirani. 1993. "Varying-Coefficient Models." Journal of the Royal Statistical Society. Series B (Methodological) 55 (4):757-796.
Henderson, Daniel J., and Christopher F. Parmeter. 2015. Applied Nonparametric Econometrics. Cambridge, United Kingdom: Cambridge University Press.
Li, Qi, and Jeffrey Scott Racine. 2007. Nonparametric Eonometrics: Theory and Practice. New Jersey: Princeton University Press.
Li, Qi, and Jeffrey Scott Racine. 2010. "Smooth Varying-Coefficient Estimation and Inference for Qualitative and Quantitative Data." Econometric Theory 26 (6):1607-1637.
Rios-Avila, Fernando (2019) Smooth varying coefficient models in Stata. Working paper. vc_pack paper