# Comparison of groups over time using glm

I have count data on three groups of sites, sampled annually over 6 years.

Group1 = target group

Group2= control (untreated group) and

Group3 = treated group (started the same as Group2).

My hypothesis is that OVER TIME Group3 will become less like Group2 and more like Group1. I want to show in which year this occurs:

Example result:

In year 1, Group3 is NS from Group2 but is sig dif from Group1. But in year 3, Group3 is sig dif from Group2 and NS from Group1.)

So how do I test for significance between all groups, with year as an interaction? Since Im comparing both Group1 and 2 to Group3, I thought to use Group3 as the reference (i.e. intercept) and Group1 and 2 as the independent 'treatments' using a poisson glm regression :

glm(count ~ group * year, dat ,family ="poisson")


If I set year as a factor will this test each group_year combo as a categorical interaction? (note the 6 years are not continuous: 2010:2013,2016,2017)

Is this the best way to test for differences between groups or is there a more elegant way? (note Im not particularly interested in the difference between groups 1 and 2, more in the transition of group 3).

glm(count ~ group, dat_2010, family="poisson")