Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am carrying out a zero-inflated negative binomial GLM on some insect count data in R. My problem is how to get R to read my species data as one stacked column so as to preserve the zero inflation. If I subtotal and import it into R as a single row titled Abundance, I loose the zeros and the model doesn't work. Already, I have tried to:

stack the data myself (there are 80 columns * 47 rows) so with 3760 rows after stacking manually you can imagine how slow R gets when using the pscl zeroinfl() command (It takes 20mins on my computer!, It still worked)

The next problem concerns a spatial correlation. Certain samplers sampled from the same medium so as to violate independence. Can I just put medium in as a factor in the model?


share|improve this question
I basically have 80 species and 16 samplers (times three changes= 48 samplers). I had 4 sites with 4 samplers in each (but each pair of samplers in each site were sampling the same media) so hereth lie the problem. Excellent re: aggregating the data, as my data is overdispersed then a negative binomial glm will suffice then yes? – Platypezid Jul 14 '11 at 14:51
So, to summarize, 16 samplers in 4 sites, each pair of samplers sampled the same media (so 2 media per site). This was done 3 times. Richness, Evenness etc. can this all be analysed using a GLM also? overdispersion isn't an issue with sp. richness. – Platypezid Jul 14 '11 at 14:52
Show us a snippet of the data in the wide format as you have it. Your description isn't very clear to me what the data look like and how you want to have it stored in R – Gavin Simpson Jul 14 '11 at 15:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.