I was trying to implement manually the estimation of nonparametric regression using local-linear approximation with a mixture of discrete and continuous data. consider a simple model: $y=f(xc,xd)$ where xc is continuous and xd is discrete

Say that I want to estimate this model non parametrically. Which one of the two following regressions is the correct one (assuming local linear estimation.

1: $$y=a0+a1*(xc-c)+e$$ 2: $$y=a0+a1*(xc-c)+a2*xd +e$$

Assume that both models are estimated using the correct kernel weights and that xd is a dummy.

I thought the correct model was (1), but npregress in Stata uses (2). Which one would be the correct one?

Thank you

EDIT: Perhaps a different way to ask the same question. Say that you have a 3 variables, y, xc (continuous) and xd (discrete), and that you want to estimate a nonparametric, using local linear kernel estimation, for: $$y=f(xc,xd)$$ Empirically, how would you estimate this model using WLS? which one is the correct specification? equation 1 or equation 2 (assuming weights are appropriately obtained)

  • $\begingroup$ What is c? Why does first model not include xd? $\endgroup$ – Dimitriy V. Masterov Jan 29 at 19:46
  • $\begingroup$ c in this case would be the point of reference, for instance, say that im tring to estimate this local model for the point xc=c and xd = d $\endgroup$ – Fcold Jan 29 at 20:04
  • $\begingroup$ and for the first model, the effect of the dummy would come from using local weights. (li-racine kernel for discrete data). However, in the second, the effect is trhough the kernel weights, and the dummy, which seems incorrect. $\endgroup$ – Fcold Jan 29 at 20:06
  • $\begingroup$ The second model seems obviously better to me. You want a nonparametric estimate of $E[Y \vert X, D]$. How can the first model ever give you that? $\endgroup$ – Dimitriy V. Masterov Jan 29 at 22:55
  • $\begingroup$ That's what I would have thought too, but when only discrete variables are used, the function E(Y|D) is estimated using kernel weights only. $$E(Y|D=d) = \sum{y*K(d)} $$ $\endgroup$ – Fcold Jan 30 at 16:16

Alright, So it took some time to find an official answer for this question. Or at least as official as possible, given my current access to bibliographic material.

So, based on Henderson and Parmeter (2015) section 8.1.2. the correct specification for a nonparametric regression with mixed data is derived as follows:

  1. Assume you are interested in estimating a nonparametric function for $y_i =m(x_i^c,x_i^d)+e_i$, where $x^c$ is continuous and $x^d$ is discrete.

  2. If the interest falls on using a Local linear estimator, one needs to obtain a taylor expansion to this function which is: $$y_i\approx m(x)+\beta(x)(x^c_i-x_c) + e_i$$ Henderson and Parmeter (2015) indicate that for the LL estimator, one cannot obtain derivatives for discrete variables, so x_d does not appear in the specification directly.

  3. The coefficients $\delta(x) = (m(x), \beta(x)) $ can be estimated as the solution to:

$$min_{\delta(x)} = \sum { [(y-m(x)-\beta(x)(x_i-x_c) )^2]*W(X)} $$

where $W(X)$ is the kernel weight: $$W(X) = K_h(x_i^c,x^c) * L_h (x_i^d,x^d)$$

In other words, the Discrete variables enter the regression only through the kernel weights.


Henderson, Daniel J., and Christopher F. Parmeter. Applied nonparametric econometrics. Cambridge University Press, 2015.

  • $\begingroup$ Thank you for adding the Reference @Dave $\endgroup$ – Fcold Feb 3 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.