Hello R users,

I am working with the GAM to inspect the effect of some factors (year, area) 
and continuous variables (length, depth, latitude and longitude) on the 
intensity and prevalence of the common parasite Anisakis. I would like 
introduce interaction in my models, both "continuous variables-continuous 
variables" and "continuous variables-factor". I have read some 
questions-answers regard to this subject but I still have doubts. 
The solution that I have seen to introduce an interaction "continuous 
covariate-factor" is using "by" (explained in ?gam.models). Below, I show an 
example of my model with the interactions using "by" both to prevalence 
(distribution=binomial) and to intensity (distribution=negative binomial):
 
gam(prevalence~s(length)+factor(year)+factor(area)+s(length,by=area)+s(length,by=year),
 family=binomial,data=X)

gam(intensity~s(length)+factor(year)+factor(area)+s(length,by=area)+s(length,by=year),
 family=negbin(c(1,10)),data=X)
 

The solution that I have seen to introduce an interaction "continuous 
covariate- continuous covariate" is using the function "te". Below, I show an 
example of my model with the interactions using "te" both to prevalence 
(distribution=binomial) and to intensity (distribution=negative binomial):

gam(prevalence~s(length)+s(depth)+s(latitude)+s(longitude)+te(depth,length)+ 
te(latitude,length)+ te(longitude,length),family=binomial,data=X)
gam(intensity~s(length)+s(depth)+s(latitude)+s(longitude)+te(depth,length)+ 
te(latitude,length)+ te(longitude,length),family= negbin(c(1,10)),data=X)



My main doubts are: 
1.      Is the use of "by" and "te" right with the negative binomial 
distribution and with the binomial distribution?
2.      Do these interactions have the same meaning that the interaction 
"factor*continuous covariate" and "continuous covariate* continuous covariate" 
used in the GLM?
3.      Is right to introduce in the model the continuous covariates and the 
factor moreover their interactions?


Thanks in advance.

Best regards,

Lucía Cañás

Lucía Cañás Ferreiro
Instituto Español de Oceanografía
Centro Oceanográfico de A Coruña
Paseo Marítimo Alcalde Francisco Vázquez, nº 10
15001 - A Coruña, SPAIN
e-mail: lucia.ca...@co.ieo.es
Tel: +34981205362; Fax: +34981229077
http://www.ieo.es



        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to