Hi and thanks for any help re the below

This is a fairly complex question so I will attempt to ask it in a fairly basic manor.

I have data on the abundance of 99 different species of estuarine macroinvertebrate species and the sediment mud content (0 - 100 %) in which each observation was obtained. I have a total of 1402 observations for each species (i.e. a massive dataset).

Here is a subset of the raw data for one species to give you an idea of the data I'm working with (if I had 10 reputation points i'd upload a plot of real raw data:

Abundance: 10,14,10,3,3,3,3,4,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,12,0,0,0,34,0,0
Mud %:     0.9,4,2,10,13,14,6,5,5,7,22,27,34,37,47,58,54,70,54,80,90,65,56,7,8,34,67,54,32,1,57,45,49,4,78,65,45,35

The primary aim of my research is to determine an "optimum mud % range" (e.g. 15 - 45 %) and "distribution mud % range" (e.g. 0 - 80 %) for each of the 99 invertebrate species.

As you can see the abundance data for the above species contains a significant number of zero values. Although this significantly skews any sort of model that I run on the data (i.e. GLM, GAM), even if I model the non-zero data only, the model for certain species does not fit the data at all well.

So, my question is: what would be the best, most robust way to determine an "optimum" and "distribution" mud range for a given species, given that responses vary significantly between species?

  • $\begingroup$ I think you might get more answers if you ask this on Cross Validated. It is more a stat question than a programming quesion. Besides, I am not sure you want an optimum/distribution range for all species or for each species. $\endgroup$
    – Zhenglei
    Aug 13, 2013 at 9:55
  • $\begingroup$ Ok, thanks for the heads up there. Also, I mean for an individual species. $\endgroup$
    – brober
    Aug 13, 2013 at 10:07
  • $\begingroup$ Already asked, answered and answer accepted at stats.stackexchange.com/questions/67243/… $\endgroup$
    – Nick Cox
    Aug 31, 2013 at 18:06

1 Answer 1


I assume by distribution you mean the range of mud where at least 1 individual of a species occurs. If so than for the distribution range use


I don't know if you have a different abundance column for each species or a column which indicates the species name so I can't advise on getting all 99 ranges - but a loop or using an apply() type function should work

As for the optimum - there you need to decide what that means in terms of your data (95% of individuals are found in the range? Only include observations with 3 or more individuals? etc.). Once you have done this it will be more of a programming question .


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