Title: | Multivariate Data Analysis |
Version: | 0.14.0 |
Maintainer: | Nicolas Frerebeau <nicolas.frerebeau@u-bordeaux-montaigne.fr> |
Description: | Simple Principal Components Analysis (PCA) and (Multiple) Correspondence Analysis (CA) based on the Singular Value Decomposition (SVD). This package provides S4 classes and methods to compute, extract, summarize and visualize results of multivariate data analysis. It also includes methods for partial bootstrap validation described in Greenacre (1984, ISBN: 978-0-12-299050-2) and Lebart et al. (2006, ISBN: 978-2-10-049616-7). |
License: | GPL (≥ 3) |
URL: | https://codeberg.org/tesselle/dimensio, https://packages.tesselle.org/dimensio/, https://tesselle.r-universe.dev/dimensio |
BugReports: | https://codeberg.org/tesselle/dimensio/issues |
Depends: | R (≥ 3.5) |
Imports: | arkhe (≥ 1.10.0), graphics, grDevices, khroma (≥ 1.16.0), methods, utils |
Suggests: | fontquiver, knitr, markdown, rsvg, svglite, tinysnapshot, tinytest |
VignetteBuilder: | knitr |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.2.9000 |
X-schema.org-isPartOf: | https://www.tesselle.org |
X-schema.org-keywords: | data-analysis, multivariate-analysis, r-package |
Collate: | 'AllClasses.R' 'AllGenerics.R' 'annotations.R' 'augment.R' 'biplot.R' 'bootstrap.R' 'ca.R' 'coerce.R' 'data.R' 'dimensio-defunct.R' 'dimensio-deprecated.R' 'dimensio-internal.R' 'dimensio-package.R' 'export.R' 'get_contributions.R' 'get_coordinates.R' 'get_correlations.R' 'get_cos2.R' 'get_data.R' 'get_distances.R' 'get_eigenvalues.R' 'get_inertia.R' 'get_variance.R' 'mca.R' 'mutators.R' 'pca.R' 'pcoa.R' 'plot.R' 'predict.R' 'reexport.R' 'screeplot.R' 'show.R' 'subset.R' 'summary.R' 'svd.R' 'tidy.R' 'tools.R' 'viz_contributions.R' 'viz_coordinates.R' 'viz_cos2.R' 'viz_ellipse.R' 'viz_hull.R' 'wrap_ellipses.R' 'wrap_hull.R' 'zzz.R' |
NeedsCompilation: | no |
Packaged: | 2025-05-20 07:42:15 UTC; nfrerebeau |
Author: | Nicolas Frerebeau |
Repository: | CRAN |
Date/Publication: | 2025-05-20 09:20:09 UTC |
dimensio: Multivariate Data Analysis
Description
Simple Principal Components Analysis (PCA) and (Multiple) Correspondence Analysis (CA) based on the Singular Value Decomposition (SVD). This package provides S4 classes and methods to compute, extract, summarize and visualize results of multivariate data analysis. It also includes methods for partial bootstrap validation described in Greenacre (1984, ISBN: 978-0-12-299050-2) and Lebart et al. (2006, ISBN: 978-2-10-049616-7).
Details
Version | 0.14.0 |
License | GPL-3 |
CRAN DOI | doi:10.32614/CRAN.package.dimensio |
Zenodo DOI | doi:10.5281/zenodo.4478530 |
Archéosciences Bordeaux (UMR 6034)
Maison de l'Archéologie
Université Bordeaux Montaigne
F-33607 Pessac cedex
France
Package options
dimensio uses the following options()
to configure behavior:
-
dimensio.verbose
: alogical
scalar. Should R report extra information on progress? Defaults tointeractive()
.
Author(s)
Maintainer: Nicolas Frerebeau nicolas.frerebeau@u-bordeaux-montaigne.fr (ORCID)
Other contributors:
Jean-Baptiste Fourvel jean-baptiste.fourvel@univ-amu.fr (ORCID) [contributor]
Camille Thabard camille.thabard@univ-tlse2.fr (ORCID) [contributor]
Brice Lebrun (ORCID) (Logo designer) [artist]
Université Bordeaux Montaigne (ROR) [funder]
CNRS (ROR) [funder]
See Also
Useful links:
Report bugs at https://codeberg.org/tesselle/dimensio/issues
Bootstrap CA Results
Description
An S4 class to store the bootstrap of a correspondence analysis.
Note
This class inherits from CA
and MultivariateBootstrap
.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Examples
## Bootstrap on CA
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## Compute correspondence analysis
X <- ca(colours)
## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)
## Not run:
## Get replicated coordinates
get_replications(Y, margin = 1)
get_replications(Y, margin = 2)
## End(Not run)
## Plot with ellipses
viz_rows(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
viz_columns(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
## Plot with convex hulls
viz_columns(Y)
viz_hull(Y)
## Bootstrap on PCA
## Compute principal components analysis
data("iris")
X <- pca(iris, sup_quali = "Species")
## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)
## Plot with ellipses
viz_variables(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
Bootstrap PCA Results
Description
An S4 class to store the bootstrap of a principal components analysis.
Note
This class inherits from PCA
and MultivariateBootstrap
.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Examples
## Bootstrap on CA
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## Compute correspondence analysis
X <- ca(colours)
## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)
## Not run:
## Get replicated coordinates
get_replications(Y, margin = 1)
get_replications(Y, margin = 2)
## End(Not run)
## Plot with ellipses
viz_rows(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
viz_columns(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
## Plot with convex hulls
viz_columns(Y)
viz_hull(Y)
## Bootstrap on PCA
## Compute principal components analysis
data("iris")
X <- pca(iris, sup_quali = "Species")
## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)
## Plot with ellipses
viz_variables(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
CA Results
Description
An S4 class to store the results of a simple correspondence analysis.
Note
This class inherits from MultivariateAnalysis
.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Examples
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## The chi square of independence between the two variables
stats::chisq.test(colours)
## Compute correspondence analysis
X <- ca(colours)
## Plot rows
viz_rows(X, labels = TRUE)
## Plot columns
viz_columns(X, labels = TRUE)
## Get row coordinates
get_coordinates(X, margin = 1)
## Get column coordinates
get_coordinates(X, margin = 2)
## Get total inertia
sum(get_inertia(X))
## Get row contributions
get_contributions(X, margin = 1)
MCA Results
Description
An S4 class to store the results of a multiple correspondence analysis.
Note
This class inherits from CA
.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Output of Multivariate Data Analysis
Description
A virtual S4 class to store the output of a multivariate data analysis.
Slots
data
dimension
An
integer
giving the dimension of the solution.singular_values
A
numeric
vector giving the singular values.rows
A
MultivariateResults
object.columns
A
MultivariateResults
object.extra
A
list
of extra variables.
Subset
In the code snippets below, x
is a MultivariateAnalysis
object.
x[[i]]
Extracts information from a slot selected by subscript
i
.i
is a length-onecharacter
vector.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Output of Bootstrap Replications
Description
A virtual S4 class to store the output of a bootstrap analysis.
Slots
replications
An
integer
giving the number of bootstrap replications.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Multivariate Data Analysis Results
Description
An S4 class to store the results of a multivariate data analysis.
Slots
names
A
character
vector specifying the row names.principal
standard
contributions
A
numeric
matrix
giving the contributions to the definition of the dimensions.cosine
distances
A
numeric
vector giving the distances to centroid.weights
A
numeric
vector giving the masses/weights.supplement
A
logical
vector specifying the supplementary points.order
An
integer
vector giving the original indices of the data (computation moves all supplementary points at the end of the results).groups
A
character
vector specifying the class for each observation.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateSummary
,
PCA-class
,
PCOA-class
Summary of Multivariate Data Analysis
Description
A virtual S4 class to store the summary of a multivariate data analysis.
Slots
data
eigenvalues
results
supplement
A
logical
vector specifying the supplementary points.margin
An
integer
.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
PCA-class
,
PCOA-class
PCA Results
Description
An S4 class to store the results of a principal components analysis.
Slots
center
A
numeric
vector giving the column mean of the initial dataset (active individuals only).scale
A
numeric
vector giving the column standard deviations of the initial dataset (active individuals only).
Note
This class inherits from MultivariateAnalysis
.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCOA-class
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, sup_quali = "Species")
## Get eigenvalues
get_eigenvalues(X)
## Get individual cos2
head(get_cos2(X, margin = 1))
## Get variable contributions
get_contributions(X, margin = 2)
## Get correlations between variables and dimensions
get_correlations(X)
PCoA Results
Description
An S4 class to store the results of a principal coordinates analysis.
Slots
points
A
numeric
matrix whose rows give the coordinates of the points chosen to represent the dissimilarities.eigenvalues
A
numeric
vector giving the eigenvalues computed during the scaling process.method
A
character
string giving the distance that has been used to create the distance structure.GOF
A length-two
numeric
vector.groups
A
character
vector specifying the class for each observation.
Author(s)
N. Frerebeau
See Also
Other class:
BootstrapCA-class
,
BootstrapPCA-class
,
CA-class
,
MCA-class
,
MultivariateAnalysis
,
MultivariateBootstrap
,
MultivariateResults
,
MultivariateSummary
,
PCA-class
Examples
## Load data
data("iris")
## Compute euclidean distances
d <- dist(iris[, 1:4], method = "euclidean")
## Compute principal coordinates analysis
X <- pcoa(d)
## Screeplot
screeplot(X)
## Plot results
plot(X, extra_quali = iris$Species)
## Add convex hulls
plot(
x = X,
extra_quali = iris$Species,
hull = TRUE
)
## Add tolerance ellipses
plot(
x = X,
extra_quali = iris$Species,
ellipse = list(type = "tolerance", level = 0.95)
)
Benthos
Description
Abundances of Marine Species in Sea-Bed Samples
Usage
benthos
Format
A data.frame
with 13 columns (sites) and 92 rows (species).
Source
http://www.carme-n.org/?sec=data7
See Also
Other datasets:
colours
,
countries
Biplot
Description
Biplot
Usage
## S4 method for signature 'CA'
biplot(
x,
...,
axes = c(1, 2),
type = c("symetric", "rows", "columns", "contributions"),
active = TRUE,
sup = TRUE,
labels = NULL,
col.rows = c("#E69F00", "#E69F00"),
col.columns = c("#56B4E9", "#56B4E9"),
pch.rows = c(16, 1),
pch.columns = c(17, 2),
size = c(1, 3),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
legend = list(x = "topleft")
)
## S4 method for signature 'PCA'
biplot(
x,
...,
axes = c(1, 2),
type = c("form", "covariance"),
active = TRUE,
sup = TRUE,
labels = "variables",
col.rows = c("#E69F00", "#E69F00"),
col.columns = c("#56B4E9", "#56B4E9"),
pch.rows = c(16, 1),
lty.columns = c(1, 3),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
legend = list(x = "topleft")
)
Arguments
x |
|
... |
Currently not used. |
axes |
A length-two |
type |
A |
active |
A |
sup |
A |
labels |
A |
col.rows , col.columns |
A length-two |
pch.rows , pch.columns |
A length-two |
size |
A length-two |
xlim |
A length-two |
ylim |
A length-two |
main |
A |
sub |
A |
legend |
A |
lty.columns |
A length-two |
Details
A biplot is the simultaneous representation of rows and columns of a rectangular dataset. It is the generalization of a scatterplot to the case of mutlivariate data: it allows to visualize as much information as possible in a single graph (Greenacre 2010).
Biplots have the drawbacks of their advantages: they can quickly become difficult to read as they display a lot of information at once. It may then be preferable to visualize the results for individuals and variables separately.
Value
biplot()
is called for its side-effects: it results in a graphic being
displayed. Invisibly returns x
.
PCA Biplots
form
(row-metric-preserving)The form biplot favors the representation of the individuals: the distance between the individuals approximates the Euclidean distance between rows. In the form biplot the length of a vector approximates the quality of the representation of the variable.
covariance
(column-metric-preserving)The covariance biplot favors the representation of the variables: the length of a vector approximates the standard deviation of the variable and the cosine of the angle formed by two vectors approximates the correlation between the two variables. In the covariance biplot the distance between the individuals approximates the Mahalanobis distance between rows.
CA Biplots
symetric
(symetric biplot)Represents the row and column profiles simultaneously in a common space: rows and columns are in standard coordinates. Note that the the inter-distance between any row and column items is not meaningful (i.e. the proximity between rows and columns cannot be directly interpreted).
rows
(asymetric biplot)Row principal biplot (row-metric-preserving) with rows in principal coordinates and columns in standard coordinates.
columns
(asymetric biplot)Column principal biplot (column-metric-preserving) with rows in standard coordinates and columns in principal coordinates.
contribution
(asymetric biplot)Contribution biplot with rows in principal coordinates and columns in standard coordinates multiplied by the square roots of their masses.
Author(s)
N. Frerebeau
References
Aitchison, J. and Greenacre, M. J. (2002). Biplots of Compositional Data. Journal of the Royal Statistical Society: Series C (Applied Statistics), 51(4): 375-92. doi:10.1111/1467-9876.00275.
Greenacre, M. J. (2010). Biplots in Practice. Bilbao: Fundación BBVA.
See Also
Other plot methods:
plot()
,
screeplot()
,
viz_contributions()
,
viz_individuals()
,
viz_variables()
Examples
## Replicate examples from Greenacre 2007, p. 59-68
data("iris")
## Compute principal components analysis
## All rows and all columns obtain the same weight
row_w <- rep(1 / nrow(countries), nrow(countries)) # 1/13
col_w <- rep(1 / ncol(countries), ncol(countries)) # 1/6
Y <- pca(iris, scale = FALSE, sup_quali = "Species")
## Row-metric-preserving biplot (form biplot)
biplot(Y, type = "form")
## Column-metric-preserving biplot (covariance biplot)
biplot(Y, type = "covariance", legend = list(x = "bottomright"))
## Replicate examples from Greenacre 2007, p. 79-88
data("benthos")
## Compute correspondence analysis
X <- ca(benthos)
## Symetric CA biplot
biplot(X, labels = "columns", legend = list(x = "bottomright"))
## Row principal CA biplot
biplot(X, type = "row", labels = "columns", legend = list(x = "bottomright"))
## Column principal CA biplot
biplot(X, type = "column", labels = "columns", legend = list(x = "bottomright"))
## Contribution CA biplot
biplot(X, type = "contrib", labels = NULL, legend = list(x = "bottomright"))
Partial Bootstrap Analysis
Description
Checks analysis with partial bootstrap resampling.
Usage
## S4 method for signature 'CA'
bootstrap(object, n = 30)
## S4 method for signature 'PCA'
bootstrap(object, n = 30)
Arguments
object |
|
n |
A non-negative |
Value
Returns a BootstrapCA
or a BootstrapPCA
object.
Author(s)
N. Frerebeau
References
Greenacre, Michael J. Theory and Applications of Correspondence Analysis. London: Academic Press, 1984.
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.
Lockyear, K. (2013). Applying Bootstrapped Correspondence Analysis to Archaeological Data. Journal of Archaeological Science, 40(12): 4744-4753. doi:10.1016/j.jas.2012.08.035.
Ringrose, T. J. (1992). Bootstrapping and Correspondence Analysis in Archaeology. Journal of Archaeological Science, 19(6): 615-629. doi:10.1016/0305-4403(92)90032-X.
Examples
## Bootstrap on CA
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## Compute correspondence analysis
X <- ca(colours)
## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)
## Not run:
## Get replicated coordinates
get_replications(Y, margin = 1)
get_replications(Y, margin = 2)
## End(Not run)
## Plot with ellipses
viz_rows(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
viz_columns(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
## Plot with convex hulls
viz_columns(Y)
viz_hull(Y)
## Bootstrap on PCA
## Compute principal components analysis
data("iris")
X <- pca(iris, sup_quali = "Species")
## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)
## Plot with ellipses
viz_variables(Y)
viz_tolerance(Y, level = c(0.68, 0.95))
Burt Table
Description
Computes the burt table of a factor table.
Usage
burt(object, ...)
## S4 method for signature 'data.frame'
burt(object, exclude = NULL, abbrev = TRUE)
Arguments
object |
A |
... |
Currently not used. |
exclude |
A |
abbrev |
A |
Value
A symetric matrix
.
Author(s)
N. Frerebeau
See Also
Other tools:
cdt()
Examples
## Create a factor table
x <- data.frame(
A = c("a", "b", "a"),
B = c("x", "y", "z")
)
## Complete disjunctive table
cdt(x)
## Burt table
burt(x)
Correspondence Analysis
Description
Computes a simple correspondence analysis based on the singular value decomposition.
Usage
ca(object, ...)
## S4 method for signature 'data.frame'
ca(
object,
rank = NULL,
sup_row = NULL,
sup_col = NULL,
sup_quali = NULL,
autodetect = FALSE
)
## S4 method for signature 'matrix'
ca(object, rank = NULL, sup_row = NULL, sup_col = NULL)
Arguments
object |
A |
... |
Currently not used. |
rank |
An |
sup_row |
A |
sup_col |
A |
sup_quali |
A |
autodetect |
A |
Value
A CA
object.
Author(s)
N. Frerebeau
References
Greenacre, M. J. Theory and Applications of Correspondence Analysis. London: Academic Press, 1984.
Greenacre, M. J. Correspondence Analysis in Practice. Seconde edition. Interdisciplinary Statistics Series. Boca Raton: Chapman & Hall/CRC, 2007.
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.
See Also
Other multivariate analysis:
mca()
,
pca()
,
pcoa()
,
predict()
Examples
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## The chi square of independence between the two variables
stats::chisq.test(colours)
## Compute correspondence analysis
X <- ca(colours)
## Plot rows
viz_rows(X, labels = TRUE)
## Plot columns
viz_columns(X, labels = TRUE)
## Get row coordinates
get_coordinates(X, margin = 1)
## Get column coordinates
get_coordinates(X, margin = 2)
## Get total inertia
sum(get_inertia(X))
## Get row contributions
get_contributions(X, margin = 1)
Complete Disjunctive Table
Description
Computes the complete disjunctive table of a factor table.
Usage
cdt(object, ...)
## S4 method for signature 'matrix'
cdt(object, exclude = NULL, abbrev = TRUE)
## S4 method for signature 'data.frame'
cdt(object, exclude = NULL, abbrev = TRUE)
Arguments
object |
A |
... |
Currently not used. |
exclude |
A |
abbrev |
A |
Value
A data.frame
.
Author(s)
N. Frerebeau
See Also
Other tools:
burt()
Examples
## Create a factor table
x <- data.frame(
A = c("a", "b", "a"),
B = c("x", "y", "z")
)
## Complete disjunctive table
cdt(x)
## Burt table
burt(x)
Colours
Description
Contingency table of eye and hair colours of different individuals.
Usage
colours
Format
A data.frame
with 4 columns (hair colours) and 4 rows (eye
colours).
Source
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006, p. 170-172
See Also
Other datasets:
benthos
,
countries
Countries
Description
Student ratings of 13 countries on six attributes.
Usage
countries
Format
A data.frame
with 6 columns (attributes) and 13 rows (countries).
Source
Greenacre, M. J. Biplots in Practice. Bilbao: Fundación BBVA, 2010.
See Also
Other datasets:
benthos
,
colours
Object Description
Description
Object Description
Usage
## S4 method for signature 'CA'
describe(x, ...)
## S4 method for signature 'PCA'
describe(x, ...)
Arguments
x |
|
... |
Further parameters to be passed to |
Value
describe()
is called for its side-effects. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other summary:
summary()
,
tidy()
Examples
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## Compute correspondence analysis
X <- ca(colours)
## Rows summary
summary(X, margin = 1)
## Columns summary
summary(X, margin = 2)
Defunct Functions in dimensio
Description
These functions are defunct and have been replaced.
Usage
plot_rows(...)
plot_individuals(...)
plot_columns(...)
plot_variables(...)
plot_variance(...)
plot_contributions(...)
plot_cos2(...)
Arguments
... |
Not used. |
Deprecated Functions in dimensio
Description
These functions still work but will be removed (defunct) in the next version.
Dimnames of an Object
Description
Retrieve or set the dimnames of an object.
Usage
## S4 method for signature 'MultivariateAnalysis'
dim(x)
## S4 method for signature 'MultivariateAnalysis'
rownames(x, do.NULL = TRUE, prefix = "row")
## S4 method for signature 'MultivariateAnalysis'
colnames(x, do.NULL = TRUE, prefix = "col")
## S4 method for signature 'MultivariateAnalysis'
dimnames(x)
Arguments
x |
An object from which to retrieve the row or column names
(a |
do.NULL |
A |
prefix |
A |
Author(s)
N. Frerebeau
See Also
Other mutators:
subset()
Export Results
Description
Creates a Zip archive of all results in CSV format.
Usage
export(object, ...)
## S4 method for signature 'MultivariateAnalysis'
export(object, file, flags = "-r9Xj", ...)
## S4 method for signature 'PCOA'
export(object, file, flags = "-r9Xj", ...)
Arguments
object |
|
... |
Currently not used. |
file |
A |
flags |
A |
Author(s)
N. Frerebeau
See Also
utils::write.csv()
, utils::zip()
Other getters:
get_contributions()
,
get_coordinates()
,
get_data()
,
get_eigenvalues()
Examples
## Not run:
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, sup_quali = "Species")
## Export results
export(X, file = "results.zip")
## End(Not run)
Get Contributions
Description
Get Contributions
Usage
get_contributions(x, ...)
get_correlations(x, ...)
get_cos2(x, ...)
## S4 method for signature 'MultivariateAnalysis'
get_contributions(x, margin = 1)
## S4 method for signature 'PCA'
get_correlations(x, sup_name = ".sup")
## S4 method for signature 'MultivariateAnalysis'
get_cos2(x, margin = 1, sup_name = ".sup")
Arguments
x |
An object from which to get element(s) (a |
... |
Currently not used. |
margin |
A length-one |
sup_name |
A |
Value
-
get_contributions()
returns adata.frame
of contributions to the definition of the principal dimensions. -
get_correlations()
returns adata.frame
of correlations between variables and dimensions. An extra column (named aftersup_name
) is added specifying whether an observation is a supplementary point or not. -
get_cos2()
returns adata.frame
ofcos^2
values (i.e. quality of the representation of the points on the factor map). An extra column (named aftersup_name
) is added specifying whether an observation is a supplementary point or not.
Author(s)
N. Frerebeau
See Also
Other getters:
export()
,
get_coordinates()
,
get_data()
,
get_eigenvalues()
Get Coordinates
Description
Get Coordinates
Usage
get_coordinates(x, ...)
get_replications(x, ...)
## S4 method for signature 'MultivariateAnalysis'
get_coordinates(x, margin = 1, principal = TRUE, sup_name = ".sup")
## S4 method for signature 'PCOA'
get_coordinates(x)
## S4 method for signature 'MultivariateBootstrap'
get_replications(x, margin = 1)
## S4 method for signature 'BootstrapPCA'
get_replications(x)
Arguments
x |
An object from which to get element(s) (a |
... |
Currently not used. |
margin |
A length-one |
principal |
A |
sup_name |
A |
Value
-
get_coordinates()
returns adata.frame
of coordinates. An extra column (named aftersup_name
) is added specifying whether an observation is a supplementary point or not. -
get_replications()
returns anarray
of coordinates.
Author(s)
N. Frerebeau
See Also
Other getters:
export()
,
get_contributions()
,
get_data()
,
get_eigenvalues()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_row = 5:10, sup_quali = "Species")
## Get row principal coordinates
head(get_coordinates(X, margin = 1, principal = TRUE))
## Get row standard coordinates
head(get_coordinates(X, margin = 1, principal = FALSE))
## Tidy principal coordinates
head(tidy(X, margin = 1))
head(tidy(X, margin = 2))
head(augment(X, margin = 1, axes = c(1, 2)))
head(augment(X, margin = 2, axes = c(1, 2)))
Get Original Data
Description
Get Original Data
Usage
get_data(x, ...)
## S4 method for signature 'MultivariateAnalysis'
get_data(x)
Arguments
x |
An object from which to get element(s) (a |
... |
Currently not used. |
Value
Returns a data.frame
of original data.
Author(s)
N. Frerebeau
See Also
Other getters:
export()
,
get_contributions()
,
get_coordinates()
,
get_eigenvalues()
Get Eigenvalues
Description
Get Eigenvalues
Usage
get_eigenvalues(x)
get_variance(x, ...)
get_distances(x, ...)
get_inertia(x, ...)
## S4 method for signature 'MultivariateAnalysis'
get_distances(x, margin = 1)
## S4 method for signature 'MultivariateAnalysis'
get_eigenvalues(x)
## S4 method for signature 'PCOA'
get_eigenvalues(x)
## S4 method for signature 'MultivariateAnalysis'
get_inertia(x, margin = 1)
## S4 method for signature 'MultivariateAnalysis'
get_variance(x, digits = 2)
Arguments
x |
An object from which to get element(s) (a |
... |
Currently not used. |
margin |
A length-one |
digits |
An |
Value
-
get_eigenvalues()
returns adata.frame
with the following columns:eigenvalues
,variance
(percentage of variance) andcumulative
(cumulative percentage of variance). -
get_variance()
returns anumeric
vector giving the amount of variance explained by each (principal) component. -
get_distance()
returns anumeric
vector of squared distance to the centroid. -
get_inertia()
returns anumeric
vector giving the inertia (weighted squared distance to the centroid).
Author(s)
N. Frerebeau
See Also
Other getters:
export()
,
get_contributions()
,
get_coordinates()
,
get_data()
Non-Overlapping Text Labels
Description
Optimize the location of text labels to minimize overplotting text.
Usage
label(
x,
y = NULL,
labels = seq_along(x$x),
type = c("text", "shadow", "box"),
...
)
Arguments
x , y |
A |
labels |
A |
type |
A |
... |
Further arguments to be passed to |
Value
label()
is called it for its side-effects: it results in a graphic
being displayed.
Author(s)
N. Frerebeau
Source
This function is modeled after car::pointLabel()
(originally from the
maptools package).
See Also
Multiple Correspondence Analysis
Description
Computes a multiple correspondence analysis.
Usage
mca(object, ...)
## S4 method for signature 'data.frame'
mca(
object,
rank = NULL,
sup_row = NULL,
sup_col = NULL,
sup_quanti = NULL,
autodetect = FALSE
)
## S4 method for signature 'matrix'
mca(object, rank = NULL, sup_row = NULL, sup_col = NULL)
Arguments
object |
A |
... |
Currently not used. |
rank |
An |
sup_row |
A |
sup_col |
A |
sup_quanti |
A |
autodetect |
A |
Value
A MCA
object.
Author(s)
N. Frerebeau
References
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.
See Also
Other multivariate analysis:
ca()
,
pca()
,
pcoa()
,
predict()
Principal Components Analysis
Description
Computes a principal components analysis based on the singular value decomposition.
Usage
pca(object, ...)
## S4 method for signature 'data.frame'
pca(
object,
center = TRUE,
scale = TRUE,
rank = NULL,
sup_row = NULL,
sup_col = NULL,
sup_quali = NULL,
weight_row = NULL,
weight_col = NULL,
autodetect = FALSE
)
## S4 method for signature 'matrix'
pca(
object,
center = TRUE,
scale = TRUE,
rank = NULL,
sup_row = NULL,
sup_col = NULL,
weight_row = NULL,
weight_col = NULL
)
Arguments
object |
A |
... |
Currently not used. |
center |
A |
scale |
A |
rank |
An |
sup_row |
A |
sup_col |
A |
sup_quali |
A |
weight_row |
A |
weight_col |
A |
autodetect |
A |
Value
A PCA
object.
Author(s)
N. Frerebeau
References
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.
See Also
Other multivariate analysis:
ca()
,
mca()
,
pcoa()
,
predict()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, sup_quali = "Species")
## Get eigenvalues
get_eigenvalues(X)
## Get individual cos2
head(get_cos2(X, margin = 1))
## Get variable contributions
get_contributions(X, margin = 2)
## Get correlations between variables and dimensions
get_correlations(X)
Principal Coordinates Analysis
Description
Computes classical (metric) multidimensional scaling.
Usage
pcoa(object, ...)
## S4 method for signature 'dist'
pcoa(object, rank = 2)
Arguments
object |
|
... |
Currently not used. |
rank |
An |
Value
A PCOA
object.
Author(s)
N. Frerebeau
References
Gower, J. C. (1966). Some Distance Properties of Latent Root and Vector Methods Used in Multivariate Analysis. Biometrika, 53(3‑4): 325-338. doi:10.1093/biomet/53.3-4.325.
See Also
Other multivariate analysis:
ca()
,
mca()
,
pca()
,
predict()
Examples
## Load data
data("iris")
## Compute euclidean distances
d <- dist(iris[, 1:4], method = "euclidean")
## Compute principal coordinates analysis
X <- pcoa(d)
## Screeplot
screeplot(X)
## Plot results
plot(X, extra_quali = iris$Species)
## Add convex hulls
plot(
x = X,
extra_quali = iris$Species,
hull = TRUE
)
## Add tolerance ellipses
plot(
x = X,
extra_quali = iris$Species,
ellipse = list(type = "tolerance", level = 0.95)
)
Plot Coordinates
Description
Plot Coordinates
Usage
## S4 method for signature 'PCOA,missing'
plot(
x,
...,
axes = c(1, 2),
labels = FALSE,
extra_quali = NULL,
extra_quanti = NULL,
ellipse = NULL,
hull = FALSE,
color = NULL,
fill = FALSE,
symbol = FALSE,
size = c(1, 6),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
ann = graphics::par("ann"),
frame.plot = TRUE,
panel.first = NULL,
panel.last = NULL,
legend = list(x = "topleft")
)
Arguments
x |
An R object. |
... |
Further graphical parameters. |
axes |
A length-two |
labels |
A |
extra_quali |
An optional vector of qualitative data for aesthetics mapping. |
extra_quanti |
An optional vector of quantitative data for aesthetics
mapping. If a single |
ellipse |
A |
hull |
A |
color |
The colors for lines and points (will be mapped to
|
fill |
The background colors for points (will be mapped to
|
symbol |
A vector of plotting characters or symbols (will be mapped to
|
size |
A length-two |
xlim |
A length-two |
ylim |
A length-two |
main |
A |
sub |
A |
ann |
A |
frame.plot |
A |
panel.first |
An |
panel.last |
An |
legend |
A |
Author(s)
N. Frerebeau
See Also
Other plot methods:
biplot()
,
screeplot()
,
viz_contributions()
,
viz_individuals()
,
viz_variables()
Predict New Coordinates
Description
Predict the projection of new individuals/rows or variables/columns.
Usage
## S4 method for signature 'CA'
predict(object, newdata, margin = 1)
## S4 method for signature 'MCA'
predict(object, newdata, margin = 1)
## S4 method for signature 'PCA'
predict(object, newdata, margin = 1)
Arguments
object |
|
newdata |
An object of supplementary points coercible to a
|
margin |
A length-one |
Value
A data.frame
of coordinates.
Author(s)
N. Frerebeau
See Also
Other multivariate analysis:
ca()
,
mca()
,
pca()
,
pcoa()
Examples
## Create a matrix
A <- matrix(data = sample(1:10, 100, TRUE), nrow = 10, ncol = 10)
## Compute correspondence analysis
X <- ca(A, sup_row = 8:10, sup_col = 7:10)
## Predict new row coordinates
Y <- matrix(data = sample(1:10, 120, TRUE), nrow = 20, ncol = 6)
predict(X, Y, margin = 1)
## Predict new column coordinates
Z <- matrix(data = sample(1:10, 140, TRUE), nrow = 7, ncol = 20)
predict(X, Z, margin = 2)
Build a Legend
Description
Build a Legend
Usage
prepare_legend(x, args, points = TRUE, lines = TRUE)
Arguments
x |
A |
args |
A |
points |
A |
lines |
A |
Author(s)
N. Frerebeau
Prepare Data for Plotting
Description
Prepare Data for Plotting
Usage
prepare_plot(
x,
margin,
...,
axes = c(1, 2),
active = TRUE,
sup = TRUE,
principal = TRUE,
extra_quali = NULL,
extra_quanti = NULL,
color = NULL,
fill = FALSE,
symbol = NULL,
size = c(1, 6),
line_type = NULL,
line_width = size
)
Arguments
x |
A |
margin |
A length-one |
... |
Further graphical parameters. |
axes |
A length-two |
active |
A |
sup |
A |
principal |
A |
extra_quali |
An optional vector of qualitative data for aesthetics mapping. |
extra_quanti |
An optional vector of quantitative data for aesthetics
mapping. If a single |
color |
The colors for lines and points (will be mapped to
|
fill |
The background colors for points (will be mapped to
|
symbol |
A vector of plotting characters or symbols (will be mapped to
|
size |
A length-two |
line_type |
A specification for the line type (will be mapped to
|
line_width |
A specification for the line type and width (will
be mapped to |
Value
A data.frame
with the following columns:
x
Coordinates along x.
y
Coordinates along y.
extra_quali
Extra qualitative variable to be highlighted.
extra_quanti
Extra quantitative variable to be highlighted.
label
Label.
sup
Is supplementary?
col
Color for lines and symbols.
bg
Background color for symbols.
pch
Symbols.
cex
Symbol sizes.
lty
Line types.
lwd
Line widths.
Author(s)
N. Frerebeau
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- khroma
color
,palette_color_continuous
,palette_color_discrete
,palette_color_picker
,palette_line
,palette_shape
,palette_size_sequential
Scree Plot
Description
Plot eigenvalues (scree plot) or variances histogram.
Usage
## S4 method for signature 'MultivariateAnalysis'
screeplot(
x,
...,
eigenvalues = FALSE,
cumulative = FALSE,
labels = TRUE,
limit = 10,
col = "grey90",
border = "grey10",
col.cumulative = "red",
lty.cumulative = "solid",
lwd.cumulative = 2
)
## S4 method for signature 'PCOA'
screeplot(
x,
...,
labels = FALSE,
limit = NULL,
col = "grey90",
border = "grey10"
)
Arguments
x |
|
... |
Extra parameters to be passed to |
eigenvalues |
A |
cumulative |
A |
labels |
A |
limit |
An |
col , border |
A |
col.cumulative |
A specification for the line color. |
lty.cumulative |
A specification for the line type. |
lwd.cumulative |
A specification for the line width. |
Value
screeplot()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other plot methods:
biplot()
,
plot()
,
viz_contributions()
,
viz_individuals()
,
viz_variables()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Screeplot
screeplot(X)
screeplot(X, cumulative = TRUE)
Extract Parts of an Object
Description
Operators acting on objects to extract parts.
Usage
## S4 method for signature 'CA,ANY,missing'
x[[i]]
## S4 method for signature 'PCA,ANY,missing'
x[[i]]
Arguments
x |
An object from which to extract element(s) or in which to replace element(s). |
i |
A |
Details
If i
is "data
", returns a list with the following elements:
data
A
numeric
matrix of raw data.mean
A
numeric
vector giving the variables means (PCA
).sd
A
numeric
vector giving the variables standard deviations (PCA
).
If i
is "rows
", returns a list with the following elements:
coord
A
numeric
matrix of rows/individuals coordinates.cos2
A
numeric
matrix of rows/individuals squared cosine.masses
A
numeric
vector giving the rows masses/individual weights.sup
A
logical
vector specifying whether a point is a supplementary observation or not.
If i
is "columns
", returns a list with the following elements:
coord
A
numeric
matrix of columns/variables coordinates.cor
A
numeric
matrix of correlation between variables and the dimensions (PCA
).cos2
A
numeric
matrix of columns/variables squared cosine.masses
A
numeric
vector giving the columns masses/variable weights.sup
A
logical
vector specifying whether a point is a supplementary observation or not.
If i
is "eigenvalues
", returns a numeric
vector of eigenvalues.
Value
A list
.
Author(s)
N. Frerebeau
See Also
Other mutators:
dimnames()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_row = 8:10, sup_col = 1, sup_quali = "Species")
## Get results for the individuals
X[["rows"]]
Object Summaries
Description
Provides a summary of the results of a multivariate data analysis.
Usage
## S4 method for signature 'MultivariateSummary'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S4 method for signature 'CA'
summary(
object,
...,
axes = c(1, 2),
margin = 1,
active = TRUE,
sup = TRUE,
rank = NULL
)
## S4 method for signature 'PCA'
summary(
object,
...,
axes = c(1, 2),
margin = 1,
active = TRUE,
sup = TRUE,
rank = NULL
)
Arguments
x |
A |
row.names |
A |
optional |
A |
... |
Currently not used. |
object |
|
axes |
A length-two |
margin |
A length-one |
active |
A |
sup |
A |
rank |
An |
Author(s)
N. Frerebeau
See Also
Other summary:
describe()
,
tidy()
Examples
## Data from Lebart et al. 2006, p. 170-172
data("colours")
## Compute correspondence analysis
X <- ca(colours)
## Rows summary
summary(X, margin = 1)
## Columns summary
summary(X, margin = 2)
Singular Value Decomposition of a Matrix
Description
Singular Value Decomposition of a Matrix
Usage
svd2(x, rank = Inf)
Arguments
x |
A |
rank |
An |
Value
A list
with the following elements:
d
A vector containing the singular values of
x
, of lengthrank
, sorted decreasingly.u
A matrix whose columns contain the left singular vectors of
x
. Dimensionc(m, rank)
.v
A matrix whose columns contain the right singular vectors of
x
. Dimensionc(p, rank)
.
Note
In both PCA and PCA-cor whitening there is a sign-ambiguity in the eigenvector matrices. In order to resolve the sign-ambiguity we use eigenvector matrices with a positive diagonal. This has the effect to make cross-correlations and cross-correlations positive diagonal for PCA.
Tidy Coordinates
Description
Tidy Coordinates
Usage
tidy(x, ...)
augment(x, ...)
## S4 method for signature 'MultivariateAnalysis'
augment(x, ..., margin = 1, axes = c(1, 2), principal = TRUE)
## S4 method for signature 'MultivariateAnalysis'
tidy(x, ..., margin = 1, principal = TRUE)
Arguments
x |
|
... |
Currently not used. |
margin |
A length-one |
axes |
A length-two |
principal |
A |
Value
tidy()
returns a long data.frame
with the following columns:
label
Row/column names of the original data.
component
Component.
supplementary
Whether an observation is active or supplementary.
coordinate
Coordinates.
contribution
Contributions to the definition of the components.
cos2
cos^2
.
augment()
returns a wide data.frame
of the row/column coordinates
along axes
and the following columns:
label
Row/column names of the original data.
supplementary
Whether an observation is active or supplementary.
mass
Weight/mass of each observation.
sum
Sum of squared coordinates along
axes
.contribution
Joint contributions to the definition of
axes
.cos2
Joint
cos^2
alongaxes
.
Author(s)
N. Frerebeau
See Also
Other summary:
describe()
,
summary()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_row = 5:10, sup_quali = "Species")
## Get row principal coordinates
head(get_coordinates(X, margin = 1, principal = TRUE))
## Get row standard coordinates
head(get_coordinates(X, margin = 1, principal = FALSE))
## Tidy principal coordinates
head(tidy(X, margin = 1))
head(tidy(X, margin = 2))
head(augment(X, margin = 1, axes = c(1, 2)))
head(augment(X, margin = 2, axes = c(1, 2)))
Confidence Ellipses
Description
Plots confidence ellipses.
Usage
viz_confidence(x, y, ...)
wrap_confidence(x, y, ...)
## S4 method for signature 'numeric,numeric'
viz_confidence(
x,
y,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'MultivariateAnalysis,missing'
viz_confidence(
x,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'MultivariateBootstrap,missing'
viz_confidence(
x,
...,
level = 0.95,
color = FALSE,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'PCOA,missing'
viz_confidence(
x,
...,
axes = c(1, 2),
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'numeric,numeric'
wrap_confidence(x, y, group = NULL, level = 0.95)
## S4 method for signature 'MultivariateAnalysis,missing'
wrap_confidence(
x,
margin = 1,
axes = c(1, 2),
group = NULL,
level = 0.95,
principal = TRUE
)
## S4 method for signature 'PCOA,missing'
wrap_confidence(x, axes = c(1, 2), group = NULL, level = 0.95)
Arguments
x , y |
A |
... |
Further graphical parameters to be passed to
|
group |
A vector specifying the group an observation belongs to. |
level |
A |
color |
The colors for borders (will be mapped to |
fill |
The background colors (will be mapped to |
symbol |
A vector of symbols (will be mapped to |
axes |
A length-two |
margin |
A length-one |
principal |
A |
Value
wrap_confidence()
returns a data.frame
of envelope x
and y
coordinates. An extra column named group
is added specifying the group an
observation belongs to.
viz_confidence()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other envelopes:
viz_ellipses()
,
viz_hull()
,
viz_tolerance()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Compute confidence ellipse coordinates
conf <- wrap_confidence(X, margin = 1, group = "Species", level = 0.95)
## Plot confidence ellipses
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_confidence(X, group = iris$Species, color = col, level = 0.95)
Visualize Contributions and cos2
Description
Plots contributions histogram and cos^2
scatterplot.
Usage
viz_contributions(x, ...)
viz_cos2(x, ...)
## S4 method for signature 'MultivariateAnalysis'
viz_contributions(
x,
...,
margin = 2,
axes = 1,
sort = TRUE,
decreasing = TRUE,
limit = 10,
horiz = FALSE,
col = "grey90",
border = "grey10"
)
## S4 method for signature 'MultivariateAnalysis'
viz_cos2(
x,
...,
margin = 2,
axes = 1,
active = TRUE,
sup = TRUE,
sort = TRUE,
decreasing = TRUE,
limit = 10,
horiz = FALSE,
col = "grey90",
border = "grey10"
)
Arguments
x |
|
... |
Extra parameters to be passed to |
margin |
A length-one |
axes |
A |
sort |
A |
decreasing |
A |
limit |
An |
horiz |
A |
col , border |
A |
active |
A |
sup |
A |
Details
The red dashed line indicates the expected average contribution (variables with a contribution larger than this cutoff can be considered as important in contributing to the component).
Value
viz_contributions()
and viz_cos2()
are called for their side-effects:
they result in a graphic being displayed. Invisibly return x
.
Author(s)
N. Frerebeau
See Also
Other plot methods:
biplot()
,
plot()
,
screeplot()
,
viz_individuals()
,
viz_variables()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Get row contributions
head(get_contributions(X, margin = 1))
## Plot contributions
viz_contributions(X, axes = 1)
## Plot cos2
viz_cos2(X, axes = 1)
Ellipses
Description
Plots ellipses.
Usage
viz_ellipses(x, y, ...)
## S4 method for signature 'numeric,numeric'
viz_ellipses(
x,
y,
...,
group = NULL,
type = c("tolerance", "confidence"),
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'MultivariateAnalysis,missing'
viz_ellipses(
x,
...,
group = NULL,
type = c("tolerance", "confidence"),
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'PCOA,missing'
viz_ellipses(
x,
...,
group = NULL,
type = c("tolerance", "confidence"),
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
Arguments
x , y |
A |
... |
Further graphical parameters to be passed to
|
group |
A vector specifying the group an observation belongs to. |
type |
A |
level |
A |
color |
The colors for borders (will be mapped to |
fill |
The background colors (will be mapped to |
symbol |
A vector of symbols (will be mapped to |
Value
viz_ellipses()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other envelopes:
viz_confidence()
,
viz_hull()
,
viz_tolerance()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Plot with tolerance ellipses
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_ellipses(
x = X,
type = "tolerance",
level = c(0.68, 0.95),
group = iris$Species,
color = col
)
Convex Hulls
Description
Plots convex hull of a set of observations.
Usage
viz_hull(x, y, ...)
wrap_hull(x, y, ...)
## S4 method for signature 'numeric,numeric'
viz_hull(x, y, ..., group = NULL, color = NULL, fill = FALSE, symbol = FALSE)
## S4 method for signature 'MultivariateAnalysis,missing'
viz_hull(x, ..., group = NULL, color = NULL, fill = FALSE, symbol = FALSE)
## S4 method for signature 'MultivariateBootstrap,missing'
viz_hull(x, ..., color = FALSE, fill = FALSE, symbol = FALSE)
## S4 method for signature 'PCOA,missing'
viz_hull(x, ..., group = NULL, color = FALSE, fill = FALSE, symbol = FALSE)
## S4 method for signature 'numeric,numeric'
wrap_hull(x, y, group = NULL)
## S4 method for signature 'MultivariateAnalysis,missing'
wrap_hull(x, margin = 1, axes = c(1, 2), group = NULL, principal = TRUE)
## S4 method for signature 'PCOA,missing'
wrap_hull(x, axes = c(1, 2), group = NULL)
Arguments
x , y |
A |
... |
Further graphical parameters to be passed to
|
group |
A vector specifying the group an observation belongs to. |
color |
The colors for borders (will be mapped to |
fill |
The background colors (will be mapped to |
symbol |
A vector of symbols (will be mapped to |
margin |
A length-one |
axes |
A length-two |
principal |
A |
Value
wrap_hull()
returns a data.frame
of envelope x
and y
coordinates.
An extra column named group
is added specifying the group an observation
belongs to.
viz_hull()
is called for its side-effects: it results in a graphic being
displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other envelopes:
viz_confidence()
,
viz_ellipses()
,
viz_tolerance()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Compute convex hull coordinates
hulls <- wrap_hull(X, margin = 1, group = "Species")
## Plot convex hulls
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_hull(X, group = iris$Species, color = col)
Visualize Individuals Factor Map
Description
Plots row/individual principal coordinates.
Usage
viz_individuals(x, ...)
viz_rows(x, ...)
## S4 method for signature 'MultivariateAnalysis'
viz_rows(
x,
...,
axes = c(1, 2),
active = TRUE,
sup = TRUE,
labels = FALSE,
extra_quali = NULL,
extra_quanti = NULL,
ellipse = NULL,
hull = NULL,
color = NULL,
fill = FALSE,
symbol = FALSE,
size = c(1, 6),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
panel.first = NULL,
panel.last = NULL,
legend = list(x = "topleft")
)
## S4 method for signature 'BootstrapCA'
viz_rows(
x,
...,
axes = c(1, 2),
color = FALSE,
fill = FALSE,
symbol = FALSE,
legend = NULL
)
## S4 method for signature 'PCA'
viz_individuals(
x,
...,
axes = c(1, 2),
active = TRUE,
sup = TRUE,
labels = FALSE,
extra_quali = NULL,
extra_quanti = NULL,
ellipse = NULL,
hull = NULL,
color = NULL,
fill = FALSE,
symbol = FALSE,
size = c(1, 6),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
panel.first = NULL,
panel.last = NULL,
legend = list(x = "topleft")
)
Arguments
x |
|
... |
Further graphical parameters. |
axes |
A length-two |
active |
A |
sup |
A |
labels |
A |
extra_quali |
An optional vector of qualitative data for aesthetics mapping. |
extra_quanti |
An optional vector of quantitative data for aesthetics
mapping. If a single |
ellipse |
A |
hull |
A |
color |
The colors for lines and points (will be mapped to
|
fill |
The background colors for points (will be mapped to
|
symbol |
A vector of plotting characters or symbols (will be mapped to
|
size |
A length-two |
xlim |
A length-two |
ylim |
A length-two |
main |
A |
sub |
A |
panel.first |
An |
panel.last |
An |
legend |
A |
Value
viz_*()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other plot methods:
biplot()
,
plot()
,
screeplot()
,
viz_contributions()
,
viz_variables()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Plot individuals
viz_individuals(X, panel.last = graphics::grid())
## Labels of the 10 individuals with highest cos2
viz_individuals(X, labels = list(filter = "cos2", n = 10))
## Plot variables
viz_variables(X, panel.last = graphics::grid())
## Graphical parameters
## Continuous values
viz_individuals(X, extra_quanti = iris$Petal.Length, symbol = 16, size = c(1, 2))
viz_individuals(X, extra_quanti = iris$Petal.Length, symbol = 16, size = c(1, 2),
color = grDevices::hcl.colors(12, "RdPu"))
viz_variables(X, extra_quanti = "contribution",
color = grDevices::hcl.colors(12, "BluGrn", rev = TRUE),
size = c(0, 1))
## Discrete values
viz_individuals(X, extra_quali = iris$Species, symbol = 21:23)
viz_individuals(X, extra_quali = iris$Species, symbol = 21:23,
fill = c("#004488", "#DDAA33", "#BB5566"),
color = "black")
viz_variables(X, extra_quali = c("Petal", "Petal", "Sepal", "Sepal"),
color = c("#EE7733", "#0077BB"),
symbol = c(1, 3))
Non-Overlapping Text Labels
Description
Non-Overlapping Text Labels
Usage
viz_labels(x, filter = "contribution", n = 10, type = "shadow", ...)
Arguments
x |
A |
filter |
A |
n |
An |
type |
A |
... |
Currently not used. |
Details
Only labels in the plotting region (given by par("usr")
) will be drawn.
Author(s)
N. Frerebeau
Build a Factor Map
Description
Build a Factor Map
Usage
viz_points(
x,
margin,
axes,
...,
active = TRUE,
sup = TRUE,
labels = list(filter = "contribution", n = 10),
extra_quali = NULL,
extra_quanti = NULL,
color = NULL,
fill = FALSE,
symbol = NULL,
size = c(1, 6),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
xlab = NULL,
ylab = NULL,
ann = graphics::par("ann"),
frame.plot = TRUE,
panel.first = NULL,
panel.last = NULL,
ellipse = NULL,
hull = FALSE,
legend = list(x = "topleft")
)
Arguments
x |
|
margin |
A length-one |
axes |
A length-two |
... |
Currently not used. |
active |
A |
sup |
A |
labels |
A |
extra_quali |
An optional vector of qualitative data for aesthetics mapping. |
extra_quanti |
An optional vector of quantitative data for aesthetics
mapping. If a single |
color |
The colors for lines and points (will be mapped to
|
fill |
The background colors for points (will be mapped to
|
symbol |
A vector of plotting characters or symbols (will be mapped to
|
size |
A length-two |
xlim |
A length-two |
ylim |
A length-two |
main |
A |
sub |
A |
xlab , ylab |
A |
ann |
A |
frame.plot |
A |
panel.first |
An |
panel.last |
An |
ellipse |
A |
hull |
A |
legend |
A |
Author(s)
N. Frerebeau
Tolerance Ellipses
Description
Plots tolerance ellipses.
Usage
viz_tolerance(x, y, ...)
wrap_tolerance(x, y, ...)
## S4 method for signature 'numeric,numeric'
viz_tolerance(
x,
y,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'MultivariateAnalysis,missing'
viz_tolerance(
x,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'MultivariateBootstrap,missing'
viz_tolerance(
x,
...,
level = 0.95,
color = FALSE,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'PCOA,missing'
viz_tolerance(
x,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
## S4 method for signature 'numeric,numeric'
wrap_tolerance(x, y, group = NULL, level = 0.95)
## S4 method for signature 'MultivariateAnalysis,missing'
wrap_tolerance(
x,
margin = 1,
axes = c(1, 2),
group = NULL,
level = 0.95,
principal = TRUE
)
## S4 method for signature 'PCOA,missing'
wrap_tolerance(x, axes = c(1, 2), group = NULL, level = 0.95)
Arguments
x , y |
A |
... |
Further graphical parameters to be passed to
|
group |
A vector specifying the group an observation belongs to. |
level |
A |
color |
The colors for borders (will be mapped to |
fill |
The background colors (will be mapped to |
symbol |
A vector of symbols (will be mapped to |
margin |
A length-one |
axes |
A length-two |
principal |
A |
Value
wrap_tolerance()
returns a data.frame
of envelope x
and y
coordinates. An extra column named group
is added specifying the group an
observation belongs to.
viz_tolerance()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other envelopes:
viz_confidence()
,
viz_ellipses()
,
viz_hull()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Compute tolerance ellipse coordinates
conf <- wrap_confidence(X, margin = 1, group = "Species", level = 0.95)
## Plot tolerance ellipses
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_tolerance(X, group = iris$Species, color = col, level = 0.95)
Visualize Variables Factor Map
Description
Plots column/variable principal coordinates.
Usage
viz_variables(x, ...)
viz_columns(x, ...)
## S4 method for signature 'MultivariateAnalysis'
viz_columns(
x,
...,
axes = c(1, 2),
active = TRUE,
sup = TRUE,
labels = FALSE,
extra_quali = NULL,
extra_quanti = NULL,
color = NULL,
fill = FALSE,
symbol = FALSE,
size = c(1, 6),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
panel.first = NULL,
panel.last = NULL,
legend = list(x = "topleft")
)
## S4 method for signature 'MultivariateBootstrap'
viz_columns(
x,
...,
axes = c(1, 2),
color = FALSE,
fill = FALSE,
symbol = FALSE,
legend = NULL
)
## S4 method for signature 'PCA'
viz_variables(
x,
...,
axes = c(1, 2),
active = TRUE,
sup = TRUE,
labels = list(filter = "contribution", n = 10),
extra_quali = NULL,
extra_quanti = NULL,
color = NULL,
symbol = NULL,
size = 1,
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
panel.first = NULL,
panel.last = NULL,
legend = list(x = "topleft")
)
## S4 method for signature 'CA'
viz_variables(
x,
...,
axes = c(1, 2),
active = TRUE,
sup = TRUE,
labels = FALSE,
extra_quali = NULL,
extra_quanti = NULL,
color = NULL,
fill = FALSE,
symbol = FALSE,
size = c(1, 6),
xlim = NULL,
ylim = NULL,
main = NULL,
sub = NULL,
panel.first = NULL,
panel.last = NULL,
legend = list(x = "topleft")
)
## S4 method for signature 'BootstrapPCA'
viz_variables(
x,
...,
axes = c(1, 2),
color = FALSE,
fill = FALSE,
symbol = FALSE,
legend = NULL
)
Arguments
x |
|
... |
Further graphical parameters. |
axes |
A length-two |
active |
A |
sup |
A |
labels |
A |
extra_quali |
An optional vector of qualitative data for aesthetics mapping. |
extra_quanti |
An optional vector of quantitative data for aesthetics
mapping. If a single |
color |
The colors for lines and points (will be mapped to
|
fill |
The background colors for points (will be mapped to
|
symbol |
A vector of plotting characters or symbols (will be mapped to
|
size |
A length-two |
xlim |
A length-two |
ylim |
A length-two |
main |
A |
sub |
A |
panel.first |
An |
panel.last |
An |
legend |
A |
Value
viz_*()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
Author(s)
N. Frerebeau
See Also
Other plot methods:
biplot()
,
plot()
,
screeplot()
,
viz_contributions()
,
viz_individuals()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Plot individuals
viz_individuals(X, panel.last = graphics::grid())
## Labels of the 10 individuals with highest cos2
viz_individuals(X, labels = list(filter = "cos2", n = 10))
## Plot variables
viz_variables(X, panel.last = graphics::grid())
## Graphical parameters
## Continuous values
viz_individuals(X, extra_quanti = iris$Petal.Length, symbol = 16, size = c(1, 2))
viz_individuals(X, extra_quanti = iris$Petal.Length, symbol = 16, size = c(1, 2),
color = grDevices::hcl.colors(12, "RdPu"))
viz_variables(X, extra_quanti = "contribution",
color = grDevices::hcl.colors(12, "BluGrn", rev = TRUE),
size = c(0, 1))
## Discrete values
viz_individuals(X, extra_quali = iris$Species, symbol = 21:23)
viz_individuals(X, extra_quali = iris$Species, symbol = 21:23,
fill = c("#004488", "#DDAA33", "#BB5566"),
color = "black")
viz_variables(X, extra_quali = c("Petal", "Petal", "Sepal", "Sepal"),
color = c("#EE7733", "#0077BB"),
symbol = c(1, 3))