R/coef.rda.R

`coef.rda` <-
    function (object, norm = FALSE, ...)
{
    if(is.null(object$CCA))
        stop("unconstrained models do not have coefficients")
    Q <- object$CCA$QR
    u <- object$CCA$u
    ## scores.cca uses na.predict and may add missing NA rows to u,
    ## but Q has no missing cases
    if (nrow(Q$qr) < nrow(u) && inherits(object$na.action, "exclude"))
        u <- u[-object$na.action,, drop=FALSE]
    b <- qr.coef(Q, u)
    if (norm)
        b <- sqrt(colSums(qr.X(Q)^2)) * b
    b
}

Try the vegan package in your browser

Any scripts or data that you put into this service are public.

vegan documentation built on Oct. 11, 2022, 5:06 p.m.