Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in CCA object structure (saving Xbar, issue #227) #228

Merged
merged 34 commits into from
Mar 2, 2017

Conversation

jarioksa
Copy link
Contributor

@jarioksa jarioksa commented Feb 28, 2017

This PR changes the cca family result object as discussed in issue #227. Since ever, we have saved the working data matrix in up to three places: Fitted values for conditions in $pCCA$Fit, residual values after conditions in $CCA$Xbar and residual values after conditions and constraints in $CA$Xbar. Fitted values after constraints and the initial input values were not saved, but they had to be reconstructed, and reconstruction was impossible for initial values in partial db-RDA (dbrda). This PR makes change where we only save the initial input values as working matrices ($Ybar), and all other components can be derived from this with the provided support function ordiYbar. The major features of this PR:

  1. Fitted values are saved in item $Ybar at the top level.
  2. This PR still keeps the old Xbar and Fit items in pCCA, CCA and CA components. This increases the size of the result object, and these items are marked as deprecated in man/cca.object.Rd. However, removing these items will break CRAN package RVAideMemoire and cannot be done before consulting its maintainer.
  3. The PR provides support function ordiYbar() that can extract any of the old items. This function will work both with the suggested new code and old release code. Using ordiYbar() instead of directly accessing the old Xbar and Fit items will allow smooth working with the old result objects and maintain compatibility across vegan versions.
  4. All vegan functions use now ordiYbar.

Further issues and release plans are discussed in issue #227.

Jari Oksanen added 30 commits February 22, 2017 12:22
Answers RFC 227 of saving the input data only once instead of
having components pCCA$Fit, CCA$Xbar and CA$Xbar. This now saves
Ybar (renamed from Xbar) at the top level, but does not drop other
places of Fit/Xbar before support functions can handle the new
structure.
Works with the RFC #227 configuration which saves only the initial
input matrix. Does not yet work with dbrda.
also fixes return(NULL) for missing components
ordiYbar also works with old vegan ordination objects (without
warning)
type = "working" was earlier found from eigenvectors, but now we
use internal Ybar for pCCA, CCA and CA. The column dimensions
change: now they are equal to the number of real dimensions like
in the input data, but earlier they were equal to the number of
positive eigenvalues in the component. The resulting distances are
the same. Now we also have fitted for pCCA component.
The major change is that type = "response" is now found by
reverting Gower double standardization on internal Ybar component.
This will now also work for pCCA. Returned response is after internal
standardizations and will include Cailliez or Lingoes adjustment
instead of being the input. With sqrt.dist = TRUE it will also be
the sqrt.

This is an end of the day version subject to further testing and
thinking.
now allows analysis of partial dbrda with proportional = TRUE
stressplot.dbrda works now with partial models, because we can
can re-construct input dissimilarities.
This will fail in general. For instance, with only a factor constraint,
fitted distances will be zero and removing adjustment will make these
negative.
- the cca.object structure changed: Ybar is at the main level.
  At this stage, there are still redundant pCCA$Fit, CCA$Xbar and
  CA$Xbar items, but these will be deprecated or removed.
- New Ybar structure incidentally fixes tolerance.cca which could
  give erroneous above-zero tolerance for species that occur only
  once and should have tolerance=0. The numerical precision was
  improved with the new Ybar version, but these wrong tolerances can
  still occur with useN2=TRUE when the original tolerance is nearly
  zero and estimated N2 is nearly one and tol/(1-N2) can be anything.
Jari Oksanen added 4 commits February 28, 2017 11:07
The ordination function still return pCCA$Fit, CCA$Xbar and CA$Xbar
but they may be removed any time, even before the CRAN release of
2.5-0 if this looks safe. We provide function ordiYbar() that can
find these items both from the new and old ordination objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant