Learn R Programming

anacor (version 1.0-5)

anacor: Simple and Canonical Correspondence Analysis

Description

This function performs simple and canonical CA for 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 = TRUE, eps = 1e-06)

## S3 method for class 'anacor': print(x,...) ## S3 method for class 'anacor': summary(object,...)

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", "centroid", "Benzecri", "Goodman".
ellipse
If TRUE, confidence ellipses are computed.
eps
Convergence criterion for reconstitution algorithm.
x
Object of class "anacor" in print.anacor.
object
Object of class "anacor" in summary.anacor.
...
Additional arguments ignored.

Value

  • row.scoresScaled row scores.
  • col.scoresScaled column scores.
  • ndimNumber of dimensions extracted.
  • chisqTotal chi-square value.
  • chisq.decompChi-square decomposition across dimensions with p-values.
  • singular.valuesSingular values without trivial solution.
  • se.singular.valuesStandard errors for the singular values.
  • left.singvecLeft singular vectors without trivial solution.
  • right.singvecRight singular vectors without trivial solution.
  • eigen.valuesEigenvalues without trivial solution.
  • datnameName of the dataset.
  • tabTable with imputed frequencies in case of missings.
  • row.covariatesMatrix with row covariates.
  • col.covariatesMatrix with column covariates.
  • scalingScaling Method.
  • bdmatList of matrices with observed and fitted Benzecri distances for rows and columns.
  • rmseRoot mean squared error of Bezencri distances (rows and columns).
  • row.acovCovariance matrix for row scores.
  • col.acovCovariance matrix for column scores.
  • cancoefList containing canonical coefficients (CCA only).
  • sitescoresList containing the site scores (CCA only).
  • isetcorList 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. Furthermore, scores can be scaled around their centroid. Goodman scaling is based on Fisher-Maung decomposition. For large datasets it is suggested to set ellipse = FALSE. If conf = 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. http://www.jstatsoft.org/v31/i05/

See Also

plot.anacor

Examples

Run this code
## simple CA on Tocher data, asymmetric coordinates
data(tocher)
res <- anacor(tocher, scaling = c("standard", "centroid"))
res
summary(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
summary(res)

Run the code above in your browser using DataLab