[R] GAM, GAMM and numerical integration, help please
Claudia Penaloza
claudiapenaloza at gmail.com
Thu May 13 22:59:29 CEST 2010
I am trying to apply methods used by Chaloupka & Limpus (1997) (
http://www.int-res.com/articles/meps/146/m146p001.pdf) to my own turtle
growth data.
I am having trouble with two things...
1) After the GAM is fit, the residuals are skewed.
>m1 <- gam(growth~s(mean.size,
bs="cr")+s(year,bs="cr",k=7)+s(cohort,bs="cr")+s(age,bs="cr"),
data=grow,
family=quasi(link="identity"))
>plot(m1, scale=0) #figure attached
Should I try fitting a GAMM to model the tendencies in the residuals?
How?
2) Using the GAM, I am able to fit a cubic-b spline but I do not know how to
determine the equation for this spline nor how to integrate it/differentiate
it (to obtain plots similar to 3c & f in Chaloupka & Limpus (1997)).
What should I do next?
>size <- seq(100,600,along.with=fitted(m1))
>grw <- fitted(m1)
>bspline3 <- gam(grw~s(size, bs="cr", k=3))
>plot(grw~size,ylab="Growth (mm/yr)", xlab="Curved Carapace Length
(mm)") #figure attached
>lines(fitted(bspline3)~size, lwd=2)
Thank you very much for any help!
Claudia
More information about the R-help
mailing list