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?
 A: 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)

A: 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.
