[R] Model checking for gam (mgcv) result

Simon Wood s.wood at bath.ac.uk
Tue Apr 12 18:15:31 CEST 2011


The curve is caused by the zeroes in your data.

raw.residual = response - fitted

so if response=0 then

raw.residual = -fitted.

You get a curve, rather than a straight line, on the fitted vs residual 
plot because the residuals are standardised in a way that also depends 
on the fitted value. (This happens with other GLMs too, not just GAMs)

best,
Simon

On 12/04/11 16:02, Samuel Turgeon wrote:
> Dear list,
>
> i'm checking the residuals plots of a gam model after a processus of model
> selection. I found the "best" model, all my terms are significant, the
> r-square and the deviance explained are good, but I have strange residuals
> plots:
>
> http://dl.dropbox.com/u/1169100/gam.check.png
> http://dl.dropbox.com/u/1169100/residuals_vs_fitted.png
>
> What does explains the "curve" on those plots??
>
> I've also plotted each explanatory variables included in the model against
> residuals and everything looks fine.
>
> Kind regards,
>
> Sam
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603               http://people.bath.ac.uk/sw283



More information about the R-help mailing list