1
$\begingroup$

My dataset describes the presence/absence of an animal in a number of different plant species. Below is a table of plant species Vs animal presence/absence, i.e each row show the number of animal presence/absence records I have for each plant species.

Question: What are my analysis options here for looking at the association between animal presence/absence and plant species?

Keep in mind that my outcome variable is animal presence/absence and I am interested in the odds of animal presence across the 32 plant species. I am also looking at how other variables influence animal presence/absence.

My original plan was to use logistic regression. However, I have many instances were there are animal absence records for a particular plant species but there are no animal presence records for the same plant species. This creates separation issues when attempting to run logistic regression. In addition, plant species is a factor variable with many levels, which again presents its own challenges. What are my analytical options given these two constraints/challenges? One option would be to conduct a logistic regression on a subset of my data for which I have both animal presence/absence records for each plant species. However, in doing this I lose information on many plant species that were available for use by the animal but not used.

Thoughts appreciated.

$$\begin{array}{c|c|c|} \text{Plant species} & \text{Animal absence} & \text{Animal presence} \\ \hline \text{Species 1} & 6 & 0 \\ \hline \text{Species 2} & 4 & 1 \\ \hline \text{Species 3} & 144 & 7 \\ \hline \text{Species 4} & 7 & 2 \\ \hline \text{Species 5} & 14 & 0 \\ \hline \text{Species 6} & 36 & 0 \\ \hline \text{Species 7} & 18 & 0 \\ \hline \text{Species 8} & 4 & 0 \\ \hline \text{Species 9} & 22 & 0 \\ \hline \text{Species 10} & 243 & 1 \\ \hline \text{Species 11} & 3 & 0 \\ \hline \text{Species 12} & 10 & 1 \\ \hline \text{Species 13} & 23 & 7 \\ \hline \text{Species 14} & 1 & 0 \\ \hline \text{Species 15} & 30 & 3 \\ \hline \text{Species 16} & 8 & 1 \\ \hline \text{Species 17} & 69 & 5 \\ \hline \text{Species 18} & 116 & 18 \\ \hline \text{Species 19} & 33 & 18 \\ \hline \text{Species 20} & 4 & 3 \\ \hline \text{Species 21} & 33 & 3 \\ \hline \text{Species 22} & 19 & 1 \\ \hline \text{Species 23} & 37 & 12 \\ \hline \text{Species 24} & 53 & 1 \\ \hline \text{Species 25} & 92 & 44 \\ \hline \text{Species 26} & 54 & 3 \\ \hline \text{Species 27} & 36 & 0 \\ \hline \text{Species 28} & 31 & 0 \\ \hline \text{Species 29} & 1 & 0 \\ \hline \text{Species 30} & 49 & 5 \\ \hline \text{Species 31} & 4 & 0 \\ \hline \text{Species 32} & 56 & 0 \\ \hline \end{array}$$

$\endgroup$
2
  • $\begingroup$ Do you care about presence/absence for each individual species, or do you just want an estimate of the distribution of the odds of presence among the set of 32 species? Please add that information by editing the question, as comments are easy to overlook and can be deleted. Also please replace if possible the image of the table of values with text-based tabular data. You can paste a text table into your question, select it, then use the {} code tool to format it in a way that allows others to "see" it via text-to-speech and also to play with your data. $\endgroup$
    – EdM
    Jun 29, 2022 at 17:52
  • $\begingroup$ Please see edited question $\endgroup$ Jun 29, 2022 at 23:37

1 Answer 1

1
$\begingroup$

You could consider treating Plant species as a random effect in your model. That nicely handles a multi-level categorical predictor and effectively weights those levels in the analysis in terms of the total number of observations. With your data it also removes the perfect separation. I simplified the names a bit, with Species for Plant species and simply Presence and Absence for the Animal observations, in a data frame called spData:

library(lme4)
mod1<-glmer(cbind(Presence,Absence)~ (1|Species),data=spData,family=binomial)
summary(mod1)
## some lines omitted
# Random effects:
#  Groups  Name        Variance Std.Dev.
#  Species (Intercept) 1.947    1.396   
# Number of obs: 32, groups:  Species, 32
# 
# Fixed effects:
#             Estimate Std. Error z value Pr(>|z|)    
# (Intercept)   -2.941      0.345  -8.524   <2e-16

That (Intercept) is the estimate of the overall log-odds of Animal Presence. The high Variance of the Species random intercept is consistent with the wide ratio of Presence to Absence seen in your data.

The "random effects" for each Plant Species around that overall estimate are available from ranef(mod1) and their individual log-odds estimates from coef(mod1).

This type of model nicely extends to incorporation of how other variables might affect Presence.

Approaches to perfect separation in general are discussed in detail on this page. In your situation I think that treating the plant Species as a random effect, with each Species effectively representing a choice from a large underlying set of possible species, makes the most sense.

See this page for how the random-effect model provides shrinkage (in a different way from the suggestions for Firth or ridge penalization) to deal with perfect separation. See this page for how random-effect modeling (based on an underlying Gaussian distribution of random effects) is closely related to the Bayesian modeling suggested as an approach to handling perfect separation.

$\endgroup$

Your Answer

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

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