Martijn Vandegehuchte
2012-Feb-21 05:50 UTC
[R] mvabund package: errors using manyglm() and meanvar.plot()
Dear R users, I am trying to analyze multivariate abundance data using the mvabund package, but errors occur for several functions. I created a mvabund object named faunadat consisting of 8 dependent variables each containing 64 positive integer values (bact, fung, plant, omn, pred, orib, meso, spring). There are 4 factors: harv, rep, depth and lit. I then created a formula:>mvform<-mvformula(faunadat~harv*rep*lit+harv*rep*depth+harv*lit*depth+rep*lit*depth) When I try to create a mean-variance plot, I get the following error. I have checked and all the factors are the same length as the dependent variables.> meanvar.plot(mvform)Error in default.meanvar.plot.mvformula(x = x, n.vars = n.vars, var.subset = var.subset, : the dimensions of the variables do not match When I fit a multivariate linear model, there is no problem. All the following statements give the desired result.> lm<-manylm(mvform) > anova(lm,nBoot=500) > plot(lm)However, because these are count data, I am interested in fitting a generalized linear model instead, but then I get following error:> glm<-manyglm(mvform,family="negative.binomial") > anova(glm,nBoot=500)Error in XvarIn[nterms - i, varseq > i] <- 0 : (subscript) logical subscript too long Also, when trying to create diagnostics plots, I get the following error.> plot(glm)Error in plot.window(...) : need finite 'xlim' values In addition: Warning messages: 1: In default.plot.manyglm(x, which = which, caption = caption, overlay overlay, : You have passed an invalid number of variables 'n.vars' to be included in the plot. All variables will be included instead. 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf I know the manual says "The function is not yet available for manyglm object", but on the other hand in one of the examples provided in that same manual a residuals vs fitted values plot can be created for a manyglm object:> tasm.cop.nb <- manyglm(tasm.cop ~ block*treatment,family="negative.binomial")> plot(tasm.cop.nb)The design is unbalanced, I'm not sure whether that is part of the problem. Any help would be highly appreciated, MLV. [[alternative HTML version deleted]]