Re: [R] Repeated measures design for GAM? - corrected question...
Diederik, The `gamm' call looks fine provided `park' is nested in `count'. You are basically adding a random effect for each survey, and a random effect for each `park' within survey to the the smooth effects. best, Simon ps. I assume there are more than 18 observations in the full dataset --- the model sturcture is a bit too complicated otherwise... On Wednesday 28 January 2009 19:44, Strubbe Diederik wrote: Dear Simon, Many thanks for pointing me to the GAMM! For clarification, Bird_abundance are breeding densities ( e.g. 1.25 BP/ha, 2.20 BP/ha,...) and count is just the actual survey(e.g. first_survey,...). The dataset looks like Bird_abundanceStudy_area YEARCOUNT X1 X2 X3 X4 0.15 area_1 2004first_survey� � � � 1.26 area_1 2004second_survey � � � � 2.47 area_1 2005third_survey� � � � 0.00 area_1 2005fourth_survey � � � � 0.23 area_1 2006fifht_survey� � � � 2.64 area_1 2006sixth_survey� � � � 4.14 area_2 2004first_survey� � � � 5.00 area_2 2004second_survey � � � � 6.80 area_2 2005third_survey� � � � 0.15 area_2 2005fourth_survey � � � � 0.25 area_2 2006fifht_survey� � � � 2.36 area_2 2006sixth_survey� � � � 2.59 area_3 2004first_survey� � � � 6.31 area_3 2004second_survey � � � � 0.15 area_3 2005third_survey� � � � 2.85 area_3 2005fourth_survey � � � � 2.48 area_3 2006fifht_survey� � � � 1.23 area_3 2006sixth_survey� � � � � � � � � � � � Am I correct in assuming the following is a valid syntax for this repeated measures design?: model -gamm(Bird_abundance ~ YEAR + s(X1)+ s(X2)+ s(X3)+ s(X4),random=list(count=~1,park=~1)) best wishes and thanks again, Diederik Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 -Original Message- From: Strubbe Diederik Sent: Wed 28-1-2009 18:09 To: r-help@R-project.org Subject: Repeated measures design for GAM? - corrected question... Dear all, I have a question on the use of GAM with repeated measures. My dataset is as follows: - a number of study areas where bird abundance has been determined. Counts have been performed in 3 consecutive years and there were 2 counts per year (i.e. in total 6 counts). - a number of environmental predictors that do not change over year Xi). When using a GLM, a repeated measures design would like: (for example) lme(Bird_abundance = study_area + count +year+ X1 + X2 + X3,random = ~count|study_area). However, I have found no analogue design for a GAM. For now, I have averaged my bird abundances but I wondered whether a more subtle and elegant strategy exists...? Many thanks, Diederik Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 [[alternative HTML version deleted]] -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ 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.
[R] Repeated measures design for GAM? - corrected question...
Dear all, I have a question on the use of GAM with repeated measures. My dataset is as follows: - a number of study areas where bird abundance has been determined. Counts have been performed in 3 consecutive years and there were 2 counts per year (i.e. in total 6 counts). - a number of environmental predictors that do not change over year Xi). When using a GLM, a repeated measures design would like: (for example) lme(Bird_abundance = study_area + count +year+ X1 + X2 + X3,random = ~count|study_area). However, I have found no analogue design for a GAM. For now, I have averaged my bird abundances but I wondered whether a more subtle and elegant strategy exists...? Many thanks, Diederik Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 [[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.
Re: [R] Repeated measures design for GAM? - corrected question...
`gamm' in package `mgcv' will let you specify random effects as part of a generalized additive mixed model, but I must admit that I'm a bit confused about what `Bird_abundance' is here, and how it differs from `Count'. best, Simon On Wednesday 28 January 2009 17:09, Strubbe Diederik wrote: Dear all, I have a question on the use of GAM with repeated measures. My dataset is as follows: - a number of study areas where bird abundance has been determined. Counts have been performed in 3 consecutive years and there were 2 counts per year (i.e. in total 6 counts). - a number of environmental predictors that do not change over year Xi). When using a GLM, a repeated measures design would like: (for example) lme(Bird_abundance = study_area + count +year+ X1 + X2 + X3,random = ~count|study_area). However, I have found no analogue design for a GAM. For now, I have averaged my bird abundances but I wondered whether a more subtle and elegant strategy exists...? Many thanks, Diederik Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 [[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. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ 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.
Re: [R] Repeated measures design for GAM? - corrected question...
Dear Simon, Many thanks for pointing me to the GAMM! For clarification, Bird_abundance are breeding densities ( e.g. 1.25 BP/ha, 2.20 BP/ha,...) and count is just the actual survey(e.g. first_survey,...). The dataset looks like Bird_abundance Study_area YEARCOUNT X1 X2 X3 X4 0.15area_1 2004first_survey 1.26area_1 2004second_survey 2.47area_1 2005third_survey 0.00area_1 2005fourth_survey 0.23area_1 2006fifht_survey 2.64area_1 2006sixth_survey 4.14area_2 2004first_survey 5.00area_2 2004second_survey 6.80area_2 2005third_survey 0.15area_2 2005fourth_survey 0.25area_2 2006fifht_survey 2.36area_2 2006sixth_survey 2.59area_3 2004first_survey 6.31area_3 2004second_survey 0.15area_3 2005third_survey 2.85area_3 2005fourth_survey 2.48area_3 2006fifht_survey 1.23area_3 2006sixth_survey Am I correct in assuming the following is a valid syntax for this repeated measures design?: model -gamm(Bird_abundance ~ YEAR + s(X1)+ s(X2)+ s(X3)+ s(X4),random=list(count=~1,park=~1)) best wishes and thanks again, Diederik Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 -Original Message- From: Strubbe Diederik Sent: Wed 28-1-2009 18:09 To: r-help@R-project.org Subject: Repeated measures design for GAM? - corrected question... Dear all, I have a question on the use of GAM with repeated measures. My dataset is as follows: - a number of study areas where bird abundance has been determined. Counts have been performed in 3 consecutive years and there were 2 counts per year (i.e. in total 6 counts). - a number of environmental predictors that do not change over year Xi). When using a GLM, a repeated measures design would like: (for example) lme(Bird_abundance = study_area + count +year+ X1 + X2 + X3,random = ~count|study_area). However, I have found no analogue design for a GAM. For now, I have averaged my bird abundances but I wondered whether a more subtle and elegant strategy exists...? Many thanks, Diederik Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 [[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.