[R-sig-eco] interpreting 0s and 1s from manyglm from mvabund

David Warton david.warton at unsw.edu.au
Tue Mar 17 03:28:42 CET 2015


Dear R-sig-eco list,
I promised you a follow-up on Beth's problem from a few weeks ago with test statistics identically equal to zero.

The issue was that a count model (negative binomial) was being fitted to data that were not counts, in fact they were proportions that typically took values less than 0.01.  manyglm is quite aggressive with its rounding and in effect it treated most of these values as zero.  The solution is to use a different model - for biomass data, for example, a better option would be the tweedie distribution, via the manyany function (but get mvabund from R-Forge for this one).

On the other hand if you want to model relative abundance (hence the proportions) you could include a row effect in the model (an option in manyany, but super-slow), or as a quick-and-dirty approximation I've often found an offset equal to log(row-sum) does the trick.

All the best
David

 
David Warton
Professor and Australian Research Council Future Fellow
School of Mathematics and Statistics and the Evolution & Ecology Research Centre
The University of New South Wales NSW 2052 AUSTRALIA
phone (61)(2) 9385-7031
fax (61)(2) 9385-7123
 
http://www.eco-stats.unsw.edu.au/ecostats15.html



-----Original Message-----
From: David Warton 
Sent: Friday, 27 February 2015 12:29 PM
To: r-sig-ecology at r-project.org
Subject: RE: [R-sig-eco] interpreting 0s and 1s from manyglm from mvabund


Hi Elizabeth,
Wow, that's weird - could you send me the data/code (and R/mvabund version you used)?  I'll see if I can reproduce the problem.  My best guess at this stage is that there was something in the data that it didn't like and returned NaN's for everything (which were misleadingly translated into 0's and 1's in the anova table) 

Maybe we could sort it out communicating directly then get back to the mailing list with a report on how things went afterwards? (I assume that's the protocol?) All the best David


Date: Wed, 25 Feb 2015 13:43:40 -0500
From: Elizabeth Pringle <epringle at umich.edu>
To: r-sig-ecology at r-project.org
Subject: [R-sig-eco] interpreting 0s and 1s from manyglm from mvabund
Message-ID:
	<CAB6Dt_7Ka8cbVf6y6pEK=YZMyaPFPjh9uSx=BsBORdg3---xOg at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hi,

I am using code that worked beautifully to analyze a previous dataset using manyglm in mvabund on a new dataset, and I am consistently getting results of Dev = 0 and Pr(>Dev)=1 for both multivariate and univariate tests. My plots do not indicate any particularly strong pattern in the data, so I am tempted to interpret this as a non-significant result...but I wanted to make sure it doesn't just indicate that I've somehow input the data incorrectly. Especially since I get a bunch of NAs and NaNs farther down the line if I go through my whole pipeline.

Code follows:
>glm.sug<-manyglm(dat~trtment,family="negative.binomial")
>results<-anova(glm.sug,resamp="pit.trap",p.uni="adjusted")
>results (here's where I see 0s and 1s)
>results$table
                 Res.Df Df.diff Dev Pr(>Dev)
(Intercept)          15      NA  NA       NA
trtment               14       1   0        1
> s=sort(results$uni.test[2,],index.return=T,decreasing=T)
> s$x[1:3]/sum(s$x)
        X..1          X.2        X..3
       NaN        NaN        NaN

Many thanks,
Beth

--
****************************************************
Elizabeth G. Pringle
Michigan Society of Fellows
****************************************************

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list