Tutorials › Statistical Learning (Graduate) › Local Constant Regression and Its Interior Bias

Local Polynomial Estimation · Tutorial 423 of 989

Local Constant Regression and Its Interior Bias

See how a local constant fit produces the Nadaraya–Watson estimator and why its leading interior bias depends on both the regression curve and the design density.

Intermediate 11 min read

What You'll Learn

  • Derive the Nadaraya–Watson formula by minimizing a kernel-weighted degree-zero least-squares criterion.
  • Distinguish the finite-sample estimator from its population smoothing target.
  • State the conditions for the leading interior bias expansion.
  • Identify the contribution of the design density through its logarithmic derivative.
  • Calculate bias terms and recognize when their leading contributions cancel.

From a Local Fit to a Regression Estimate

In nonparametric regression, the estimate at a point \(x\) is built from observations near \(x\), with nearby observations receiving more weight. A local constant fit makes the simplest possible local approximation: near \(x\), represent the regression function by a single number \(a\). Choosing that number by weighted least squares gives the Nadaraya–Watson estimator.

The fitted value is not generally centered on the true regression function \(m(x)=E[Y\mid X=x]\). Even away from boundaries, its leading smoothing bias depends on how curved \(m\) is and on how the design points are distributed nearby. The density contribution matters because local weighting averages responses over the observed design points, not over an evenly spaced grid.

Definition: Given observations \((X_i,Y_i)\), a kernel \(K\), and bandwidth \(h>0\), the local constant estimate at \(x\) minimizes the weighted sum of squared residuals over constants \(a\). When the sum of the weights is positive, the resulting fitted value is the Nadaraya–Watson estimator.

The Degree-Zero Fit and Its Formula

Write \(K_h(t)=K(t/h)/h\). The local constant criterion is

$$ Q_x(a)=\sum_{i=1}^n K_h(X_i-x)(Y_i-a)^2. $$

Here \(a\) is the only coefficient: the local approximation has degree zero. The bandwidth determines the scale of the neighborhood, while the kernel determines how weights vary within it. Multiplying all weights by the same positive constant does not change the minimizer.

Result: If \(\sum_{i=1}^n K_h(X_i-x)>0\), the unique minimizer of \(Q_x(a)\) is
$$ \hat m_{\mathrm{NW}}(x) = \frac{\sum_{i=1}^n K_h(X_i-x)Y_i} {\sum_{i=1}^n K_h(X_i-x)} = \frac{\sum_{i=1}^n K\bigl((X_i-x)/h\bigr)Y_i} {\sum_{i=1}^n K\bigl((X_i-x)/h\bigr)}. $$

To verify the result, differentiate the criterion with respect to \(a\):

$$ Q_x'(a)=-2\sum_{i=1}^n K_h(X_i-x)(Y_i-a), \qquad Q_x''(a)=2\sum_{i=1}^n K_h(X_i-x). $$

When the weights are nonnegative and their sum is positive, \(Q_x''(a)>0\), so the criterion is strictly convex. Setting \(Q_x'(a)=0\) gives \(a\sum_i K_h(X_i-x)=\sum_i K_h(X_i-x)Y_i\), which yields the stated minimizer. The common factor \(1/h\) cancels from numerator and denominator. \(\square\)

If all weights vanish, the criterion is constant in \(a\) and does not define a fitted value. In practice one reports the estimate only where the denominator is positive. The usual setting assumes a nonnegative kernel, so the fitted value is a weighted average of the responses with positive weights.

Worked Example: Calculating a Local Constant Fit

Suppose three observations are \((-0.5,1)\), \((0,2)\), and \((0.5,4)\). Estimate the regression function at \(x=0\) using \(h=1\) and the triangular kernel \(K(u)=1-|u|\) for \(|u|\leq 1\), with \(K(u)=0\) otherwise.

The scaled locations are \((X_i-x)/h=-0.5,0,0.5\). Their kernel weights are \(0.5,1,0.5\), respectively. Thus the denominator is \(0.5+1+0.5=2\), and the numerator is \(0.5(1)+1(2)+0.5(4)=4.5\). Therefore

$$ \hat m_{\mathrm{NW}}(0)=\frac{4.5}{2}=2.25. $$

This is the weighted average of the three responses, with the central observation receiving twice the weight of either outer observation.

The Interior Bias Expansion

To describe the leading smoothing bias, first consider the population version of the weighted average. Let \(X\) have density \(f\), let \(m(t)=E[Y\mid X=t]\), and suppose \(f(x)>0\). For a random observation, the conditional mean response at design value \(t\) is \(m(t)\). The population smoother at \(x\) is therefore

$$ m_h(x)= \frac{E\!\left[K\bigl((X-x)/h\bigr)Y\right]} {E\!\left[K\bigl((X-x)/h\bigr)\right]} = \frac{\int K\bigl((t-x)/h\bigr)m(t)f(t)\,dt} {\int K\bigl((t-x)/h\bigr)f(t)\,dt}. $$

This ratio is the population target of the local constant weighted average. Its difference from \(m(x)\) is the smoothing bias. It is not, for finite \(n\), exactly the expectation of the sample ratio \(\hat m_{\mathrm{NW}}(x)\): taking the expectation of a ratio is not the same as taking the ratio of expectations.

Theorem: Suppose \(x\) is an interior point of the support of \(X\); \(m\) and \(f\) are twice continuously differentiable in a neighborhood of \(x\); and \(f(x)>0\). Suppose \(K\) is symmetric, has compact support, satisfies \(\int K(u)\,du=1\), and has finite second moment \(\mu_2(K)=\int u^2K(u)\,du\). Then, as \(h\to0\),
$$ m_h(x)-m(x) = \frac{h^2\mu_2(K)}{2} \left[ m''(x)+2m'(x)\frac{f'(x)}{f(x)} \right] +o(h^2). $$

The compact support and interior-point condition ensure that, for sufficiently small \(h\), the kernel neighborhood stays within the region where the stated smoothness conditions hold. Symmetry gives \(\int uK(u)\,du=0\); normalization and the second moment determine the remaining terms of this order.

For a proof, substitute \(t=x+hu\) in the numerator and denominator, cancelling the common factor \(h\). Define \(q(t)=m(t)f(t)\). Taylor expansion at \(x\), with the continuous second derivatives giving remainders uniform over the bounded support of \(K\), gives

$$ \begin{aligned} \int K(u)q(x+hu)\,du &=q(x)+\frac{h^2\mu_2(K)}{2}q''(x)+o(h^2),\\ \int K(u)f(x+hu)\,du &=f(x)+\frac{h^2\mu_2(K)}{2}f''(x)+o(h^2). \end{aligned} $$

The first-order terms vanish because the kernel is symmetric. Since \(f(x)>0\), divide the expansions using \(1/(f(x)+\delta)=1/f(x)-\delta/f(x)^2+o(\delta)\) as \(\delta\to0\). This yields

$$ m_h(x) = \frac{q(x)}{f(x)} +\frac{h^2\mu_2(K)}{2} \left[ \frac{q''(x)}{f(x)} -\frac{q(x)f''(x)}{f(x)^2} \right]+o(h^2). $$

Now \(q(x)/f(x)=m(x)\), and differentiating \(q=mf\) gives \(q''=m''f+2m'f'+mf''\). Substituting and cancelling the terms involving \(mf''\) leaves \(m''+2m'f'/f\), proving the expansion. \(\square\)

The first part of the bracket, \(m''(x)\), is the contribution from curvature in the regression function. The second part, \(2m'(x)f'(x)/f(x)\), records how the design density changes across the local neighborhood. It vanishes when the density is locally flat or the regression function has zero slope at \(x\). This is an interior expansion; near a boundary, the effective kernel neighborhood need not be symmetric, so the argument and leading terms can change.

Worked Bias Calculations

Worked Example: Uniform Design and a Curved Regression Function

Let \(m(t)=t^2\) and suppose the design density is constant near \(x=1\). Use the normalized Epanechnikov kernel \(K(u)=\tfrac34(1-u^2)\) on \([-1,1]\), zero outside. Its second moment is

$$ \mu_2(K)=\frac34\int_{-1}^1(u^2-u^4)\,du =\frac34\left(\frac23-\frac25\right)=\frac15. $$

At \(x=1\), \(m'(1)=2\), \(m''(1)=2\), and \(f'(1)/f(1)=0\). The leading bias is consequently

$$ m_h(1)-m(1) = \frac{h^2}{2}\cdot\frac15\cdot 2+o(h^2) =\frac{h^2}{5}+o(h^2). $$

The density contributes nothing in this example. The positive leading term comes from the curvature of the quadratic regression function.

Worked Example: A Nonuniform Design Adds Bias

Let \(m(t)=2+t\), so \(m'(0)=1\) and \(m''(0)=0\). Suppose near \(x=0\) the design density is proportional to \(\exp(t/2)\), giving \(f'(0)/f(0)=1/2\). With the same Epanechnikov kernel, \(\mu_2(K)=1/5\). The leading bias at zero is

$$ \frac{h^2}{2}\cdot\frac15 \left[0+2(1)\left(\frac12\right)\right] =\frac{h^2}{10}. $$

Although the regression function is exactly linear, the local constant smoother has a nonzero leading bias here. The design places relatively more weight on observations to the right of zero, where the regression function is larger. This example isolates the density contribution.

Worked Example: Curvature and Density Contributions Cancel

Let \(m(t)=t^2\) and evaluate at \(x=1\), so \(m'(1)=2\) and \(m''(1)=2\). Suppose the density is locally proportional to \(\exp(-(t-1)/2)\), so \(f'(1)/f(1)=-1/2\). The bracket in the bias formula is

$$ m''(1)+2m'(1)\frac{f'(1)}{f(1)} =2+2(2)\left(-\frac12\right)=0. $$

Thus the coefficient of \(h^2\) is zero, and the expansion says \(m_h(1)-m(1)=o(h^2)\). This does not establish that the bias is exactly zero for a nonzero bandwidth; it says only that the two leading contributions cancel.

Interpretation and a Common Pitfall

The formula shows why a local constant estimate can respond to the design even when the target \(m\) itself is unchanged: observations in denser parts of the neighborhood contribute more to the weighted average. A calculation that retains only \(m''(x)\) is valid only when the density term vanishes, for example when \(f'(x)=0\) or \(m'(x)=0\) at the point of interest. The logarithmic derivative \(f'(x)/f(x)\) describes the local relative change in density, so it is the relevant quantity rather than \(f'(x)\) alone.

  • Wrong reasoning: “The kernel is symmetric, so the local average has no first-order effect and its leading bias is just the curvature term.”
  • Correction: Kernel symmetry removes the first kernel moment, but it does not make the design density locally constant. Expanding both the numerator and denominator of the population ratio produces the additional term \(2m'(x)f'(x)/f(x)\).

A second distinction is also important: the derived expression is the leading bias of the population smoothing target. The sample estimator is a ratio with a random denominator, so its finite-sample expectation does not equal that target exactly. In applications, the displayed expansion describes the leading smoothing component; sampling variability and finite-sample ratio effects are separate considerations.

Key takeaway: A degree-zero kernel-weighted least-squares fit is the Nadaraya–Watson weighted average. At an interior point, its leading population smoothing bias depends on both regression curvature and the local slope of the design density.

Check Your Understanding

Use the definitions and bias expansion to answer the following questions.

  1. What condition on the observed kernel weights ensures that the local constant criterion has a unique minimizer?
  2. For what reason can the expectation of the finite-sample Nadaraya–Watson estimator differ from the population smoother \(m_h(x)\)?
  3. If \(m'(x)=0\), which part of the leading interior bias remains?
  4. Suppose \(m''(x)=0\), \(m'(x)\ne0\), and \(f'(x)\ne0\). Does the leading bias necessarily vanish? Explain using the expansion.
  5. In the cancellation example, what does a zero coefficient of \(h^2\) establish, and what does it not establish?
Clinical Biostats