0
$\begingroup$

I am analyzing an ecological dataset in R and try to answer the following question: which environmental variables have an effect on the diversity of the community that we observed?

Diversity is measured via continuous indices. We collected both continuous and categorical environmental variables, e.g. age and a grouping variable with 4 factors "group". I would also like to adjust for the impact of a dichotomous variable, let's call it a. To analyze the effect of group on diversity, my approach now is as follows:

fit = lm(log(index) ~ a + group))
anova(fit)

My current understand is that anova() gives the overall effect of group, while lm compares each level of group to the reference level. This seems fine and appropriate to answer my question. However, I'm not sure if the way I adjust for the confounder a is correct.

If it is, I still struggle to interpret the p-value for a (the confounder) that is returned by anova(). If "group" is significant, but a is not, can I infer that I might as well remove a from the model?

$\endgroup$

1 Answer 1

1
$\begingroup$

Hopefully things become a bit easier if you look at the linear model as a linear regression. Your fit equation can be read as a linear model, in which the log of index is to be computed as a sum of some constant, a value for one of the levels of a and a value for each of the levels of group.

summary(lm(log(index) ~ a + group)))

a not being significant from this point of view just means, that although the model has estimated a coefficient for a there is no proof of the true coefficient being different from zero. Measurement error and number of observations do not add to significance. Though that can be taken as a reason to not include a in the model anymore, it is by far no proof that a does not improve the model. Actually you probably included a for a reason. You have other, non-statistical, reasons to believe a may be of importance and that a non-significant estimate of a is still better then disregarding a altogether. In that case, leave a in the model, even if the model itself can not proove the need for knowing a.

$\endgroup$
2
  • $\begingroup$ Thank you for helping to clear things up. Would you suggest applying an anova still makes sense? I'm a little uncertain because p values for "a"change slightly depending on the method. $\endgroup$
    – mucl
    Commented Aug 30, 2020 at 16:50
  • $\begingroup$ You should use ANOVA if that answers your question. I do not understand what "method" exactly changes your p. However, p values are random numbers. Do not overestimate slight changes unless they cross the magical value (I.e. .05). $\endgroup$
    – Bernhard
    Commented Aug 30, 2020 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.