-
Notifications
You must be signed in to change notification settings - Fork 97
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
save dependent data matrix only once in constrained ordination object #227
Comments
Works with the RFC #227 configuration which saves only the initial input matrix. Does not yet work with dbrda.
I have opened a new branch ordination-Xbar-issue-#227 which implements this change. At the first stage, I have
The current function allows using updated functions both with the newly created and legacy result objects. Currently the legacy result objects are handled silently and my plan is to handle them silently in the first release (2.5-0). In later releases, the old style functions are handled with a warning that urges users to update the objects, and finally we remove the compatibility function completely. In most cases the old object |
The suggested change will be made in PR #228. This is the first step, and still keeps the old structure so that now the working data may be saved in four versions. The removal of PR #228 provides function My plan is to have the new structure in vegan 2.5-0 (with no scheduled release date). I think we need to keep the old superfluous (and large!) items till other functions can adapt to the change, although vegan won't touch those items any longer. There will be legacy result objects around for a long time (i.e., created with previous versions of vegan and saved in the workspace), but
Comments? |
Change in CCA object structure (saving Xbar, issue #227)
Merging of PR #228 closes the implementation part of this issue. The transition strategy part is still open. |
Function |
TODO: run package tests against dependent packages to find the maintainers of dependent packages that need to be pre-alerted for the change. |
Vegan 2.5-0 will still be compatible with the old object structure. The old |
We have warned on this move since vegan 2.4-3 and provided tools (ordiYbar) to find these elements both in the old and current versions of vegan. In initial tests back then RVAideMemoire package accesses these items directly, but it was fixed soon after this change. See github issue #227.
I suggest to simplify the internal structure of
"cca"
object by saving the analysed dependent data only once. Currently we have up to three versions of the same data in the ordination objectx
:x$pCCA$Fit
: fitted values for partial termsx$CCA$Xbar
: residual values after partial termsx$CA$Xbar
: residual values after partial terms and constraintsAll these matrices can be found from the original matrix with appropriate QR decomposition item using
qr.fitted()
andqr.resid()
. We do it already now: very often we need the fitted values after constraints (and conditions) that we have not saved, but we need to find it asqr.fitted(x$CCA$QR, x$CCA$Xbar)
. Using QR decomposition is pretty cheap: we do it several times in each permutation ofanova.cca
&permutest.cca
already now. So we could have considerable saving of result object sizes with little cost on time by saving only the original adjusted matrix and using QR operations when needed. Currently that transformed dependent matrix is returned byinitXXXX()
functions inR/ordConstrained.R
.A more severe problem is that we sometimes need the original transformed matrix prior to any partial terms or constraints. In most cases we can get that as
x$pCCA$Fit + x$CCA$Xbar
, but that does not work fordbrda()
, and therefore several must be disabled for partial db-RDA. Saving the original input data (afterinitDBRDA()
) would solve all these problems.The only problem that I see with this is that the
"cca"
class result object will change, and this means that several support functions need to be changed. We also need to check that this does not break other packages using vegan, and alert their maintainers if necessary. The current"cca"
structure is not a result of very thorough consideration: I just happened to writecca.default()
this way in 2002, and since then other functions have been adopted to this structure.In vegan the following functions must be adopted to this suggested change:
fitted
methodsgoodness.cca
(now enabled for partialdbrda
)inertcomp
(now enabled fordbrda
)mso
(never implemented fordbrda
)permutest.cca
(model = "direct"
enabled for partialdbrda
)predict.rda
simulate
methods (not implemented fordbrda
)stressplot
methods (now enabled for partialdbrda
)tolerance.cca
(only meaningful forcca
)The text was updated successfully, but these errors were encountered: