Backfitting algorithm

From HandWiki
Short description: Iterative procedure

In statistics, the backfitting algorithm is a simple iterative procedure used to fit a generalized additive model. It was introduced in 1985 by Leo Breiman and Jerome Friedman along with generalized additive models. In most cases, the backfitting algorithm is equivalent to the Gauss–Seidel method, an algorithm used for solving a certain linear system of equations.

Algorithm

Additive models are a class of non-parametric regression models of the form:

[math]\displaystyle{ Y_i = \alpha + \sum_{j=1}^p f_j(X_{ij}) + \epsilon_i }[/math]

where each [math]\displaystyle{ X_1, X_2, \ldots, X_p }[/math] is a variable in our [math]\displaystyle{ p }[/math]-dimensional predictor [math]\displaystyle{ X }[/math], and [math]\displaystyle{ Y }[/math] is our outcome variable. [math]\displaystyle{ \epsilon }[/math] represents our inherent error, which is assumed to have mean zero. The [math]\displaystyle{ f_j }[/math] represent unspecified smooth functions of a single [math]\displaystyle{ X_j }[/math]. Given the flexibility in the [math]\displaystyle{ f_j }[/math], we typically do not have a unique solution: [math]\displaystyle{ \alpha }[/math] is left unidentifiable as one can add any constants to any of the [math]\displaystyle{ f_j }[/math] and subtract this value from [math]\displaystyle{ \alpha }[/math]. It is common to rectify this by constraining

[math]\displaystyle{ \sum_{i = 1}^N f_j(X_{ij}) = 0 }[/math] for all [math]\displaystyle{ j }[/math]

leaving

[math]\displaystyle{ \alpha = 1/N \sum_{i = 1}^N y_i }[/math]

necessarily.

The backfitting algorithm is then:

   Initialize [math]\displaystyle{ \hat{\alpha} = 1/N \sum_{i = 1}^N y_i, \hat{f_j} \equiv 0 }[/math],[math]\displaystyle{  \forall j }[/math]
   Do until [math]\displaystyle{ \hat{f_j} }[/math] converge:
       For each predictor j:
           (a) [math]\displaystyle{  \hat{f_j} \leftarrow \text{Smooth}[\lbrace y_i - \hat{\alpha} - \sum_{k \neq j} \hat{f_k}(x_{ik}) \rbrace_1^N ] }[/math] (backfitting step)
           (b) [math]\displaystyle{  \hat{f_j} \leftarrow \hat{f_j} - 1/N \sum_{i=1}^N \hat{f_j}(x_{ij}) }[/math] (mean centering of estimated function)

where [math]\displaystyle{ \text{Smooth} }[/math] is our smoothing operator. This is typically chosen to be a cubic spline smoother but can be any other appropriate fitting operation, such as:

  • local polynomial regression
  • kernel smoothing methods
  • more complex operators, such as surface smoothers for second and higher-order interactions

In theory, step (b) in the algorithm is not needed as the function estimates are constrained to sum to zero. However, due to numerical issues this might become a problem in practice.[1]

Motivation

If we consider the problem of minimizing the expected squared error:

[math]\displaystyle{ \min E[Y - (\alpha + \sum_{j=1}^p f_j(X_j))]^2 }[/math]

There exists a unique solution by the theory of projections given by:

[math]\displaystyle{ f_i(X_i) = E[Y - (\alpha + \sum_{j \neq i}^p f_j(X_j)) | X_i] }[/math]

for i = 1, 2, ..., p.

This gives the matrix interpretation:

[math]\displaystyle{ \begin{pmatrix} I & P_1 & \cdots & P_1 \\ P_2 & I & \cdots & P_2 \\ \vdots & & \ddots & \vdots \\ P_p & \cdots & P_p & I \end{pmatrix} \begin{pmatrix} f_1(X_1)\\ f_2(X_2)\\ \vdots \\ f_p(X_p) \end{pmatrix} = \begin{pmatrix} P_1 Y\\ P_2 Y\\ \vdots \\ P_p Y \end{pmatrix} }[/math]

where [math]\displaystyle{ P_i(\cdot) = E(\cdot|X_i) }[/math]. In this context we can imagine a smoother matrix, [math]\displaystyle{ S_i }[/math], which approximates our [math]\displaystyle{ P_i }[/math] and gives an estimate, [math]\displaystyle{ S_i Y }[/math], of [math]\displaystyle{ E(Y|X) }[/math]

[math]\displaystyle{ \begin{pmatrix} I & S_1 & \cdots & S_1 \\ S_2 & I & \cdots & S_2 \\ \vdots & & \ddots & \vdots \\ S_p & \cdots & S_p & I \end{pmatrix} \begin{pmatrix} f_1\\ f_2\\ \vdots \\ f_p \end{pmatrix} = \begin{pmatrix} S_1 Y\\ S_2 Y\\ \vdots \\ S_p Y \end{pmatrix} }[/math]

or in abbreviated form

[math]\displaystyle{ \hat{S}f = QY \, }[/math]

An exact solution of this is infeasible to calculate for large np, so the iterative technique of backfitting is used. We take initial guesses [math]\displaystyle{ f_j^{(0)} }[/math] and update each [math]\displaystyle{ f_j^{(\ell)} }[/math] in turn to be the smoothed fit for the residuals of all the others:

[math]\displaystyle{ \hat{f_j}^{(\ell)} \leftarrow \text{Smooth}[\lbrace y_i - \hat{\alpha} - \sum_{k \neq j} \hat{f_k}(x_{ik}) \rbrace_1^N ] }[/math]

Looking at the abbreviated form it is easy to see the backfitting algorithm as equivalent to the Gauss–Seidel method for linear smoothing operators S.

Explicit derivation for two dimensions

Following,[2] we can formulate the backfitting algorithm explicitly for the two dimensional case. We have:

[math]\displaystyle{ f_1 = S_1(Y-f_2), f_2 = S_2(Y-f_1) }[/math]

If we denote [math]\displaystyle{ \hat{f}_1^{(i)} }[/math] as the estimate of [math]\displaystyle{ f_1 }[/math] in the ith updating step, the backfitting steps are

[math]\displaystyle{ \hat{f}_1^{(i)} = S_1[Y - \hat{f}_2^{(i-1)}], \hat{f}_2^{(i)} = S_2[Y - \hat{f}_1^{(i)}] }[/math]

By induction we get

[math]\displaystyle{ \hat{f}_1^{(i)} = Y - \sum_{\alpha = 0}^{i-1}(S_1 S_2)^\alpha(I-S_1)Y - (S_1 S_2)^{i -1} S_1\hat{f}_2^{(0)} }[/math]

and

[math]\displaystyle{ \hat{f}_2^{(i)} = S_2 \sum_{\alpha = 0}^{i-1}(S_1 S_2)^\alpha(I-S_1)Y + S_2(S_1 S_2)^{i -1} S_1\hat{f}_2^{(0)} }[/math]

If we set [math]\displaystyle{ \hat{f}_2^{(0)}= 0 }[/math] then we get

[math]\displaystyle{ \hat{f}_1^{(i)} = Y - S_2^{-1} \hat{f}_2^{(i)} = [I - \sum_{\alpha = 0}^{i-1}(S_1 S_2)^\alpha(I-S_1)]Y }[/math]
[math]\displaystyle{ \hat{f}_2^{(i)} = [S_2 \sum_{\alpha = 0}^{i-1}(S_1 S_2)^\alpha(I-S_1)]Y }[/math]

Where we have solved for [math]\displaystyle{ \hat{f}_1^{(i)} }[/math] by directly plugging out from [math]\displaystyle{ f_2 = S_2(Y-f_1) }[/math].

We have convergence if [math]\displaystyle{ \|S_1 S_2\| \lt 1 }[/math]. In this case, letting [math]\displaystyle{ \hat{f}_1^{(i)}, \hat{f}_2^{(i)} \xrightarrow{} \hat{f}_1^{(\infty)}, \hat{f}_2^{(\infty)} }[/math]:

[math]\displaystyle{ \hat{f}_1^{(\infty)} = Y - S_2^{-1} \hat{f}_2^{( \infty)} = Y - (I - S_1 S_2)^{-1} (I - S_1) Y }[/math]
[math]\displaystyle{ \hat{f}_2^{(\infty)} = S_2 (I - S_1 S_2)^{-1} (I - S_1) Y }[/math]

We can check this is a solution to the problem, i.e. that [math]\displaystyle{ \hat{f}_1^{(i)} }[/math] and [math]\displaystyle{ \hat{f}_2^{(i)} }[/math] converge to [math]\displaystyle{ f_1 }[/math] and [math]\displaystyle{ f_2 }[/math] correspondingly, by plugging these expressions into the original equations.

Issues

The choice of when to stop the algorithm is arbitrary and it is hard to know a priori how long reaching a specific convergence threshold will take. Also, the final model depends on the order in which the predictor variables [math]\displaystyle{ X_i }[/math] are fit.

As well, the solution found by the backfitting procedure is non-unique. If [math]\displaystyle{ b }[/math] is a vector such that [math]\displaystyle{ \hat{S}b = 0 }[/math] from above, then if [math]\displaystyle{ \hat{f} }[/math] is a solution then so is [math]\displaystyle{ \hat{f} + \alpha b }[/math] is also a solution for any [math]\displaystyle{ \alpha \in \mathbb{R} }[/math]. A modification of the backfitting algorithm involving projections onto the eigenspace of S can remedy this problem.

Modified algorithm

We can modify the backfitting algorithm to make it easier to provide a unique solution. Let [math]\displaystyle{ \mathcal{V}_1(S_i) }[/math] be the space spanned by all the eigenvectors of Si that correspond to eigenvalue 1. Then any b satisfying [math]\displaystyle{ \hat{S}b = 0 }[/math] has [math]\displaystyle{ b_i \in \mathcal{V}_1(S_i) \forall i=1,\dots,p }[/math] and [math]\displaystyle{ \sum_{i=1}^p b_i = 0. }[/math] Now if we take [math]\displaystyle{ A }[/math] to be a matrix that projects orthogonally onto [math]\displaystyle{ \mathcal{V}_1(S_1) + \dots + \mathcal{V}_1(S_p) }[/math], we get the following modified backfitting algorithm:

   Initialize [math]\displaystyle{ \hat{\alpha} = 1/N \sum_1^N y_i, \hat{f_j} \equiv 0 }[/math],[math]\displaystyle{  \forall i, j }[/math], [math]\displaystyle{ \hat{f_+} = \alpha + \hat{f_1} + \dots + \hat{f_p}  }[/math]
   Do until [math]\displaystyle{ \hat{f_j} }[/math] converge:
       Regress [math]\displaystyle{  y - \hat{f_+}  }[/math] onto the space [math]\displaystyle{  \mathcal{V}_1(S_i) + \dots + \mathcal{V}_1(S_p)  }[/math], setting [math]\displaystyle{  a = A(Y- \hat{f_+}) }[/math]
       For each predictor j:
           Apply backfitting update to [math]\displaystyle{ (Y - a) }[/math] using the smoothing operator [math]\displaystyle{ (I - A_i)S_i }[/math], yielding new estimates for [math]\displaystyle{ \hat{f_j} }[/math]


References

  1. Hastie, Trevor, Robert Tibshirani and Jerome Friedman (2001). The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer, ISBN:0-387-95284-5.
  2. Härdle, Wolfgang; et al. (June 9, 2004). "Backfitting". Archived from the original on 2015-05-10. Retrieved 2015-08-19.

External links