# Statistical test to find association between two variables

I'm dealing with ecological data. Broadly speaking, i've counted the plant abundance (discrete variable) in a number of points (small blocks,one number for each point).There were about 50 of a such points totally. For each point (block) we determined a substrate type (nominal variable with the two levels, e.g. substrate A and substrate B). We need to test if there is a statistical dependence between substrate type and the plant abundance. E.g. to have an opportunety to say that the plant is usually more abundant on substrate of A type. In adition, it's worth to mention that the first half of my points (points from 1 to 25) were collected in one location and points from 26 to 50 in another locations, i.e. not all of my points are independant. Which statistical test i may use in my case?

• Take a look at this reference: rcompanion.org/handbook, there is a section on choosing a statistical test, around page 135+ Aug 21, 2019 at 18:30
• Is Abundance a count, or is it some other type of discrete variable? Aug 22, 2019 at 15:08
• Yes, it's a count. Aug 22, 2019 at 19:26
• Because of the fact, that not all of the points (blocks=replicates) are independent, i'm not able to use ANOVA. Aug 22, 2019 at 19:34
• Now i'm also considering using mixed linear model with location as random effect. Aug 28, 2019 at 16:09

You could use a generalized linear model here - as the response is count data, specify the Poisson family of models. Include Site as a co-variate to take into account the site-specific variation.

You can use the "anova" function to compare your model with a null model in which site is the only predictor. For example:

model_full <- glm(plant_abundance ~ substrate_type + site, data=data, family="poisson")
model_null <- glm(plant_abundance ~ site, data=data, family="poisson")
anova(model_full, model_null)

• Yes, right approach
– Fr1
Aug 27, 2019 at 14:31
• You might consider negative binomial regression rather than Poisson, as it's a more general distribution. See glm.nb in the MASS package. Aug 27, 2019 at 15:26

Since you are saying that your observations are not independent as they likely depend on the location, then I suppose you want to “adjust for location” (I.e. you want to include the effect of location on abundance and take into account the interaction between location and the other independent variable). To do so, you can use a multivariate model (linear, non-linear, depending on the one that best suites your data), where you incorporate the location among independent variables as a dummy variable (that takes the value of 1 if location is A and 0 if it is B). The abundance is the dependent variable. Estimate it, and test for the significance of the model. Once you do this and find that the model is significant, then look at the significance and sign of the coefficient for the location (dummy). If it is significantly different from 0 then there is significant association between the location and the abundance.