# [R] Transforming smooth functions of gam using mgcv

hesicaia dboyce at dal.ca
Sat Feb 14 20:39:50 CET 2009

```Hi,

I have 2 questions, both pertaining to additive mixed models using mgcv(). I
have fit several additive mixed models using the mgcv package (v 1.4) in R
(v 2.8) modeling log chlorophyll as follows:

mod<-try(gamm(log(Chl) ~ s(Year,bs="cs") +  s(Latitude,Longitude,bs="tp") +
s(Dayofyear,bs="cc",k=6) + s(Depth,bs="cs") +
as.factor(depcat),data=d,gamma=1.4,random=list(newarea10=~1)))

Question 1:
I am interested in examining the yearly trend in chlorophyll abundance but
having looked over previous posts I see that plot.gam() returns a smooth
function that is centered on 0 and that this can be modified by adding the
model intercept IF THERE IS ONLY ONE COVARIATE. I have several covariates,
but tried to transform the smooth function by adding my model intercept and
exponentiating the smooth function as follows:

#exponentiates response to transform from log scale
I<-function(x){exp(x)}
#plots transformed yearly smooth function

The plot seems biologically realistic, but I wanted to make sure this is
statistically valid, as previous posts indicated it might not be.

Question 2:
More of a statistics question, but I was wondering how important the
assumption of normally distributed random effects for additive mixed models
is? Mine are slightly kurtotic (peaked), but otherwise normal. I know that
when examining residuals for many models (linear, generalized linear), that
the assumption of normality becomes less important as the sample size
increases due to large sample theory. Is this reasoning similar for random
effects?

Thanks in advance for your time and help, this forum is a wonderful
resource.

Daniel Boyce.

--
View this message in context: http://www.nabble.com/Transforming-smooth-functions-of-gam-using-mgcv-tp22016166p22016166.html
Sent from the R help mailing list archive at Nabble.com.

```