Skip to main content
added 204 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94

I guess you are on the right track, but I am not familiar with your data and study site and, so I can't be sure. I can be sure that your terminology is not quite right. You can't use the numbers in your last row study site as expected counts because they are estimated probabilities adding to $1.$

One-category chi-squared test in R. In the R procedure chisq.test, there is provision for a parameter p of probabilities against which counts x are to be compared.

Not enough data for Species 1. So if I guess correctly what you have done to get the vector study.site, and if the counts in species. are indeed not randomly distributed, I might expect chisq.test to reject. However, there is a difficulty. You have only 158 specimens in Species 1, with none at all in many communities.

Combine communities or species? A common remedy for such sparse data is to combine categories (communities). If some communities are adjacent, then it might make sense to combine them. You might also consider whether it is appropriate to combine counts for several species, especially of some species are similar to others.

Simulated P-value for sparse data. Another remedy, for the implementation of chisq.test in R, is to let let the program simulate a P-value, but we still don't get a rejection with simulation.

Somewhat better results with higher counts. Trying again for Species 6, which has more specimens. This time we reject at at the 10% level, not at the 5% level.

I guess you are on the right track, but I am not familiar with your data and study site and I can't be sure. I can be sure that your terminology is not quite right. You can't use the numbers in your last row study site as expected counts because they are estimated probabilities adding to $1.$

In the R procedure chisq.test, there is provision for a parameter p of probabilities against which counts x are to be compared.

So if I guess correctly what you have done to get the vector study.site, and if the counts in species. are indeed not randomly distributed, I might expect chisq.test to reject. However, there is a difficulty. You have only 158 specimens in Species 1, with none at all in many communities.

A common remedy for such sparse data is to combine categories (communities). If some communities are adjacent, then it might make sense to combine them. You might also consider whether it is appropriate to combine counts for several species, especially of some species are similar to others.

Another remedy, for the implementation of chisq.test in R, is to let let the program simulate a P-value, but we still don't get a rejection with simulation.

Trying again for Species 6, which has more specimens. This time we reject at at the 10% level, not at the 5% level.

I guess you are on the right track, but I am not familiar with your data and study site, so I can't be sure. I can be sure that your terminology is not quite right. You can't use the numbers in your last row study site as expected counts because they are estimated probabilities adding to $1.$

One-category chi-squared test in R. In the R procedure chisq.test, there is provision for a parameter p of probabilities against which counts x are to be compared.

Not enough data for Species 1. So if I guess correctly what you have done to get the vector study.site, and if the counts in species. are indeed not randomly distributed, I might expect chisq.test to reject. However, there is a difficulty. You have only 158 specimens in Species 1, with none at all in many communities.

Combine communities or species? A common remedy for such sparse data is to combine categories (communities). If some communities are adjacent, then it might make sense to combine them. You might also consider whether it is appropriate to combine counts for several species, especially of some species are similar to others.

Simulated P-value for sparse data. Another remedy, for the implementation of chisq.test in R, is to let let the program simulate a P-value, but we still don't get a rejection with simulation.

Somewhat better results with higher counts. Trying again for Species 6, which has more specimens. This time we reject at at the 10% level, not at the 5% level.

added 605 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94

A common remedy for such sparse data is to combine categories (communities). If some communities are adjacent, then it might make sense to combine them. You might also consider whether it is appropriate to combine counts for several species, especially of some species are similar to others.

 chisq.test(species.1, study.site, sim=T)

         Pearson's Chi-squared test 
         with simulated p-value 
         (based on 2000 replicates)

data:  species.1 and study.site
X-squared = 38.333, df = NA, p-value = 0.1644

Trying again for Species 6, which has more specimens. This time we reject at at the 10% level, not at the 5% level.

species.6 = c(24, 78, 0, 0, 7, 2, 5, 0, 19, 242)
chisq.test(species.6, study.site, sim=T)

        Pearson's Chi-squared test 
        with simulated p-value 
        (based on 2000 replicates)

data:  species.6 and study.site
X-squared = 54.444, df = NA, p-value = 0.07696

A common remedy for such sparse data is to combine categories (communities). If some communities are adjacent, then it might make sense to combine them.

 chisq.test(species.1, study.site, sim=T)

         Pearson's Chi-squared test 
         with simulated p-value 
         (based on 2000 replicates)

data:  species.1 and study.site
X-squared = 38.333, df = NA, p-value = 0.1644

A common remedy for such sparse data is to combine categories (communities). If some communities are adjacent, then it might make sense to combine them. You might also consider whether it is appropriate to combine counts for several species, especially of some species are similar to others.

 chisq.test(species.1, study.site, sim=T)

         Pearson's Chi-squared test 
         with simulated p-value 
         (based on 2000 replicates)

data:  species.1 and study.site
X-squared = 38.333, df = NA, p-value = 0.1644

Trying again for Species 6, which has more specimens. This time we reject at at the 10% level, not at the 5% level.

species.6 = c(24, 78, 0, 0, 7, 2, 5, 0, 19, 242)
chisq.test(species.6, study.site, sim=T)

        Pearson's Chi-squared test 
        with simulated p-value 
        (based on 2000 replicates)

data:  species.6 and study.site
X-squared = 54.444, df = NA, p-value = 0.07696
added 605 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94

This means you do not have enough data for the chi-squared test to work properly. In particular, R is finding 'expected counts' for various communities, and too many of them are below the minimum required (some authors say all should be above 5, others say most should be above 5 and all should be above 3.) The technical difficulty is that the chi-squared statistic has only approximately a chi-squared distribution, and a good approximation requires a certain amount of data.

Another remedy, for the implementation of chisq.test in R, is to let let the program simulate a P-value, but we still don't get a rejection with simulation.

 chisq.test(species.1, study.site, sim=T)

         Pearson's Chi-squared test 
         with simulated p-value 
         (based on 2000 replicates)

data:  species.1 and study.site
X-squared = 38.333, df = NA, p-value = 0.1644

This means you do not have enough data for the chi-squared test to work properly. In particular, R is finding 'expected counts' for various communities, and too many of them are below the minimum required (some authors say all should be above 5, others say most should be above 5 and all should be above 3.)

This means you do not have enough data for the chi-squared test to work properly. In particular, R is finding 'expected counts' for various communities, and too many of them are below the minimum required (some authors say all should be above 5, others say most should be above 5 and all should be above 3.) The technical difficulty is that the chi-squared statistic has only approximately a chi-squared distribution, and a good approximation requires a certain amount of data.

Another remedy, for the implementation of chisq.test in R, is to let let the program simulate a P-value, but we still don't get a rejection with simulation.

 chisq.test(species.1, study.site, sim=T)

         Pearson's Chi-squared test 
         with simulated p-value 
         (based on 2000 replicates)

data:  species.1 and study.site
X-squared = 38.333, df = NA, p-value = 0.1644
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94
Loading