Package: |
cabootcrs |
Type: |
Package |
Version: |
2.1.0 |
Date: |
2022-02-03 |
License: |
GPL-3 |
Depends: |
lpSolve, colorspace |
Simple Correspondence Analysis:
Correspondence Analysis plots usually only show the coordinates for each of
the row and column category points projected onto the new axes, with no indication of
the degree of sampling variation. This package produces bootstrap-based confidence
ellipses for each of the row and column points with respect to the axes shown.
These confidence regions are based on the sampling variation of the difference between
sample and population points when both are projected onto the sample axes, allowing for
variation in both the points and the axes and the correlation between them. Hence the coverage
percentage is the chance of drawing a sample such that the confidence ellipse contains
the population point when it is projected onto the samples axes as a supplementary point.
See the reference below for further details.
There are options for different ways of generating the bootstrap resamples,
notably based on either the Poisson or the multinomial distribution, with
the latter allowing the option of fixed row or column sums.
Correspondence analysis results can be plotted in two main ways.
The default option here is to produce a biplot where the row category
points are plotted in principal coordinates
(i.e. coordinates which allow for the different inertias of the axes)
and the confidence ellipses are shown for these row category points.
The column category points are shown in standard coordinates on this plot
and drawn as directions in the common biplot style.
A second biplot is also produced where the roles of the rows and columns are reversed.
The other main plotting option is to produce a "french-style" plot where both
row categories and column categories are plotted as points in principal coordinates.
However, again two plots are produced, one with confidence ellipses
for the row category points and one with confidence ellipses for the
column category points. This is a deliberate restriction, partly to reduce
plot clutter but mostly to emphasize that the row and column points
are in different spaces and that their relative positions should not be over-interpreted.
There are several options for different ways of plotting the data,
with simple choices to vary the colour schemes, or to suppress point labels,
or to show only a few of the ellipses, intended particularly to reduce
the clutter in pictures with large data matrices.
There is also an option for fuller control over the graphics, by supplying
either files or data frames to define groups of points which can be plotted
in common colours and symbols, or to suppress their point labels and ellipses.
The package can also be used just to perform Correspondence Analysis as usual,
but with the above plotting options available.
The package can also be used just to produce the covariance matrices for each
of the category points, which for example can then be used with ellipse() to add
confidence ellipses to results from the ca() and mjca() (below) routines in the ca package.
Multiple Correspondence Analysis:
The same principles as above carry over to the Multiple Correspondence Analysis
case with p categorical variables.
The recommended approach is to bootstrap the indicator matrix
and then apply MCA to the derived Burt matrix.
A new method is provided in the variance calculations to correct for the
well-known problems induced by the diagonal of the Burt matrix.
Standard options for correcting inertias and coordinates are also given.
In particular options exists such that MCA with p=2 gives the same
results as SCA, so that MCA can be regarded as a proper generalisation of SCA
(not all would agree with this, however).
The default plotting of the results is to produce p plots,
with each plot showing confidence ellipses for all of the categories of just one variable.
This is again done to reduce plot clutter, albeit at the expense of more plots.
Again, numerous options for controlling the plots are provided.
Bootstrapping can also be applied to the analysis of an indicator matrix or a doubled matrix,
but the procedure is highly experimental and very slow.
The data set can be input in numerous formats, and routines are provided
to convert between them. However note that the data cannot be inputted as
a Burt matrix because this loses some of the information in the data.
Changes from Version 1.0:
Multiple correspondence analysis routines added.
Hungarian algorithm added for axis rearranging, to replace the embarrassingly poor
method used previously.
Bootstrap critical values added, and are now the default.
Numerous fairly minor changes made to existing simple correspondence analysis routines.
New routines to convert data between different formats.
There may be a little backwards incompatibility as some options to the routines
have changed a bit, but standard use with few options will still work.
Any changes should produce easily fixable failures to run.
Changes from Version 2.0:
Debugging, including for plotca to call dev.new() when in R but not Rstudio,
and option to call it from Rstudio.
New routines to reflect axes and reorder categories,
e.g. for when using results with other packages.
New routine to add supplementary points to plots.
More options and examples for plotting.
Final Notes:
The package does not use any routines from any of the
other Correspondence Analysis packages, only base R routines.
This was deliberate, in order to maintain control over the precise details.
The only external routines used are lp.assign, from the lpSolve package, for the Hungarian algorithm,
and some hcl functions from the colo(u)rspace package for plotting.
The results can be used as input to other packages, such as using ellipse()
to draw the ellipses on a plot from ca(), see covmat
and plotca
for this.