[R-sig-eco] Two questions about "vegan"

Jari Oksanen jari.oksanen at oulu.fi
Tue Apr 20 19:47:50 CEST 2010


Dear Omid Paknia,

On 20/04/10 18:41 PM, "o paknia" <opaknia at yahoo.com> wrote:

> my first question is about "adonis" function. Is it proper to use
> non-parametric multivariate by this function for a data-frame, not for a data
> matrix?

Yes, data frame will work (you can try this).

> My response variable is simply a column of species number for different plots.
> Now I am looking for a correct way to analysis the its variance by a
> multivariate explanatory data.
>
So you have only one dependent variable? You can turn this into
dissimilarities or distances, but this sounds a bit unnatural to my taste.
You could use some other methods that can cope with univariate dependent
variables, such as lm, glm, gam...
 
> The second question is about variation partitioning and rda with another data
> set. 
> Applying "varpart" for variation partitioning, I would like to have a
> biplot for [a] or
> [c] fractions. I have done partial canonical analysis for these
> fractions, and I got the
> site scores and species scores, but testing the significance of rda axes by
> "anova" 
> was not possible for these fractions as I had "Condition" in my formula. Note
> that (as I know) testing the significance of axes by anova.cca is only
> possible 
> for models fitted only using formula. There are several examples in different
> vegan's manuals but in these examples there is only one explanatory matrix,
> however, I have two explanatory matrices: space and environment.  environment
> = temp + rain + hum, space = var1, var2, var3

Two comments comments:
1) a matrix (but not a data frame!) can be a term in an rda (or cca)
formula: see the example in the documentation of varpart which explicitly
says so.
2) you can have anova.cca(..., by = "axis") in partial models with Condition
in the formula. 

You can try

r <- rda(decostand(com, "hell") ~ as.matrix(environment) +
Condition(as.matrix(space)))
anova(r, by = "axis")

Please remember that data.frame won't work, and therefore you may need the
explicit cast to matrix.

If you have factors in your environmental variables, you need to use

r <- rda(decostand(com, "hell") ~ . + Condition(as.matrix(space)),
environment)

where "." in the rhs of the formula expands to all variables of
data=environment with appropriate handling of factors.

> Below you find what I have written and what I have got:
> 
> r1<-rda(decostand(com, "hell"),environment,space)
> anova(r1,by="axis",alpha=0.05,perm=2000)
> Error in anova.ccabyaxis(object, alpha = alpha, beta = beta, step = step,  :
> Analysis is only possible for models fitted using formula
> 
> Writing the model as formula, I got another error message:
>    
> r1<-rda(decostand(com, "hell")~rain+temp+hum,environment,space)
> Error in scale.default(X, center = TRUE, scale = scale) : length of 'scale'
> must equal the number of columns of 'x'
> 
The third argument of rda.formula is 'scale', so that your model expands to

rda(fomrula = decostand(comm, "hell") ~rain+temp+hum, data = environment,
scale = space)

It is this setting scale = space that causes the error message you got from
scale.default. 
 
HTH, Jari Oksanen



More information about the R-sig-ecology mailing list