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

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

Syntax margintegrate yvar xvar1 xvar2 [if] [in] , bw(numlist) [options]

Description margintegrate estimates a non-parametric regression of yvar on xvar1 and xvar2, treating the expectation of yvar|xvar1 as 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 Argument bw(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.

Options n(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 requires n x n regression smoothes to get predicted values, so n(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. If boot is 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 data integer number of times.

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

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

Examples 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.

. 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.