R/alias.cca.R

`alias.cca` <-
    function (object, names.only = FALSE, ...) 
{
    if (is.null(object$CCA))
        stop("no constrained component, 'alias' cannot be applied")
    if (is.null(object$CCA$alias))
        stop("no aliased terms")
    if (names.only)
        return(object$CCA$alias)
    CompPatt <- function(x, ...) {
        x[abs(x) < 1e-06] <- 0
        class(x) <- "mtable"
        x[abs(x) < 1e-06] <- NA
        x
    }
    Model <- object$terms
    attributes(Model) <- NULL
    value <- list(Model = Model)
    R <- object$CCA$QR$qr
    R <- R[1:min(dim(R)), , drop = FALSE]
    R[lower.tri(R)] <- 0
    d <- dim(R)
    rank <- object$CCA$QR$rank
    p <- d[2]
    value$Complete <- if (is.null(p) || rank == p) 
        NULL
    else {
        p1 <- 1:rank
        X <- R[p1, p1]
        Y <- R[p1, -p1, drop = FALSE]
        beta12 <- as.matrix(qr.coef(qr(X), Y))
        CompPatt(t(beta12))
    }
    class(value) <- "listof"
    value
}

Try the vegan package in your browser

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

vegan documentation built on May 2, 2019, 5:51 p.m.