# Choosing the right statistical test

I performed an experiment and I now need to analyze my data. However, I find statistics hard and find it difficult to pick the right test. So, I have looked at the abundance of bees across 4 different distances from a beehive, and my hypothesis is that the abundance of bees is higher close to the beehive, than further away. So I'm testing for possible differences in abundance across the different distances. In total, I have 4 different blocks, and as the weather may influence the abundance, I have this one also included. There is more information in my data sheet, but the key data looks like this:

Block Distance Species Sun A 0 A Yes A 30 B Yes B 0 A No

Now, I have figured out that if I see the distance as numeric, I could use a Linear Model. Maybe a linear mixed- effects model? However, I could also see the distances as 4 different groups, and then I could use an ANOVA. Is this correct? Are there other 'fancier' tests possible? As in, more advance than a simple Linear Model or an One-way ANOVA. I have looked into tests such as Nested ANOVA's and the Repeated-measures ANOVA, but my data does not meet the requirements. I'm thus a little bit lost. Some help would be appreciated! I hope the set-up is a little bit clear.

It's not really a randomized design. I went outside, and recorded the weather. I had more dry days with sun, than rainy days. I also do not have every species at every distance. E.g., I have 4 species at distance one, but only 2 at distance 4.

So for every individual that I saw, I recorded what species it was, and at which distance I saw it. Sorry if I wasn't clear enough (I probably wasn't, sorry!), but for my analysis, I wanted to use the total number of individuals as the abundance, and not the species. E.g., I have 30 individuals at spot 1, but 2 at distance 4. However, I did not even consider to see if the species change across distance, so this is an additional test I can do!

I'm just a little bit lost on the last part though, could you maybe explain that some more?

• Please register &/or merge your accounts (you can find information on how to do this in the My Account section of our help center), then you will be able to edit & comment on your own question. – gung - Reinstate Monica Mar 30 '18 at 19:37

You might indeed be able to set this analysis up as a repeated-measures ANOVA; if you have every species and both weather conditions (Sun=Yes, Sun=No) in every block, this is what's called a randomized-block design. (Why do you say your data "does not meet the requirements" of this test?) The main disadvantage of most ANOVA designs is that (unless you are allowed the option of making abundance a continuous or numeric predictor) you're allowing the abundance to vary arbitrarily (rather than consistently increasing/decreasing) across distances, which (1) tends to lower the power of the test and (2) makes it harder to extract a simple parameter from the model (e.g. change in abundance per unit distance). On the other hand, if the change in abundance with distance is not a simple linear trend - e.g. it increases and then decreases, or changes sharply at a threshold distance - then you might be better off treating distance as a categorical variable anyway.

Setting this up as a mixed model offers more flexibility (which might be a mixed blessing ...) In principle, you could suppose that abundance depended on absolutely everything, e.g.

abundance ~ Distance*Species*Sun + (Species*Distance*Sun|Block)


but (see below) I would probably pick something simpler like

abundance ~ Distance+Species+Sun + (1+Species+Distance+Sun|Block)


The most complex model supposes that

• abundance is changing linearly with distance.
• the model includes fixed effects with all possible interactions between sun, species, and distance, which means in particular that
• the intercept (abundance at zero distance, i.e. at the hive) could differ among species, or in the presence or absence of the sun, or these factors could interact (i.e. different species change in abundance by different amounts in sun vs. shade)
• the slope (change in abundance per unit distance) could differ in all of the same ways (by species, by sun, or by their interaction)
• the model also includes variation in all of these effects across blocks.

However, this model is very likely too complicated for your data. In the old days people would do stepwise regression or (slightly more recently) all-subsets model selection, where they would try a bunch of models and see which one "fit best/most parsimoniously". However, this is no longer recommended, as it's a recipe for amplifying noise into apparent scientific findings.

Instead, you should use the rule of thumb that you should have 10-20 observations per parameter in your model (Harrell, Regression Modeling Strategies), and simplify your model (also called "reducing its dimension") accordingly - not by looking at the abundance data and seeing what seems to be happening, but a priori. Each numeric predictor variable (such as distance) has two parameters (slope and intercept), and each categorical predictor (species, sun) has one parameter per category; you don't need to double-count the intercept (value at zero, or in the baseline category), but interactions multiply the number of parameters needed. For example, if you had 40 total observations (and could thus afford 4 parameters), you could fit the additive model Distance+Species+Sun; there is an intercept parameter (expected abundance at distance=0/species A/Sun=No) plus a parameter for each effect. The simplifying assumption here is that there are no interactions, i.e. the rate of change of abundance is the same for all species and all conditions, the abundance in the sun is the same for all species, and the effect of sun vs. shade is the same for all species.

The block effects also add parameters, but as long as you can successfully fit the model (e.g. none of the variances are estimated as zero) you might not have to count them against your complexity. It might be OK to do stepwise reduction on the random-effects part of the model; the jury is still out on this.

Just to make your life harder (sorry), if your abundances are count data, you should consider a generalized linear (mixed) model with a Poisson or negative binomial response; if some of the abundances are low (lots of 0 and 1 values), it will be hard to transform them to meet the requirements of homoscedasticity/normality.