ArticleslgStudy

computer science

Backfitting algorithm

Backfitting algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Backfitting algorithm rather than just read about it. In short: 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.

Key takeaways

  • Backfitting algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Backfitting algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Backfitting algorithm from memory before moving on to harder problems.

Reference excerpt

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:

Yi=α+∑j=1pfj(Xij)+ϵi where each X1,X2,…,Xp is a variable in our p-dimensional predictor X, and Y is our outcome variable. ϵ represents our inherent error, which is assumed to have mean zero. The fj represent unspecified smooth functions of a single Xj. Given the flexibility in the fj, we typically do not have a unique solution: α is left unidentifiable as one can add any constants to any of the fj and subtract this value from α. It is common to rectify this by constraining

∑i=1Nfj(Xij)=0 for all j leaving

α=1/N∑i=1Nyi necessarily. The backfitting algorithm is then:

Initialize α̂=1/N∑i=1Nyi,fĵ≡0,∀j Do until fĵ converge: For each predictor j: (a) fĵ←Smooth[{yi−α̂−∑k≠jfk̂(xik)}1N] (backfitting step) (b) fĵ←fĵ−1/N∑i=1Nfĵ(xij) (mean centering of estimated function)

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

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

minα,fj 𝔼[(Y−α−∑j=1pfj(Xj))2] There exists a unique solution by the theory of projections given by:

fi(Xi)=𝔼[Y−α−∑j≠ipfj(Xj)∣Xi] for i = 1, 2, ..., p. This gives the matrix interpretation:

(IP1⋯P1P2I⋯P2⋮⋱⋮Pp⋯PpI)(f1(X1)f2(X2)⋮fp(Xp))=(P1YP2Y⋮PpY) where Pi(⋅)=𝔼(⋅|Xi). In this context we can imagine a smoother matrix, Si, which approximates our Pi and gives an estimate, SiY, of 𝔼(Y|X)

(IS1⋯S1S2I⋯S2⋮⋱⋮Sp⋯SpI)(f1f2⋮fp)=(S1YS2Y⋮SpY) or in abbreviated form

Ŝf=QY An exact solution of this is infeasible to calculate for large np, so the iterative technique of backfitting is used. We take initial guesses fj(0) and update each fj(ℓ) in turn to be the smoothed fit for the residuals of all the others:

fĵ(ℓ)←Smooth[{yi−α̂−∑k≠jfk̂(xik)}1N] 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, we can formulate the backfitting algorithm explicitly for the two dimensional case. We have:

f1=S1(Y−f2),f2=S2(Y−f1) If we denote f̂1(i) as the estimate of f1 in the ith updating step, the backfitting steps are

f̂1(i)=S1[Y−f̂2(i−1)],f̂2(i)=S2[Y−f̂1(i)] By induction we get

f̂1(i)=Y−∑α=0i−1(S1S2)α(I−S1)Y−(S1S2)i−1S1f̂2(0) and

f̂2(i)=S2∑α=0i−1(S1S2)α(I−S1)Y+S2(S1S2)i−1S1f̂2(0) If we set f̂2(0)=0 then we get

f̂1(i)=Y−S2−1f̂2(i)=[I−∑α=0i−1(S1S2)α(I−S1)]Y f̂2(i)=[S2∑α=0i−1(S1S2)α(I−S1)]Y Where we have solved for f̂1(i) by directly plugging out from f2=S2(Y−f1). We have convergence if ‖S1S2‖<1. In this case, letting f̂1(i),f̂2(i)→f̂1(∞),f̂2(∞):

f̂1(∞)=Y−S2−1f̂2(∞)=Y−(I−S1S2)−1(I−S1)Y f̂2(∞)=S2(I−S1S2)−1(I−S1)Y We can check this is a solution to the problem, i.e. that f̂1(i) and f̂2(i) converge to f1 and f2 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 Xi are fit. As well, the solution found by the backfitting procedure is non-unique. If b is a vector such that Ŝb=0 from above, then if f̂ is a solution then so is f̂+αb is also a solution for any α∈ℝ. 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 𝒱1(Si) be the space spanned by all the eigenvectors of Si that correspond to eigenvalue 1. Then any b satisfying Ŝb=0 has bi∈𝒱1(Si)∀i=1,…,p and ∑i=1pbi=0. Now if we take A to be a matrix that projects orthogonally onto 𝒱1(S1)+⋯+𝒱1(Sp), we get the following modified backfitting algorithm:

Initialize α̂=1/N∑1Nyi,fĵ≡0,∀i,j, f+̂=α+f1̂+⋯+fp̂ Do until fĵ converge: Regress y−f+̂ onto the space 𝒱1(Si)+⋯+𝒱1(Sp), setting a=A(Y−f+̂) For each predictor j: Apply backfitting update to (Y−a) using the smoothing operator (I−Ai)Si, yielding new estimates for fĵ

References

Breiman, L. & Friedman, J. H. (1985). "Estimating optimal transformations for multiple regression and correlations (with discussion)". Journal of the American Statistical Association. 80 (391): 580–619. doi:10.2307/2288473. JSTOR 2288473. Hastie, T. J. & Tibshirani, R. J. (1990). "Generalized Additive Models". Monographs on Statistics and Applied Probability. 43. Härdle, Wolfgang; et al. (June 9, 2004). "Backfitting". Archived from the original on 2015-05-10. Retrieved 2015-08-19.

External links R Package for GAM backfitting[link removed] R Package for BRUTO backfitting

Worked examples

Example 1 — a first encounter with Backfitting algorithm

Start with the simplest possible case. Write down what Backfitting algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Backfitting algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Backfitting algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Backfitting algorithm

In research
Backfitting algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Backfitting algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Backfitting algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Generalized linear models, Numerical linear algebra, so understanding it makes those chapters shorter.
In everyday life
Look for Backfitting algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Backfitting algorithm” →

How to study Backfitting algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Backfitting algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Backfitting algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Backfitting algorithm in simple terms?

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.

Why does Backfitting algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Backfitting algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Backfitting algorithm.

Tags

  • Generalized linear models
  • Numerical linear algebra

Keep exploring