Learn R Programming

anacor (version 1.1-4)

anacor: Simple and Canonical Correspondence Analysis

Description

This function performs simple and canonical CA for possibly incomplete tables based on SVD. Different scaling methods for row and column scores are provided.

Usage

anacor(tab, ndim = 2, row.covariates, col.covariates, scaling = c("Benzecri","Benzecri"), 
ellipse = FALSE, eps = 1e-06)

# S3 method for anacor print(x,...)

Arguments

tab

Data frame of dimension n times m with frequencies. Missings are coded as NA.

ndim

Number of dimensions.

row.covariates

Matrix with n rows containing covariates for the row scores.

col.covariates

Matrix with m rows containing covariates for the column scores.

scaling

A vector with two elements. The first one corresponds to the method for row scaling, the second one for column scaling. Available scaling methods are "standard", "Benzecri", "Goodman".

ellipse

If TRUE, confidence ellipses are computed.

eps

Convergence criterion for reconstitution algorithm.

x

Object of class "anacor" in print.anacor.

Additional arguments ignored.

Value

row.scores

Scaled row scores.

col.scores

Scaled column scores.

ndim

Number of dimensions extracted.

chisq

Total chi-square value.

chisq.decomp

Chi-square decomposition across dimensions with p-values.

singular.values

Singular values without trivial solution.

se.singular.values

Standard errors for the singular values.

stestmat

Test results for singular values (only for ellipse = TRUE).

left.singvec

Left singular vectors without trivial solution.

right.singvec

Right singular vectors without trivial solution.

eigen.values

Eigenvalues for the fitted dimensionality.

eigenvall

Full vector of eigenvalues (principal inertias).

datname

Name of the dataset.

tab

Table with imputed frequencies in case of missings.

row.covariates

Matrix with row covariates.

col.covariates

Matrix with column covariates.

scaling

Scaling Method.

bdmat

List of matrices with observed and fitted Benzecri distances for rows and columns.

rmse

Root mean squared error of Bezencri distances (rows and columns).

row.acov

Covariance matrix for row scores.

col.acov

Covariance matrix for column scores.

cancoef

List containing canonical coefficients (CCA only).

sitescores

List containing the site scores (CCA only).

isetcor

List containing the intraset correlations (CCA only).

Details

Missing values in tab are imputed using the reconstitution algorithm. Setting scaling to "standard" leads to standard coordinates. Principal coordinates can be computed by means of Benzecri decomposition. Goodman scaling is based on Fisher-Maung decomposition.

For large datasets it is suggested to set ellipse = FALSE. If ellipse = TRUE, make sure that there are no rows and columns that have full 0 entries.

References

De Leeuw, J. and Mair, P. (2009). Simple and Canonical Correspondence Analysis Using the R Package anacor. Journal of Statistical Software, 31(5), 1-18. https://www.jstatsoft.org/v31/i05/

See Also

plot.anacor

Examples

Run this code
# NOT RUN {
## simple CA on Tocher data, symmetric standard coordinates
data(tocher)
res <- anacor(tocher)
res

## simple CA on Tocher data, asymmetric coordinates
res <- anacor(tocher, scaling = c("standard", "Benzecri"))
res

## 2- and 5-dimensional solutions for bitterling data, Benzecri scaling
data(bitterling)
res1 <- anacor(bitterling, ndim = 2, scaling = c("Benzecri", "Benzecri"))
res2 <- anacor(bitterling, ndim = 5, scaling = c("Benzecri", "Benzecri"))
res1
res2

## Canonical CA on Maxwell data, Goodman scaling
data(maxwell)
res <- anacor(maxwell$table, row.covariates = maxwell$row.covariates, 
scaling = c("Goodman", "Goodman"))
res

# }

Run the code above in your browser using DataLab