0
$\begingroup$

I'd like to model the response of three species functional groups (proportion of total abundance) to different environmental gradients. I thought a multiple linear regression could work well, but now I heard that I should use multiple logistic regression, because my response variable (proportion of total counts) is bounded between 0 and 1. However, when I try to perform logistic regression in R with my data, I have the following error message:

In eval(family$initialize): non-integer #successes in a binomial glm!

More specifically, here is my very simple code:

test_clusters <- read.table(clusters.txt)

head(test_clusters, 3)# checking data

    Cluster1   Cluster2  Cluster3  PC1_soil  PC2_soil precip  disturb
P2 0.8297214 0.01857585 0.1517028  2.200434 0.5114511    647 51.98126
P4 0.3196347 0.04109589 0.6392694 -1.016489 1.9255986    591 16.47774
P7 0.7352941 0.03361344 0.2310924  2.479751 0.6501704    516 20.30064

## test_clusters[,1:3] are the proportional abundance of each cluster, while [,4:7] are the predictor (environmental) variables

## Trying to perform multiple logistic regression to test the response of each cluster to the environmental gradients

model <- glm (Cluster1 ~ PC1_soil + PC2_soil + precip + disturb,
              data = test_clusters, family = binomial(link="logit"))

Then I have the error message commented above:

In eval(family$initialize): non-integer #successes in a binomial glm!

Someone know what's the problem? Any other suggestion about the more appropriate test for this kind of data would valuable.

$\endgroup$
5
  • 4
    $\begingroup$ Your difficulty is that logistic regression requires a 0/1 response variable, not one that is in $[0,1]$. I think beta regression is more what you'll need, perhaps the betareg package: cran.r-project.org/web/packages/betareg/betareg.pdf $\endgroup$
    – jbowman
    Oct 26, 2017 at 18:50
  • $\begingroup$ If you have the counts (not just the proportions) you could perhaps use the multinomial Poisson transformation, see math.ntnu.no/inla/r-inla.org/papers/multinomial-poisson.pdf. $\endgroup$ Oct 26, 2017 at 19:30
  • 2
    $\begingroup$ You say your response variable is a "proportion of total counts", do you know the constituent counts (hits, & totals)? $\endgroup$ Oct 26, 2017 at 19:30
  • $\begingroup$ yes, I know the constituent counts.. $\endgroup$
    – Bxpinho
    Oct 30, 2017 at 15:34
  • $\begingroup$ If you have the counts, then just do a binomial regression. See the help for glm for how to specify the dependent variable. $\endgroup$ Aug 27, 2018 at 19:10

1 Answer 1

1
$\begingroup$

You get the warning (not error) because you did not use the weight argument to glm with the binomial family and a 1 dimensional outcome variable that is in the $(0,1)$ range.

Do you know the total population for each Cluster1 fraction? If so, use this as the weight argument. Though, I may have misunderstood your problem.

$\endgroup$
3
  • $\begingroup$ Thank you very much, I'm going to try to use the weight function and then I will give you a feedback. $\endgroup$
    – Bxpinho
    Oct 30, 2017 at 15:36
  • $\begingroup$ Actually, it did not works, and the same message occurs. I'm not sure if I have understood prety well. I used the total count for the population as the weight. So, if cluster 1 fraction is 0.5 for a community with 100 individuals, the total population (weight) is 50... Is that correct? $\endgroup$
    – Bxpinho
    Oct 30, 2017 at 16:51
  • 2
    $\begingroup$ No then the weight should be 100. The warnings comes when m <- weights * y; any(abs(m - round(m)) > 0.001). I.e., a rough test for whether weight times the outcome is an integer. $\endgroup$ Nov 1, 2017 at 20:59

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.