fastrda (version 0.3.0)
Bug fixes
- Predictor biplot scores (
biplot_scores(),
biplotrda(), plot(), and
biplot()) now match vegan across all scalings
(0–3) for both standard and partial RDA. Previously:
- Without a user-supplied
X, biplot_scores()
returned scaled canonical regression coefficients
(lc_coefficients_raw / mults) instead of correlations,
causing incorrect arrow directions, tiny magnitudes, and dependence on
predictor measurement units.
- With a user-supplied
X, scaled sample scores (including
the general scaling constant const) were used, inflating
predictor arrows by const in scalings 1–3.
- For partial RDA,
X was residualized on
covariates before computing biplot scores, whereas standard
RDA biplot scores (and vegan) use the centered,
un-residualized predictors.
fastrda_cpp() now precomputes and stores
biplot_raw (correlations between centered, un-residualized
predictors and unit-norm sample scores) without extra memory overhead,
and biplot_scores() scales biplot_raw by
1, slam, 1, and
sqrt(slam) for scalings 0, 1, 2, and 3 respectively
(without const). The covariates argument in
biplot_scores() and biplotrda() is now ignored
and retained only for backward compatibility.
- Permutation test for partial RDA (
anova() /
anova_fastrda() with covariates)
fixed. Version 0.2.x was anti-conservative because the
Z-component created in the permuted residuals was never removed. The
default is now the "permute-x" scheme: the residualized
response is kept fixed and, in every permutation, the rows of the
centered predictors are permuted and re-residualized on the covariates.
A Freedman-Lane-type reduced-model permutation is also available via
anova_fastrda(..., scheme = "freedman-lane") (note that
Freedman-Lane is conservative when the number of responses
p is large). Without covariates both schemes are identical.
Permutation p-values of partial-RDA fits obtained with earlier
versions should be recomputed.
predict(newdata = , type = "lc") returned scores on the
wrong scale (sqrt((n - 1) * lambda_k) times too large). It
now agrees with the in-sample scores.
- Sample scores for
scaling = 1 and
scaling = 3 are now scaled by
sqrt(lambda_k / total inertia) and its square root, the
same factors that were already used for the response scores in scalings
2 and 3; previously sqrt(lambda_k) and
lambda_k^(1/4) were used, which differed by factors of
sqrt(total inertia) and
total inertia^(1/4).
predict(newdata = ) for partial RDA fits ignored the
covariates: the coefficients refer to predictors residualized on the
covariates, but raw newdata was used.
predict() now has a covariates argument,
required for partial fits, and residualizes newdata with
the regression of the predictors on the covariates estimated in the fit
(stored as Z_coef). Values returned for
type = "response" are the predictor-explained part, as for
the in-sample fitted values. Fits created with earlier versions must be
refitted.
predict(type = "response") without newdata
returned values on the centred and scaled scale when
store_fitted = TRUE but on the original scale when
store_fitted = FALSE. Both now return the original scale,
as newdata does. (fit$fitted itself still
holds the centred/scaled fitted values.)
eigenvalues, prop_total and
prop_constrained are returned as plain named vectors
instead of n x 1 matrices.
Changes
- Replaced
scores() /
scores.fastrda() with
fastrda_scores() so that loading
fastrda no longer masks vegan::scores().
- Exported
get_site_scores in NAMESPACE to
match the documentation.
keep_workspace is now a single on/off switch with
default TRUE. The previous values "minimal",
"compact" and "full" are kept as synonyms of
TRUE; "none" is a synonym of
FALSE.
- The workspace returned by
fastrda() now also holds the
orthonormal basis Qz of the covariates and Xc
(the centered predictors before removal of covariates). Partial-RDA fits
created with earlier versions must be refitted before running
permutation tests.
anova_fastrda() now checks that Y_res,
Qz, and Xc (when needed) are present in the
workspace.
print.fastrda(): the Rank column of the
constrained row now shows df_model, not the number of
retained axes.
- Axis-wise tests are described as unconditional tests of each ordered
eigenvalue.
- Documentation (
fastrda.Rd, biplotrda.Rd),
vignette, README.md, and test suite updated.