help margintegrate-------------------------------------------------------------------------------

Titlemargintegrate-- Estimate generalized additive non-parametric functions of two dependent variables; output graphical representation ofE(yvar|xvar1).

Syntaxmargintegrateyvar xvar1 xvar2 [if] [in],bw(numlist)[options]

Descriptionmargintegrateestimates a non-parametric regression ofyvaronxvar1andxvar2, treating the expectation ofyvar|xvar1as the quantity of interest. It integrates out the effect of the "nuisance" variable xvar2 by means of marginal integration, following the methods outlined in Linton and Neilsen (1996), Tjostheim and Auestad (1994); see also Li and Racine (2007, 283-289).

Required Argumentbw(numlist)must contain two values, bw_1 and bw_2, the bandwidths for xvar1 and xvar2, respectively. The literature on generalized additive models has suggested using a multiple of the standard deviation as the bandwidth each independent variable of interest (i.e. .7, .9, 1.1 times sd); this solution is not optimal in the mean squared error sense, but visual inspection can provide a good guide to appropriate levels of smoothing.

Optionsn(integer 50)contains the number of points at which the estimation will be executed. The maximum is 800; default is 50. The marginal integration estimator requiresn x nregression smoothes to get predicted values, son(100)estimates 10,000 regression smoothes. Points are chosen according to percentile values of the data sorted by xvar1 and xvar2.

generate(varlist)can contain up to two variable names, the first for the predicted value of the estimator, the second for the pointwise estimate of the variance.

ci(level)shows pointwise confidence intervals at specified level, assuming asymptotic normal distribution of the expected value. Ifbootis not specified, the estimator uses asymptotic variance (see Li and Racine (2007, p.285)) to construct confidence intervals; this expression can be fragile, especially if the support for either of the independent variables is not compact.

boot(integer)estimates confidence intervals by bootstrapping original dataintegernumber of times.

trim(real)specifies that a total ofrealpercent of the data will be trimmed for the purposes of estimation; trimsreal/2percent at top and bottom of the data sorted by xvar1.

nographspecifies no graphical output: predicted values will be calculated and stored ifgenerate(varlist)is specified; use to incorporate your own graph preferences.

Estimate a locally linear regression of y on x1 and x2 and use the asymptotic variance to show 95% confidence intervals. Use 100 points to in the distribution of x1 and x2 to derive estimates.Examples

. margintegrate y x1 x2, bw(4 5) n(100) ci(95)

Estimate a locally linear regression of y on x1 and x2 without producing any graphical output, but using the bootstrap procedure to estimate pointwise variances. Use 100 points to in the distribution of x1 and x2 to derive estimates.