[R] variance explained by each term in a GAM

Julian M Burgos jmburgos at u.washington.edu
Tue Oct 9 02:20:21 CEST 2007

Hello fellow R's,

I do apologize if this is a basic question.  I'm doing some GAMs using the mgcv
package, and I am wondering what is the most appropriate way to determine how
much of the variability in the dependent variable is explained by each term in
the model.  The information provided by summary.gam() relates to the
significance of each term (F, p-value) and to the "wiggliness" of the fitted
smooth (edf), but (as  far as I understand) there is no information on the
proportion of variance explained.

One alternative may be to fit alternative models without each term, and
calculate the reduction in deviance.  For example:

m1=gam(y~s(x1) + s(x2)) # Full model

ddev1=deviance(m1)-deviance(m2) ddev2=deviance(m1)-deviance(m3)

Here, ddev1 would measure the relative proportion of the variability in y
explained by x1, and ddev2 would do the same for x2.  Does this sound like an
appropriate approach?


Julian Burgos
FAR lab
University of Washington

More information about the R-help mailing list