[R-sig-ME] Crossed or random effects

Ben Bolker bbolker at gmail.com
Thu Oct 13 15:26:34 CEST 2011


On 10/13/2011 07:50 AM, Katrina Evans wrote:
> Hi Ben,
> 
> 
> 
> Thanks very much for your reply.
> 
> 
> 
> Apologies, yes, BreedingStatus is a fixed effect and the model I've been
> trying should have read:
> 
> 
> 
> Mlmer1<-lmer(Distance~BreedingStatus +(BreedingStatus|Bird_id),
> data=Distance)
> 
> 
> 
> Does it matter what order (1|Pair) and (BreedingStatus|Bird_id) are included
> in the model? 

  No.

> And if I was to add a further random effect of site (some of
> the pairs of birds are closer to the edge of the forest than others, so I'm
> thinking of having a core forest group of birds and an edge group of birds)
> would I add this is in like so:
> 
> 
> 
> (1|Pair/Site) + (BreedingStatus|Bird_id) for random effects?

  It would be Site/Pair instead of Pair/Site, but yes.
> 
> 
> 
> My problem with adding time into the model (as month or day) is that I
> tracked mostly males at the beginning of the season and then mostly females
> at the end of the season. Therefore BreedingStatus and Time are related to
> each other. Is there any way to allow for the effect of time on individuals
> in this model or should I keep time out altogether?

  It depends.  They are confounded, so if you put Time in the model it
is quite possible that the effect of breeding status will be diluted. On
the other, this uncertainty stems from a confounding in your
experimental design: if you do find that the estimates of Time and
BreedingStatus are confounded, it could be that Time and not
BreedingStatus is driving your results...

  Ben Bolker
> 
> 
> 
> Best wishes,
> 
> Katrina
> 
> 
> 
> On 6 October 2011 17:39, Ben Bolker <bbolker at gmail.com> wrote:
> 
>> Katrina Evans <katrina.evans at ...> writes:
>>
>>> I have a set of telemetry data, which provides the foraging distances
>>> travelled by birds at different breeding stage.  My aim is to find out if
>>> birds are travelling different distances at different stages in the
>> breeding
>>> season. Telemetry readings were taken from 30 birds over a period of 3
>>> months, producing around 100 records of distance travelled for each bird.
>> I
>>> have included Bird_ID as a random factor in my mixed model. My model so
>> far
>>> is as follows:
>>>
>>> Mlmer1<-lmer(Distance~BreedingStatus +(Status|Bird_id), data=Distance)
>>>
>>
>>  Is there a difference between 'BreedingStatus' (in the fixed effects)
>> and 'Status' (effect varying among Bird_id -- you could think of
>> this as "Status crossed with Bird_id"), or are they supposed to be
>> the same bird?
>>
>>> I have a few of queries -
>>>
>>> 1) For one breeding stage eg. incubating female, the same bird, eg female
>>> 807, appears repeatedly. In addition, this bird will also be present
>>> in other breeding stage groups,
>>
>>  (this is the same as "levels of the BreedingStatus variable", right?)
>>
>>> eg provisioning and chicks fledged groups.
>>> Is it enough to have Bird_id in as a simple random effect in the model,
>> or
>>> is it important to allow for the fact that the same bird also occurs in
>> some
>>> (but not all) of the other breeding stage groups? I have been reading
>> about
>>> crossed random effects but am struggling to find relevant ecology
>> examples.
>>> I also don't think this is quite the same thing.
>>
>>   Since BreedingStatus (as I understand it) is a fixed effect,
>> you're essentially crossing BreedingStatus with Bird_id
>> by specifying (BreedingStatus|Bird_id)) [which is what I wrote above]
>>
>>> 2) Some of the birds were in pairs, so I am thinking of adding 'Pair' in
>> as
>>> a second random effect. However, I'm not sure if I have a big enough
>> sample
>>> size to create a valid model. And would this be crossed or nested??
>>
>>   If any bird was observed in more than one pair, then it would
>> be crossed.  If birds were only ever observed in a single pair,
>> then it would be nested -- but I think you don't have to worry about
>> the distinction.  Since Status is relevant only to birds, and not
>> to pairs, and as long as birds are uniquely identified (and not
>> e.g. identified only as individual 1 and 2 within each pair)
>> I think  that (1|Pair) + (Status|Bird_id) would be fine.  The only
>> way to be sure you have a big enough sample size is to try it --
>> variances estimated as zero, correlations among random effects
>> estimated as +/- 1, or convergence warnings/errors are the signs
>> that you may be overfitting.
>>
>>>
>>> 3) I have been trying mixed models in both R and SPSS. SPSS makes a point
>> of
>>> asking the user to choose an induced correlation structure for the model.
>> Is
>>> this something that should always be checked for? A lot of texts on this
>>> topic for R seem to gloss over this. As I have repeated measures on the
>> same
>>> birds, it is likely that measurements for one bird will be more similar
>> to
>>> each other than those for another bird.
>>
>>  That's incorporated in your model already, by specifying bird
>> as a random effect.
>>
>>> Also measurements taken in June for
>>> one bird may all be similar, compared to those in August for the same
>> bird.
>>> Any advice would be really useful.
>>
>>  You could add 'month' as a fixed effect (adding it as a random
>> effect won't work very well with three months).  You could add
>> 'day' as a random effect, probably crossed, since you probably
>> don't have multiple samples of birds per day [hence variation among
>> birds within days would be confounded with the residual variance].
>> There is an additional way to model correlation, which is to add
>> autocorrelation structures for the fact that birds are likely to
>> behave similarly on days that are close together in time.  You can
>> do this with lme (in the nlme package), but not (yet) with lmer.
>> If you don't end up wanting to do too much fancy stuff with crossed
>> random effects, you could switch to lme.
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>




More information about the R-sig-mixed-models mailing list