Hi list

I was wondering if I could get some advice on how to analyse time-to-event data using a binomial GAMM or GLMM with a complementary loglog link? I was thinking of fitting a smoother or polynomial to time to model temporal variation in an event (akin to the hazard function in a non-parametric survival model).

I've got some acoustic telemetry data for 23 eels in a river. The question of interest is what factors influence the downstream migration of eels from their resident freshwater reach to the estuary (initiation of spawning migration)?  We have daily observations of each fish (DOY, 25-840 days per fish)and I've used a binary response variable (0 for freshwater, 1 for estuary). Each fish only makes one move to the estuary, they were tagged on different dates and all fish move. Therefore, the response variable for each individual (move) looks like: e.g. 000001 (five time periods in freshwater, moved to estuary on the sixth). We assume complete detection. See example reproducible dataset below for data structure and model output.

As there are repeated measures for each individual, I fitted ID (23 levels) as a random intercept in the model below that included a cyclic penalized cubic regression spline smooth for DOY by each of 6 Years :

Model1 <- gamm4(move~s(DOY,bs="cc",by=Year)+c.(log(fivedayflow)),random=~(1|ID),family=binomial(link='cloglog') ,data=fresheels)

However, the variance associated with ID random effect is pretty much zero (below) when I look at summary(Model1$mer). Is my model structure ok for this type of analysis (just no detectable among-fish variation), or is it inappropriate and I am better served using just gam or even a time-varying cox proportional hazard model (preferably not)? The model structure would be pretty much identical in a glmm with a polynomial fit to DOY.
Generalized linear mixed model fit by the Laplace approximation
   AIC   BIC logLik deviance
298.2 362.2 -140.1    280.2
Random effects:
Groups Name            Variance   Std.Dev.
 ID     (Intercept)     1.1645e-09 3.4124e-05
Xr.4   s(DOY):Year2012 4.4713e+02 2.1145e+01
Xr.3   s(DOY):Year2011 4.2745e+01 6.5380e+00
Xr.2   s(DOY):Year2010 3.0213e+02 1.7382e+01
Xr.1   s(DOY):Year2009 4.2703e+02 2.0665e+01
Xr.0   s(DOY):Year2008 4.0547e+02 2.0136e+01
Xr     s(DOY):Year2007 4.4394e+00 2.1070e+00
Number of obs: 9041, groups: ID, 23; Xr.4, 8; Xr.3, 8; Xr.2, 8; Xr.1, 8; Xr.0, 8; Xr, 8

Fixed effects:
                      Estimate Std. Error z value Pr(>|z|)
X(Intercept)           -7.8617     0.5295  -14.85  < 2e-16 ***
Xc.(log(fivedayflow))   2.4845     0.4374    5.68 1.35e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            X(Int)
Xc.(lg(fv)) -0.802

REPRODUCIBLE EXAMPLE

ID<-c(rep('A',10),rep('B',7),rep('C',13),rep('D',10),rep('E',22),rep('F',17),rep('G',15))
move<-c(rep(0,9),1,rep(0,6),1,rep(0,12),1,rep(0,9),1,rep(0,21),1,rep(0,16),1,rep(0,14),1)
DOY<-c(10:19,15:21,45:57,33:42,20:41,33:49,15:29)
enviro<-c(8,6,10,12,11,15,14,14,8,8,15,14,14,8,8,10,12,15,13,5,12,14,11,7,5,12,15,11,10,8,14,13,11,15,10,13,8,
6,6,5,10,12,10,6,9,8,14,10,6,9,14,5,12,14,13,11,15,10,13,8,6,6,14,13,11,15,10,13,8,6,6,5,8,11,15,13,5,12,14,
15,14,14,8,8,10,12,10,6,9,8,14,10,6,9)
mydata<-data.frame(ID,move,DOY,enviro)
str(mydata)

model<- gamm4(move~s(DOY,bs="cc")+enviro,random=~(1|ID),  family=binomial(link='cloglog'),data=mydata)
summary(model$mer)

Cheers
John

	[[alternative HTML version deleted]]

