[R-sig-ME] models with fixed effets nested in random effects

Hallstrom, Wayne (Calgary) Wayne.Hallstrom at WorleyParsons.com
Wed Mar 7 00:04:02 CET 2007

Hi Andrew,
Note comments interted below...
++Hi Wayne,

On Mon, Mar 05, 2007 at 12:10:16PM -0700, Hallstrom, Wayne (Calgary)
> Hi Andrew,
> The reason I did not include year in the random effects part of the 
> model was since in terms of the actual data those are the individual 
> observations. Putting year into the model made the groups messed up. 
> The model statement "FenceEnd/FEsection/MIT_UNMIT" thus had the proper

> number of groups to match the physical chatacteristics of the design 
> setup, [number of obs: 1230, groups: MIT_UNMIT:(FEsection:FenceEnd), 
> 93; FEsection:FenceEnd, 58; FenceEnd, 7] and then there are the count 
> data from each year within each of these groups.  It made sense to me 
> when I was writing the formula but maybe this is not right?

++ The decision about year looks good to me, based on your description

++ There may well be a temporal correlation structure to watch out for
within the lowest- level random effects.  ++ If that be the case then
you might want to move to using lme(), which has well-configured helper
functions for
++ fitting the more complicated models.

I considered using lme(), but I have overdispersed count data and need
to use the more flexible glm structure of LMER. I could be wrong, but
the way I the model set up should allow me to note any substantaial
effect of year in one of the candidate models. That was not the case,
models with year were not anywhere near as good fit.

> As well, I have the treatment effects in the random part of the 
> formula since without doing this there would not be the proper 
> structure to fit the data, and would I not then have 
> pseudoreplication? It is not entirely clear to me what should be done 
> with fixed/random effects in this case where the treatmetn effects 
> need to be used to define the grouping of the data. Maybe as you say I

> could define a new variable with the same characterisitces as 
> 'FEsection' and 'MIT_UNMIT' in order to have one for the random 
> section to account for data structure, and another in the fixed 
> section to account for the fixed effects. Wouldn't that just produce
the same results by a different name?

++ Yes, it would.  I hope that my addition of that text wasn't
++ I merely meant to include it as a possiblity to deal with concerns
about the same effects being fixed and 
++ random.  I do think that it would be clearler in some cases.

I can see what you mean though since it makes the formula 'cleaner'.

> In terms of the study layout:
> -Parts of the highway were fenced at different intervals 
> (treatment=MIT_UNMIT), creating fence ends (location=FenceEnd).

++ Ok, this implies to me that MIT_UNMIT represents the intervals
somehow, and that each interval has one or more
++ FenceEnd associated with it.  What exactly does MIT_UNMIT mean?  I
assume that it's mitigation vs no
++ mitigation.  

MIT_UNMIT is the fencing treatment. Yes, each fence has one or two ends.

> Subsequent fencing extended the fence, removing some fence ends but 
> creating new ends. Generally, fence ends are far apart from the 
> previous fence end since most phases of fencing are ~20km long.
> -roadkill count data were collected, and summed on a yearly basis 
> (year).
> -roadkill location data were then processed and categorized by UTM 
> coordinates into five 1km segments inside each fence end and five 1km 
> segments outdside, centered on the fence end (subsite=FEsection). This

> sort of like having 10 different levels of the 2 treatments at each 
> fence end. The treatment effects being accounted for by the MIT_UNMIT 
> variable that defines whether the sample had fencing or not, and the 
> FEsection variable defining how far from the fence end the mortalities

> occurred. Of course there could be many ways to look at this, I tried 
> to keep things as simple as possible. Feel free to make suggestions if

> you can think of alternatives...

++ I'm a bit confused by the nesting of MIT_UNMIT inside FEsection.
Your earlier text implies to me that the
++ MIT_UNMIT treatment differed at the FenceEnd level.  Nesting it
inside FEsection implies that every level of
++ FEsection has all the MIT_UNMIT levels nested within them. That seems
like a contradiction to me.

++ Also, based on your description I wonder if FEsection should be
recoded to have a continuous basis as well as
++ a categorical one - for the purposes of representing an underlying
distance?  I note from your earlier email
++ that FEsection appears as a 10-level factor, and that seems (prima
facie) more difficult to interpret.

++ Cheers,
++ Andrew

Well, that is sort of true about the nesting of MIT_UNMIT inside
FEsection. Most do, but not all fence end sections will have both
MIT_UNMIT treatments. I am not sure however that this is a major concern
since all that means is there are never records for MITIGATED for
FEsections 1-5 outside the fence. I was thinking of it as explaining the
locations, then add in treatment effects at each location last. I
suppose I could have tried FenceEnd/MIT_UNMIT/FEsection instead but I
don't think that works since then you have FEsections inside MIT_UNMIT
which does not always occur either. There is no way around this issue
because using a distance measure also has the same problem (no roadkill
distance-mitigated combination exists outside the fence end). I suppose
maybe I could add something in about NA records to cover that though?

I did not use distance since many of the records are from before a given
fence ends exists, so a distance measure is sort of meaningless for that
time period. I chose 1km sections since those are not tied to one
particular location in the same way, and because there is some error in
the mortality record locations which is partially removed by lumping the
data into sections.

> A variety of models were fit to the data with the intention of 
> determining how fencing affected the distribution of mortality at a 
> fence end. Questions asked were - Does mitigation cause a shift in 
> mortality locations to the unfenced area beyond the fence end 
> (segments
> 1-5->outside versus 6-10->inside)? This would imply the fence end 
> 1-5->should
> perhaps be relocated elsewhere. Is there a notable difference in 
> mortality among the segments inside and the segments outside the fence

> end? Higher mortality inside the fence could show whether animals are 
> getting inside at the fence end and then being killed, in which case 
> deterrents to keep them out and mitigations to allow trapped animals 
> to escape should be considered. If there is a concentration of 
> mortality in the 1km FEsections nearest the fence end this would 
> support the idea that substantial numbers of animals are rounding the 
> fence end and being killed at that location, implying the fence is not

> located properly relative to animal migrations in the area and needs 
> to be extended, and/or perhaps more crossing structures are needed. 
> Mainly elk are the animal killed in this area.
> The model I pasted into the last email was best of the the 3 best-fit 
> models. The others were similar in structure but with different form, 
> such as:
>   u0 <- lmer(ung ~ 1 + (1|FenceEnd/FEsection/MIT_UNMIT), 
> family=quasipoisson(link ="log")
>   u01<- lmer(ung ~ year + (1|FenceEnd/FEsection/MIT_UNMIT), 
> family=quasipoisson(link ="log")
>   u1 <- lmer(ung ~ FEsection + (1|FenceEnd/FEsection/MIT_UNMIT), 
> family=quasipoisson(link ="log"))
>   u2 <- lmer(ung ~ MIT_UNMIT + (1|FenceEnd/FEsection/MIT_UNMIT), 
> family=quasipoisson(link ="log"))
> 	.
> 	.
> 	.
>   u5 <- lmer(ung ~ FEsection + MIT_UNMIT + 
> (1|FenceEnd/FEsection/MIT_UNMIT), family=quasipoisson(link ="log"))
> Anyway I really appreciate the help since it is a new and confusing 
> issue to me. This is for some work I do on my own time, with data from

> a pproject I worked on in the past. The data are for one of the larger

> highway wildlife fencing studies out there, and since roadkill is an 
> issue growing with the growing traffic volumes, these results will 
> probably be used as reference for how to design other fencing
> Wayne

I guess what I really am trying to get at here is:
  - do wildlife roadkill counts differ between FEsections 1-10
pre-fencing, or are they uniformly distributed?
  - post-fencing, does the distribution of roadkill counts change
compared to pre-fencing? 
  - where do any observed differences crop up realtive to the fence end?

These questions seem to have been answered by looking at the various
models, including interactions. Best fit model was FEsection +
MIT_UNMIT. A significant effect from FEsection shows that roadkill
differs between the sections, and MIT_UNMIT shows that mortality
distribution before after fencing differs. There was no interaction in
the best model which shows that the effect of MIT_UNMIT is consistent
across all the fence end sections where mitigation occurred. If there
were an interaction and no main effects that would demonstrate that
mitigation only changed roadkill distribution in some cases (but this
did not happen).

Compared to the multivariate G-test (like a chi-test) method I used
initially, this sometimes has seemed to be trying to fit a square peg of
data into a round hole of a statistical method. That method allowed me
to define exact locations of differences in counts and go back to see
what was there on the ground. I guess that is still useful info for the
discussion anyway.

Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
"This email is confidential.  If you are not the intended recipient, you must not disclose  or  use the  information  contained in it.  If you have received this email in error,  please notify us immediately by return email and delete the email and any attachments. Any personal views or opinions expressed by the writer may not necessarily reflect the views or opinions of any company in the WorleyParsons Group of Companies."

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