| Title: | 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). |
| Authors: | Nicolas Frerebeau [aut, cre] (ORCID: <https://orcid.org/0000-0001-5759-4944>), Jean-Baptiste Fourvel [ctb] (ORCID: <https://orcid.org/0000-0002-1061-4642>), Camille Thabard [ctb] (ORCID: <https://orcid.org/0000-0002-3196-7658>), Brice Lebrun [art] (ORCID: <https://orcid.org/0000-0001-7503-8685>, Logo designer), Université Bordeaux Montaigne [fnd] (ROR: <https://ror.org/03pbgwk21>), CNRS [fnd] (ROR: <https://ror.org/02feahw73>) |
| Maintainer: | Nicolas Frerebeau <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.14.1.9000 |
| Built: | 2026-06-03 06:58:26 UTC |
| Source: | https://codeberg.org/tesselle/dimensio |
Abundances of Marine Species in Sea-Bed Samples
benthosbenthos
A data.frame with 13 columns (sites) and 92 rows (species).
http://www.carme-n.org/?sec=data7
Other datasets:
colours,
countries
Biplot
## 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") )## 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") )
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 |
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.
biplot() is called for its side-effects: it results in a graphic being
displayed. Invisibly returns x.
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.
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.
N. Frerebeau
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.
Other plot methods:
plot(),
screeplot(),
viz_contributions(),
viz_individuals(),
viz_variables()
## 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"))## 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"))
Checks analysis with partial bootstrap resampling.
## S4 method for signature 'CA' bootstrap(object, n = 30) ## S4 method for signature 'PCA' bootstrap(object, n = 30)## S4 method for signature 'CA' bootstrap(object, n = 30) ## S4 method for signature 'PCA' bootstrap(object, n = 30)
object |
|
n |
A non-negative |
Returns a BootstrapCA or a BootstrapPCA object.
N. Frerebeau
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.
## 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 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))
Computes the burt table of a factor table.
burt(object, ...) ## S4 method for signature 'data.frame' burt(object, exclude = NULL, abbrev = TRUE)burt(object, ...) ## S4 method for signature 'data.frame' burt(object, exclude = NULL, abbrev = TRUE)
object |
A |
... |
Currently not used. |
exclude |
A |
abbrev |
A |
A symetric matrix.
N. Frerebeau
Other tools:
cdt()
## 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)## 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)
Computes a simple correspondence analysis based on the singular value decomposition.
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)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)
object |
A |
... |
Currently not used. |
rank |
An |
sup_row |
A |
sup_col |
A |
sup_quali |
A |
autodetect |
A |
A CA object.
N. Frerebeau
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.
Other multivariate analysis:
mca(),
pca(),
pcoa(),
predict()
## 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)## 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)
Computes the complete disjunctive table of a factor table.
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)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)
object |
A |
... |
Currently not used. |
exclude |
A |
abbrev |
A |
A data.frame.
N. Frerebeau
Other tools:
burt()
## 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)## 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)
Contingency table of eye and hair colours of different individuals.
colourscolours
A data.frame with 4 columns (hair colours) and 4 rows (eye
colours).
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
Other datasets:
benthos,
countries
Student ratings of 13 countries on six attributes.
countriescountries
A data.frame with 6 columns (attributes) and 13 rows (countries).
Greenacre, M. J. Biplots in Practice. Bilbao: Fundación BBVA, 2010.
Other datasets:
benthos,
colours
Object Description
## S4 method for signature 'CA' describe(x, ...) ## S4 method for signature 'PCA' describe(x, ...)## S4 method for signature 'CA' describe(x, ...) ## S4 method for signature 'PCA' describe(x, ...)
x |
|
... |
Further parameters to be passed to |
describe() is called for its side-effects. Invisibly returns x.
N. Frerebeau
Other summary:
summary(),
tidy()
## 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)## 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)
Retrieve or set the dimnames of an object.
## 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)## 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)
x |
An object from which to retrieve the row or column names
(a |
do.NULL |
A |
prefix |
A |
N. Frerebeau
Other mutators:
subset
Creates a Zip archive of all results in CSV format.
export(object, ...) ## S4 method for signature 'MultivariateAnalysis' export(object, file, flags = "-r9Xjq", ...) ## S4 method for signature 'PCOA' export(object, file, flags = "-r9Xjq", ...)export(object, ...) ## S4 method for signature 'MultivariateAnalysis' export(object, file, flags = "-r9Xjq", ...) ## S4 method for signature 'PCOA' export(object, file, flags = "-r9Xjq", ...)
object |
|
... |
Currently not used. |
file |
A |
flags |
A |
N. Frerebeau
utils::write.csv(), utils::zip()
Other getters:
get_contributions(),
get_coordinates(),
get_data(),
get_eigenvalues()
## 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)## 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
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")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")
x |
An object from which to get element(s) (a |
... |
Currently not used. |
margin |
A length-one |
sup_name |
A |
get_contributions() returns a data.frame of contributions to the
definition of the principal dimensions.
get_correlations() returns a data.frame of correlations between
variables and dimensions. An extra column (named after sup_name)
is added specifying whether an observation is a supplementary point or
not.
get_cos2() returns a data.frame of values (i.e.
quality of the representation of the points on the factor map). An extra
column (named after sup_name) is added specifying whether an observation
is a supplementary point or not.
N. Frerebeau
Other getters:
export(),
get_coordinates(),
get_data(),
get_eigenvalues()
Get Coordinates
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)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)
x |
An object from which to get element(s) (a |
... |
Currently not used. |
margin |
A length-one |
principal |
A |
sup_name |
A |
get_coordinates() returns a data.frame of coordinates. An extra
column (named after sup_name) is added specifying whether an observation
is a supplementary point or not.
get_replications() returns an array of coordinates.
N. Frerebeau
Other getters:
export(),
get_contributions(),
get_data(),
get_eigenvalues()
## 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)))## 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
get_data(x, ...) ## S4 method for signature 'MultivariateAnalysis' get_data(x)get_data(x, ...) ## S4 method for signature 'MultivariateAnalysis' get_data(x)
x |
An object from which to get element(s) (a |
... |
Currently not used. |
Returns a data.frame of original data.
N. Frerebeau
Other getters:
export(),
get_contributions(),
get_coordinates(),
get_eigenvalues()
Get Eigenvalues
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)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)
x |
An object from which to get element(s) (a |
... |
Currently not used. |
margin |
A length-one |
digits |
An |
get_eigenvalues() returns a data.frame with the following columns:
eigenvalues, variance (percentage of variance) and cumulative
(cumulative percentage of variance).
get_variance() returns a numeric vector giving the amount of
variance explained by each (principal) component.
get_distance()returns a numeric vector of squared distance to the
centroid.
get_inertia() returns a numeric vector giving the inertia (weighted
squared distance to the centroid).
N. Frerebeau
Other getters:
export(),
get_contributions(),
get_coordinates(),
get_data()
Computes a multiple correspondence analysis.
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)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)
object |
A |
... |
Currently not used. |
rank |
An |
sup_row |
A |
sup_col |
A |
sup_quanti |
A |
autodetect |
A |
A MCA object.
N. Frerebeau
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.
Other multivariate analysis:
ca(),
pca(),
pcoa(),
predict()
Computes a principal components analysis based on the singular value decomposition.
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 )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 )
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 |
A PCA object.
N. Frerebeau
Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.
Other multivariate analysis:
ca(),
mca(),
pcoa(),
predict()
## 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)## 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)
Computes classical (metric) multidimensional scaling.
pcoa(object, ...) ## S4 method for signature 'dist' pcoa(object, rank = 2)pcoa(object, ...) ## S4 method for signature 'dist' pcoa(object, rank = 2)
object |
|
... |
Currently not used. |
rank |
An |
A PCOA object.
N. Frerebeau
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.
Other multivariate analysis:
ca(),
mca(),
pca(),
predict()
## 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) )## 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
## 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") )## 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") )
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 |
N. Frerebeau
Other plot methods:
biplot(),
screeplot(),
viz_contributions(),
viz_individuals(),
viz_variables()
Predict the projection of new individuals/rows or variables/columns.
## 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)## 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)
object |
|
newdata |
An object of supplementary points coercible to a
|
margin |
A length-one |
A data.frame of coordinates.
N. Frerebeau
Other multivariate analysis:
ca(),
mca(),
pca(),
pcoa()
## 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)## 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)
Plot eigenvalues (scree plot) or variances histogram.
## 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" )## 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" )
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. |
screeplot() is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x.
N. Frerebeau
Other plot methods:
biplot(),
plot(),
viz_contributions(),
viz_individuals(),
viz_variables()
## Load data data("iris") ## Compute principal components analysis X <- pca(iris, scale = TRUE, sup_quali = "Species") ## Screeplot screeplot(X) screeplot(X, cumulative = TRUE)## Load data data("iris") ## Compute principal components analysis X <- pca(iris, scale = TRUE, sup_quali = "Species") ## Screeplot screeplot(X) screeplot(X, cumulative = TRUE)
Operators acting on objects to extract parts.
## S4 method for signature 'CA,ANY,missing' x[[i]] ## S4 method for signature 'PCA,ANY,missing' x[[i]]## S4 method for signature 'CA,ANY,missing' x[[i]] ## S4 method for signature 'PCA,ANY,missing' x[[i]]
x |
An object from which to extract element(s) or in which to replace element(s). |
i |
A |
If i is "data", returns a list with the following elements:
dataA numeric matrix of raw data.
meanA numeric vector giving the variables means (PCA).
sdA numeric vector giving the variables standard deviations
(PCA).
If i is "rows", returns a list with the following elements:
coordA numeric matrix of rows/individuals coordinates.
cos2A numeric matrix of rows/individuals squared cosine.
massesA numeric vector giving the rows masses/individual
weights.
supA logical vector specifying whether a point is a
supplementary observation or not.
If i is "columns", returns a list with the following elements:
coordA numeric matrix of columns/variables coordinates.
corA numeric matrix of correlation between variables and
the dimensions (PCA).
cos2A numeric matrix of columns/variables squared cosine.
massesA numeric vector giving the columns masses/variable
weights.
supA logical vector specifying whether a point is a
supplementary observation or not.
If i is "eigenvalues", returns a numeric vector of eigenvalues.
A list.
N. Frerebeau
Other mutators:
dimnames
## 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"]]## 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"]]
Provides a summary of the results of a multivariate data analysis.
## 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 )## 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 )
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 |
N. Frerebeau
Other summary:
describe,
tidy()
## 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)## 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)
Tidy Coordinates
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)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)
x |
|
... |
Currently not used. |
margin |
A length-one |
axes |
A length-two |
principal |
A |
tidy() returns a long data.frame with the following columns:
labelRow/column names of the original data.
componentComponent.
supplementaryWhether an observation is active or supplementary.
coordinateCoordinates.
contributionContributions to the definition of the components.
cos2.
augment() returns a wide data.frame of the row/column coordinates
along axes and the following columns:
labelRow/column names of the original data.
supplementaryWhether an observation is active or supplementary.
massWeight/mass of each observation.
sumSum of squared coordinates along axes.
contributionJoint contributions to the definition of axes.
cos2Joint along axes.
N. Frerebeau
Other summary:
describe,
summary()
## 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)))## 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)))
Plots confidence ellipses.
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)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)
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 |
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.
N. Frerebeau
Other envelopes:
viz_ellipses(),
viz_hull(),
viz_tolerance()
## 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)## 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)
Plots contributions histogram and scatterplot.
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" )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" )
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 |
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).
viz_contributions() and viz_cos2() are called for their side-effects:
they result in a graphic being displayed. Invisibly return x.
N. Frerebeau
Other plot methods:
biplot(),
plot(),
screeplot(),
viz_individuals(),
viz_variables()
## 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)## 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)
Plots ellipses.
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 )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 )
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 |
viz_ellipses()is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x.
N. Frerebeau
Other envelopes:
viz_confidence(),
viz_hull(),
viz_tolerance()
## 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 )## 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 )
Plots convex hull of a set of observations.
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)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)
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 |
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.
N. Frerebeau
Other envelopes:
viz_confidence(),
viz_ellipses(),
viz_tolerance()
## 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)## 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)
Plots row/individual principal coordinates.
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") )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") )
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 |
viz_*() is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x.
N. Frerebeau
Other plot methods:
biplot(),
plot(),
screeplot(),
viz_contributions(),
viz_variables()
## 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))## 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))
Plots tolerance ellipses.
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)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)
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 |
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.
N. Frerebeau
Other envelopes:
viz_confidence(),
viz_ellipses(),
viz_hull()
## 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)## 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)
Plots column/variable principal coordinates.
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 )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 )
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 |
viz_*() is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x.
N. Frerebeau
Other plot methods:
biplot(),
plot(),
screeplot(),
viz_contributions(),
viz_individuals()
## 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))## 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))