Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upgoodness.cca currently ignores choices argument #190
Comments
|
Referencing this issue and example in #189, any reason why you cannot have contributions to unconstrained axes? That is, beyond CCA |
|
@smikhaylov Maybe I wasn't thinking this through clearly enough... I suppose it makes no difference whether the particular linear combination is constrained or not when computing this, but the current code separates them into This is not to say that we couldn't |
|
I think either way would work fine. |
|
Dropping There are numerous examples how this has been done in vegan. Mere |
|
I opened up branch issue-#190 in vegandevs/vegan to put back
Some of these choices do differ from the pre-2.4-0 version. In old Both in the old and in the new proposed code, subsetting was only within the component and would not extend to, say, from constrained to unconstrained if |
|
I think it makes sense. Probably just needs adjusting documentation now. The use of devtools::install_github("vegandevs/vegan", ref = "4026ba4")
library(vegan)
words <- read_csv("words.csv")
env <- read_csv("env.csv")
cca <- cca(words ~ Idealpoint, data = env)
goodness(cca) #contribution to inertia on CCA1
goodness(cca, choices = 1:3) #produces only contribution to inertia on CCA1
goodness(cca, model = c("CCA", "CA"), choices=1:3) #produces only contribution to inertia on CCA1
#so to go for unconstrained axes you need to specify `model`
goodness(cca, model = "CA", choices=1:3)
#not specifying the `model` results in a warning message and null vector of results
goodness(cca, choices=2:3)
Warning message:
In sweep(CA, 1, tot, "/") :
STATS is longer than the extent of 'dim(x)[MARGIN]'So I think it works fine, just documentation needs to be adjusted, particularly about the |
As mentioned in the discussion surrounding #189, the
choicesargument it not used ingoodness.cca.It seems that in the transition from the old
goodness.ccacode to the one that wasgoodness2.ccathis functionality got lost. Originally we had:but this is not in the newer (current) version for the code.
This is clearly a bug, but do we want to return the original
choicesfunctionality or update the documentation.If we reinstate the functionality, it seems we need a better check that just not being
missing; in the example in #189 there is only a single constrained axis so asking forchoices = 1:3doesn't make sense.