# Fitting of a linea mixed model

#### Alex939

##### New Member
Hello
I'm trying to modelize the diving depth of birds according to categorical (sex, age class: adults/subadults) and conitnuous parameters (temperature, salinity). The frequecy distribution of this data looks like this: many many many dives between 0-50m deep, some between 50-100m deep and few between 100 and 300 m.

As I have repeated measures on the same individuals, I used linear mixed models to find the best factors that explain the varaibility within the data. To do it, I used the lmer function of the lme4 packages in R program. This is an example of models that was been fitted:
fm2 <- lmer(depth ~ 1 + patch+(1|Ident), data, REML=F)

The figures attaches show the plot of the residuals of the models according to the fited data as well as the normality of the residuals. I wonder if we can conclude that this model respected the assumptions of the linear mixed model.

If not, I am also asking which will be the best model to apply on those data. I look for the poison distribution with a log link function. Which would be a nice idea? If not, waht would you recommand to me?I try to log the data and this not improve the fit of the data.

Alex.

#### CB

##### Super Moderator
I'm trying to modelize the diving depth of birds....

I look for the poison distribution with a log link function.
We use the Poisson model for count data. According to your description, your response variable is continuous, so the Poisson model does not really make sense. The normal model seems reasonably sensible, although it doesn't take into account the fact that dive depth has to be a positive number. I'm don't know what the best model would be in such a case, maybe others have ideas?

#### bugman

##### Super Moderator
I interpret this as being count data of birds diving to three depth classes.

In this case using a poisson distribution might me appropirate so your full model may look something like:

m1<-glmer(count~1+depth*sex*age+temp+(1|Ident),family="poisson",data)

(Jake , chime in if I have completely messed this up!)

#### Dason

I interpret this as being count data of birds diving to three depth classes.
Eh - if that's the case then a poisson still doesn't really make sense in my eyes.

#### bugman

##### Super Moderator
If depth is the actual response then I can see your point, but if the depth classes are a predifned factor (with three levels) and the repsonse is counts in each depth class then would you like to explain why?

#### TheEcologist

##### Global Moderator
If depth is the actual response then I can see your point, but if the depth classes are a predifned factor (with three levels) and the repsonse is counts in each depth class then would you like to explain why?
Well that would make the response limited to three classes, so a multinomial would be more appropriate. I interpret this as being repeated measurements on birds, with the response being the depth class, hence multinomial. Or the data could be organised as counts in each depth class, which would remove the repetitive nature, but still keep it multinomial. For example then the response and model would be:

(# shallow, #moderate , #deep) ~ DV1 * DV2 *DV3 .... DVn.

In which case it would again be multinomial.

#### bugman

##### Super Moderator
Fair enough. Must have interpreted it incorrectly. Im going fishing.

#### Alex939

##### New Member
If fact, the response variable is depth, which is not in class. (ie.: max depth may have any value between 0 and 300, with a lot of dive between 0-100 and some between 100 and 300 m deep).

Sorry for the miunderstanding...

#### TheEcologist

##### Global Moderator
Fair enough. Must have interpreted it incorrectly. Im going fishing.
Sounds like we all did 