[R] capscale/anova.cca issue

Frank Burbrink burbr|nk666 @end|ng |rom gm@||@com
Thu Sep 26 02:17:01 CEST 2019


I have what should be an easy question to answer I hope. I am using
Capscale and anovs.cca in vegan to examine relationship between genetic
distance among individuals to be predicted by several ecological niche
model distance matrices generated from Circuitscape and partialing out
distance in space (from lat/lon). I have done the following:

Converted all of the distances on the RHS using PCNM and used “scores” to
pull the scores from the PCNM results. My genetic distance is formatted as
a “dist” object on the LHS. The model looks as follows:


This works and so does:

anova(try, by=”terms)

However, when I used anova(try, by=”margin) I get this error:

Error in X[, ass != i, drop = FALSE] :

  (subscript) logical subscript too long

If I chose a smaller number of axes, then it will work but seems unstable
(P values change from significant to non-significant and vice versa) given
the number of axes I choose. This model works with anova(try, by=”margin”)
for instance:


If I increase the number axes to 50 then I get the same error as above.

What could be causing this error and is there way to get a stable answer
using anova.cca with margins?

I thank you very much in advance!



Here are some outputs from the reduced to the full axes model:

Call: capscale(formula = gendist ~ scores(cur) + scores(ms) + scores(el) +
scores(lgm) + scores(lig) + scores(mis19) +

Condition(scores(dist2)), sqrt.dist = T)

                 Inertia Proportion Rank

Total         30.3890110  1.0000000

Conditional   20.2125899  0.6651283  115

Constrained    9.9498632  0.3274165  118

Unconstrained  0.2551651  0.0083966    4

Imaginary     -0.0286072 -0.0009414    5

Inertia is Nei distance

Call: capscale(formula = gendist ~ scores(cur, choices = 1:20) + scores(ms,
choices = 1:20) + scores(el, choices = 1:20) +

scores(lgm, choices = 1:20) + scores(lig, choices = 1:20) + scores(mis19,
choices = 1:20) + Condition(scores(dist2, choices

= 1:20)))

              Inertia Proportion Rank

Total         10.1488     1.0000

Conditional    6.9685     0.6866   20

Constrained    3.1599     0.3114  120

Unconstrained  1.9522     0.1924   97

Imaginary     -1.9319    -0.1904   88

Inertia is squared Nei distance

Some constraints were aliased because they were collinear (redundant)


*Frank T. Burbrink, Ph.D.*

*Curator in Charge*
*Department of Herpetology*
*American Museum of Natural History*
*Central Park West at 79th Street*
*New York, NY 10024-5192*

*Website: https://sites.google.com/view/frank-burbrink-website/

	[[alternative HTML version deleted]]

More information about the R-help mailing list