Re: [R] variance explained by each predictor in GAM

2011-11-08 Thread huidongtian
Dear Prof. Wood, I read your methods of extracting the variance explained by each predictor in different places. My question is: using the method you suggested, the sum of the deviance explained by all terms is not equal to the deviance explained by the full model. Could you tell me what caused

Re: [R] variance explained by each predictor in GAM

2009-07-13 Thread Kayce Anderson
Simon,That produced exactly what I was looking for. Thanks so much for the humble help. KC On Mon, Jul 13, 2009 at 9:10 AM, Simon Wood wrote: > You can get some idea by doing something like the following, which compares > the r^2 for models b and b2, i.e. with and without s(x2). It keeps the

Re: [R] variance explained by each predictor in GAM

2009-07-13 Thread David Winsemius
It appears you are conflating beta coefficients (individual covariate effect measures) with overall model fit measures. Beta coefficients are not directly comparable to R-squared measures in ordinary least squares analyses, so why would they be so in gam models? I cannot tell whether you ac

Re: [R] variance explained by each predictor in GAM

2009-07-13 Thread Simon Wood
You can get some idea by doing something like the following, which compares the r^2 for models b and b2, i.e. with and without s(x2). It keeps the smoothing parameters fixed for the comparison. (s(x,fx=TRUE) removes penalization altogether btw, which is not what was wanted). dat <- gamSim(1,n

Re: [R] variance explained by each predictor in GAM

2009-07-13 Thread Kayce Anderson
Many thanks for the advice David. I would really like to figure out, though, how to get the contribution of each factor to the Rsq - something like a Beta coefficient for GAM. Ideas? KC On Sun, Jul 12, 2009 at 5:41 PM, David Winsemius wrote: > > On Jul 12, 2009, at 5:06 PM, Kayce Anderson wrote

Re: [R] variance explained by each predictor in GAM

2009-07-12 Thread David Winsemius
On Jul 12, 2009, at 5:06 PM, Kayce Anderson wrote: Hi, I am using mgcv:gam and have developed a model with 5 smoothed predictors and one factor. gam1 <- gam(log.sp~ s(Spr.precip,bs="ts") + s(Win.precip,bs="ts") + s( Spr.Tmin,bs="ts") + s(P.sum.Tmin,bs="ts") + s( Win.Tmax,bs="ts") +fact

Re: [R] variance explained by each predictor in GAM

2009-07-12 Thread Kayce Anderson
Hi, I am using mgcv:gam and have developed a model with 5 smoothed predictors and one factor. gam1 <- gam(log.sp~ s(Spr.precip,bs="ts") + s(Win.precip,bs="ts") + s( Spr.Tmin,bs="ts") + s(P.sum.Tmin,bs="ts") + s( Win.Tmax,bs="ts") +factor(site),data=dat3) The total deviance explained = 70.4%.