# Random and fixed effects for observational/ecological studies

I was wondering if anyone had any insight to offer on the question of deciding which variables are random effects and which are fixed effects for ecological studies that are based on observations in the field rather than variables that have been set in experimental conditions (“treatments”). All the guidance that I have found so far refers to the latter situation rather than the former.

I am studying a particular species of reptile, trying to discover the environmental variables that account for their distribution over my study site. My study involves placing refuges on the ground which attract the reptiles, then I go around and count from the exact same locations each time.

One person that I’ve spoken to says that observations such as the ground temperature, vegetation height, and area of scrub around each of my reptile sighting points should be considered random effects because they haven’t been set by me, I have just recorded them. Whereas anything I have set, such as the refuge material, should be considered a fixed effect.

Someone else I've spoken to says that this is the exact opposite of what should be the case: observations of things that I'm interested in should be the fixed effects (such as the aforementioned environmental variables, and how they affect reptile numbers) and things that I'm not so interested in (but might help to explain my results, such as refuge material) should be the random effects.

Who is right?

One definition of random effects (e.g. Bolker et al (2009) ) is they are factors whose levels are sampled from a larger population, but what is the larger population of temperature? Is it just the temperatures I haven’t measured yet? Over several surveys, I have recorded probably the whole range of interest of temperature, but not all of a variable like angle of slope where I have gaps. Does that make a difference to my treatment of these effects? Also temperature was measured each time, whereas angle of slope was assumed to remain the same each time, as the same locations were surveyed each time. Will that make a difference?

I appreciate the difference is not always clear but I just can't seem to find explanations that refer specifically to ecological or observational situations and would really appreciate some guidance.

• Temperature, height, and area do not make sense as random effects because they are continuous variables; treating them as random would force the model to assume they are categorical. I've addressed related ecological questions here: stats.stackexchange.com/a/288714/121522 & here: stats.stackexchange.com/a/289346/121522 but the best set of explanations about how to think about mixed models is here: stats.stackexchange.com/questions/4700/… – mkt - Reinstate Monica Jul 30 '17 at 20:51
• Thanks for that @mkt. Do you have a source I could cite for this distinction as I don't think I've seen a reference to continuous vs categorical variables when considering the random vs fixed question? – Mike Jul 31 '17 at 11:39

What you are studying is entirely a fixed effect model.

In some examples the word "population" or "environment" is related to random effects. For example, you study populations of reptiles where each individual has a known weight. You want to study the effect of the weight on whatever $Y$. And you study several populations (environments) who have unknown (latent) properties that you can't measure. Then, this is a mixed effects model where the fixed effects are about the individual, the random effects are about the population. This is simply because you can measure the variables of an individual, not the variables of the population.

You could have a mixed effects model where things are reversed. You put the same reptile in different places and then measured whatever $Y$ (and repeat this with several reptiles). Then the environment variables, that are measured would be the fixed effects. The individual variables (that are unknown) would be the random effect.

Generally environment/individual are not directly connected to random/fixed. It depends on the situation. The word "population" is used to teach random effects in order to evoke something tangible. But it's more an abstract concept not related to a real notion of "population".

In your case, there are only fixed effects. You measure the variables of the environment and there is no other variable. There is no individual, since you don't measure a variable on each individual, but simply count the number of reptiles. So it's just a fixed effects model.

Random effect in your case could be time: if for example you make a measurement each season. The "population" (in the abstract sense) would be the season.

• Thanks for your answer Benoit. There is slightly more detail in my study that I didn't give in my question - this is a repeated measures study so I think refuge is then a random effect to account for this variation, correct? And do I consider the refuge as my "individual", since I'm counting the reptiles underneath each refuge each time, and my variables relate to each refuge directly? – Mike Jul 30 '17 at 23:17
• Yes I guess so. I think (in your study) the environment includes random and fixed effects. Fixed effects are what you measure, random effects are what is unknown about the population or the environment :for example individuals in the same population could have unknown genetic similarities that influence $Y$, or there could be something in the environment you're not aware of that influence $Y$ too. – Benoit Sanchez Jul 31 '17 at 9:41
• Just to clarify 100%, I should treat the variables that I measured (temperature, vegetation height, area of scrub etc) as fixed effects? – Mike Jul 31 '17 at 11:36
• Yes. mkt's comment is accurate. – Benoit Sanchez Jul 31 '17 at 11:40