Title: | Automatic Description of Factorial Analysis |
---|---|
Description: | Brings a set of tools to help and automatically realise the description of principal component analyses (from 'FactoMineR' functions). Detection of existing outliers, identification of the informative components, graphical views and dimensions description are performed threw dedicated functions. The Investigate() function performs all these functions in one, and returns the result as a report document (Word, PDF or HTML). |
Authors: | Simon Thuleau, Francois Husson |
Maintainer: | Francois Husson <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.8 |
Built: | 2025-02-05 03:25:33 UTC |
Source: | https://github.com/husson/factoinvestigate |
Brings a set of tools to help and automatically realise the description of principal component analyses (from 'FactoMineR' functions). Detection of existing outliers, identification of the informative components, graphical views and dimensions description are performed threw dedicated functions. The Investigate() function performs all these functions in one, and returns the result as a report document (Word, PDF or HTML).
The DESCRIPTION file:
Package: | FactoInvestigate |
Type: | Package |
Title: | Automatic Description of Factorial Analysis |
Version: | 1.8 |
Author: | Simon Thuleau, Francois Husson |
Maintainer: | Francois Husson <[email protected]> |
Description: | Brings a set of tools to help and automatically realise the description of principal component analyses (from 'FactoMineR' functions). Detection of existing outliers, identification of the informative components, graphical views and dimensions description are performed threw dedicated functions. The Investigate() function performs all these functions in one, and returns the result as a report document (Word, PDF or HTML). |
Depends: | R (>= 4.0) |
URL: | http://factominer.free.fr/reporting/ |
Imports: | FactoMineR, stats, methods, graphics, rmarkdown, parallel, ggplot2 |
License: | GPL (>= 2) |
Encoding: | latin1 |
LazyLoad: | yes |
Repository: | https://husson.r-universe.dev |
RemoteUrl: | https://github.com/husson/factoinvestigate |
RemoteRef: | HEAD |
RemoteSha: | dc83690bfadd4fc26fc28ec6758bad8592ab608c |
Index of help topics:
FactoInvestigate-package Automatic Description of Factorial Analysis Investigate Resume factorial Analysis classif Classification description createRmd Create Rmarkdown file description Factorial dimensions description dimActive Number of active dimensions dimRestrict Significant dimensions identification eigenRef Reference eigen value factoGraph Factorial graphs getParam Factorial parameters graphCA Correspondance Analysis factor map graphHab Colored factor graph graphInd Individuals factor map graphSup Supplementary variables factor map graphVar Variables factor map inertiaDistrib Inertia distribution analysis outliers Outliers detection readRmd Read Rmarkdown file scriptRmd File script selection Graphical elements selection whichFacto Analysis class writeRmd Write Rmarkdown file
An overview of how to use the package, including the most important functions
Simon Thuleau, Francois Husson
Maintainer: Francois Husson <[email protected]>
Realise the hierachical ascending classification (HCPC
function) of the individuals (or rows) and describe the specifications of each cluster.
classif(res, file = "", dim = 1:2, nclust = -1, selec = "contrib", coef = 1, mmax = 10, nmax = 10, figure.title = "Figure", graph = TRUE, options = NULL)
classif(res, file = "", dim = 1:2, nclust = -1, selec = "contrib", coef = 1, mmax = 10, nmax = 10, figure.title = "Figure", graph = TRUE, options = NULL)
res |
an object of class PCA, CA or MCA. |
file |
the file path where to write the description in Rmarkdown langage. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to describe (by default the first plane). |
nclust |
an integer forcing the number of clusters desired. The value -1 return the clustering evaluated as the most appropriate (default). |
selec |
the selection criterion of individuals to plot on the graph. |
coef |
a numerical coefficient to adjust the selection rule (exemple : if equals 2, the threshold is 2 times higher, and thus more restrictive) |
mmax |
an integer giving the maximum number of individuals to illustrate each cluster (by defaut 10). |
nmax |
an integer giving the maximum number of variables to illustrate each cluster (by defaut 10). |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
options |
a character string that gives the output options for the figures.
If NULL, |
The selec
argument is used in order to select a part of the individuals that are drawn and described. For example, you can use either :
- selec = 1:5
then the individuals numbered 1 to 5 are drawn.
- selec = c("name1","name5")
then the individuals named name1
and name5
are drawn.
- selec = "contrib 10"
then the 10 active or illustrative individuals that have the highest contribution on the 2 dimensions of the plane are drawn.
- selec = "contrib"
then the optimal number of active or illustrative individuals that have the highest contribution on the 2 dimensions of the plane are drawn.
- selec = "cos2 5"
then the 5 active or illustrative individuals that have the highest cos2 on the 2 dimensions of the plane are drawn.
- selec = "cos2 0.8"
then the active or illustrative individuals that have a cos2
higher to 0.8
on the plane are drawn.
- selec = "cos2"
then the optimal number of active or illustrative individuals that have the highest cos2 on the 2 dimensions of the plane are drawn.
The coef
argument is used in order to adjust the selection of the individuals when based on selec = "contrib"
or selec = "cos2"
. For example :
- if coef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if coef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
res.hcpc |
the result of the |
Simon Thuleau and Francois Husson
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) classif(res.pca, file = "PCA.Rmd") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) classif(res.ca, file = "CA.Rmd") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) classif(res.mca, file = "MCA.Rmd") ## End(Not run)
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) classif(res.pca, file = "PCA.Rmd") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) classif(res.ca, file = "CA.Rmd") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) classif(res.mca, file = "MCA.Rmd") ## End(Not run)
Intialise a Rmarkdown file in which to write the results of the package functions.
createRmd(res, analyse = "PCA", file = "", document = c("word_document", "pdf_document", "html_document"))
createRmd(res, analyse = "PCA", file = "", document = c("word_document", "pdf_document", "html_document"))
res |
an object of class PCA, CA or MCA. |
analyse |
A character string corresponding to the method for which the Rmd is created |
file |
the file path where to write the description in Rmarkdown langage. If the file already exists, its content is overwritten. If not specified, the description is written in the console. |
document |
a character vector giving the document format desired between "word_document", "pdf_document" and "html_document". |
Simon Thuleau and Francois Husson
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) createRmd(res.pca, file = "PCA.Rmd", document = "pdf_document") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) createRmd(res.ca, file = "CA.Rmd", document = "html_document") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) createRmd(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) ## End(Not run)
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) createRmd(res.pca, file = "PCA.Rmd", document = "pdf_document") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) createRmd(res.ca, file = "CA.Rmd", document = "html_document") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) createRmd(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) ## End(Not run)
Describe a couple of dimensions, giving the individuals specific to each dimension, and the variables that characterize each group of individuals.
description(res, file = "", dim = 1:2, desc = dim, Iselec = "contrib", Vselec = "cos2", Rselec = "cos2", Cselec = "cos2", Icoef = 1, Vcoef = 1, Rcoef = 1, Ccoef = 1, mmax = 10, nmax = 10)
description(res, file = "", dim = 1:2, desc = dim, Iselec = "contrib", Vselec = "cos2", Rselec = "cos2", Cselec = "cos2", Icoef = 1, Vcoef = 1, Rcoef = 1, Ccoef = 1, mmax = 10, nmax = 10)
res |
an object of class PCA, CA or MCA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane). |
desc |
a 2 dimensional numerical vector giving the factorial dimensions to describe (by default the |
Iselec |
the individuals to select; see the details section. |
Vselec |
the variables to select; see the details section. |
Rselec |
the rows to select (for a |
Cselec |
the columns to select (for a |
Icoef |
a numerical coefficient to adjust the individuals selection rule; see the details section. |
Vcoef |
a numerical coefficient to adjust the variables selection rule; see the details section. |
Rcoef |
a numerical coefficient to adjust the rows selection rule (for a |
Ccoef |
a numerical coefficient to adjust the columns selection rule (for a |
mmax |
an integer giving the maximum number of individuals to illustrate each cluster (by default 10). |
nmax |
an integer giving the maximum number of variables to illustrate each cluster (by default 10). |
The Iselec
argument (respectively Vselec
, Rselec
or Cselec
) is used in order to select a part of the elements that are drawn and described. For example, you can use either :
- Iselec = 1:5
then the individuals (respectively the variables, the rows or the columns) numbered 1 to 5 are drawn.
- Iselec = c("name1","name5")
then the individuals (respectively the variables, the rows or the columns) named name1
and name5
are drawn.
- Iselec = "contrib 10"
then the 10 active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "contrib"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 5"
then the 5 active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 0.8"
then the active or illustrative individuals (respectively the variables, the rows or the columns) that have a cos2
higher to 0.8
on the plane are drawn.
- Iselec = "cos2"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Icoef
argument (respectively Vcoef
, Rcoef
or Ccoef
) is used in order to adjust the selection of the elements when based on Iselec = "contrib"
or Iselec = "cos2"
. For example :
- if Icoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Icoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) description(res.pca, file = "PCA.Rmd", dim = 1:2) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) description(res.pca, file = "PCA.Rmd", dim = 1:2) ## End(Not run)
Give the number of active elements used to build the factorial analysis : individuals (or rows) and variables (or columns)
dimActive(res)
dimActive(res)
res |
an object of class PCA, CA or MCA. |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) dimActive(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) dimActive(res.pca) ## End(Not run)
Evaluate the number of significant dimensions in the data.
dimRestrict(res, file = "", rand = NULL)
dimRestrict(res, file = "", rand = NULL)
res |
an object of class PCA, CA or MCA. |
file |
the file path where to write the function execution in Rmarkdown language. If not specified, the description is written in the console. |
rand |
an optional vector of eigenvalues to compare the observation with. If NULL, use the result of the |
ncp |
the number of significant dimensions. |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) dimRestrict(res.pca, file = "PCA.Rmd") ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) dimRestrict(res.pca, file = "PCA.Rmd") ## End(Not run)
Compute the eigen values of random datasets, with the hypothesis of independence.
eigenRef(res, dim = NULL, q = 0.95, time = "10000L", parallel = TRUE)
eigenRef(res, dim = NULL, q = 0.95, time = "10000L", parallel = TRUE)
res |
an object of class PCA, CA or MCA |
dim |
a numerical vector giving the factorial dimensions for with to compute the eigenvalues calculation. |
q |
the quantile of computed values to use as reference value (ie. the confidence about the signification of dimensions) |
time |
a character indicating the loop condition. This string is made of a number and a letter coupled. The number X with letter |
parallel |
a boolean : if |
datasets |
the number of random datasets simulated. |
quantile |
the quantile used for the reference definition. |
inertia |
the reference inertia for the dimensions declared. |
Simon Thuleau and Francois Husson
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) eigenRef(res.pca, q = 0.95, time = "10s") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) eigenRef(res.ca, q = 0.99, time = "10000L") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) eigenRef(res.mca, dim = 1:8, q = 0.90, time = "10s") ## End(Not run)
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) eigenRef(res.pca, q = 0.95, time = "10s") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) eigenRef(res.ca, q = 0.99, time = "10000L") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) eigenRef(res.mca, dim = 1:8, q = 0.90, time = "10s") ## End(Not run)
Realise all optimised factorial graphs
factoGraph(res, file = "", dim = 1:2, hab = NULL, ellipse = TRUE, Iselec = "contrib", Vselec = "cos2", Rselec = "cos2", Cselec = "cos2", Mselec = "cos2", Icoef = 1, Vcoef = 1, Rcoef = 1, Ccoef = 1, Mcoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphInd = NULL, codeGraphVar = NULL ,codeGraphCA = NULL, options = NULL)
factoGraph(res, file = "", dim = 1:2, hab = NULL, ellipse = TRUE, Iselec = "contrib", Vselec = "cos2", Rselec = "cos2", Cselec = "cos2", Mselec = "cos2", Icoef = 1, Vcoef = 1, Rcoef = 1, Ccoef = 1, Mcoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphInd = NULL, codeGraphVar = NULL ,codeGraphCA = NULL, options = NULL)
res |
an object of class PCA, CA or MCA |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane) |
hab |
a variable name or index to use to color the individuals (or rows) among the variable categories. |
ellipse |
a boolean : if |
Iselec |
the individuals to select ; see the details section |
Vselec |
the variables to select ; see the details section |
Rselec |
the rows to select (for a |
Cselec |
the columns to select (for a |
Mselec |
the supplementary variables to select ; see the details section |
Icoef |
a numerical coefficient to adjust the individuals selection rule ; see the details section |
Vcoef |
a numerical coefficient to adjust the variables selection rule ; see the details section |
Rcoef |
a numerical coefficient to adjust the rows selection rule (for a |
Ccoef |
a numerical coefficient to adjust the columns selection rule (for a |
Mcoef |
a numerical coefficient to adjust the supplementary variables selection rule ; see the details section |
figure.title |
the text label to add before graph title |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
codeGraphInd |
a character string corresponding to the code to use for the individuals graph. |
codeGraphVar |
a character string corresponding to the code to use for the variables graph. |
codeGraphCA |
a character string corresponding to the code to use for the CA graph. |
options |
a character string that gives the output options fir the figures.
If NULL, |
The Iselec
argument (respectively Vselec
, Rselec
or Cselec
) is used in order to select a part of the elements that are drawn and described. For example, you can use either :
- Iselec = 1:5
then the individuals (respectively the variables, the rows or the columns) numbered 1 to 5 are drawn.
- Iselec = c("name1","name5")
then the individuals (respectively the variables, the rows or the columns) named name1
and name5
are drawn.
- Iselec = "contrib 10"
then the 10 active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "contrib"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 5"
then the 5 active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 0.8"
then the active or illustrative individuals (respectively the variables, the rows or the columns) that have a cos2
higher to 0.8
on the plane are drawn.
- Iselec = "cos2"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Icoef
argument (respectively Vcoef
, Rcoef
or Ccoef
) is used in order to adjust the selection of the elements when based on Iselec = "contrib"
or Iselec = "cos2"
. For example :
- if Icoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Icoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
graphInd
, graphHab
, graphCA
, graphVar
, graphSup
require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) ## Not run: factoGraph(res.pca) require(FactoMineR) data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) factoGraph(res.ca) data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) factoGraph(res.mca) ## End(Not run)
require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) ## Not run: factoGraph(res.pca) require(FactoMineR) data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) factoGraph(res.ca) data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) factoGraph(res.mca) ## End(Not run)
Get all the factorial object parameters
getParam(res)
getParam(res)
res |
an object of class PCA, CA or MCA. |
data |
the dataset. |
ind |
the number of individuals. |
var |
the number of variables. |
row |
the number of rows (CA). |
col |
the number of columns (CA). |
ind.sup |
the number of supplementary individuals. |
quanti.sup |
the number of quantitative supplementary variables. |
quali.sup |
the number of qualitative supplementary variables. |
row.sup |
the number of supplementary rows (CA). |
col.sup |
the number of supplementary columns (CA). |
row.w |
the weights of each row. |
col.w |
the weights of each columns. |
scale |
a boolean indicating if the variables are scaled or not. |
ncp.mod |
the number of component kept in the analysis object. |
modalites |
the list of factors for each qualitative variables. |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) getParam(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) getParam(res.pca) ## End(Not run)
Realise the Correspondence Analysis simultaneous graph
graphCA(res, file = "", dim = 1:2, Rselec = "cos2", Cselec = "cos2", Rcoef = 1, Ccoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphCA = NULL,options = NULL)
graphCA(res, file = "", dim = 1:2, Rselec = "cos2", Cselec = "cos2", Rcoef = 1, Ccoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphCA = NULL,options = NULL)
res |
an object of class CA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane) |
Rselec |
the rows to select ; see the details section. |
Cselec |
the columns to select ; see the details section. |
Rcoef |
a numerical coefficient to adjust the rows selection rule ; see the details section. |
Ccoef |
a numerical coefficient to adjust the columns selection rule ; see the details section. |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
codeGraphCA |
a character string corresponding to the code to use for the CA graph. |
options |
a character string that gives the output options fir the figures.
If NULL, |
The Rselec
argument (respectively Cselec
) is used in order to select a part of the elements that are drawn and described. For example, you can use either :
- Rselec = 1:5
then the rows (the columns) numbered 1 to 5 are drawn.
- Rselec = c("name1","name5")
and then the rows (the columns) named name1
and name5
are drawn.
- Rselec = "contrib 10"
then the 10 active or illustrative rows (the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Rselec = "contrib"
then the optimal number of active or illustrative rows (the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Rselec = "cos2 5"
then the 5 active or illustrative rows (the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Rselec = "cos2 0.8"
then the active or illustrative rows (the columns) that have a cos2
higher to 0.8
on the plane are drawn.
- Rselec = "cos2"
then the optimal number of active or illustrative rows (the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Rcoef
argument (respectively Ccoef
) is used in order to adjust the selection of the elements when based on Rselec = "contrib"
or Rselec = "cos2"
. For example :
- if Rcoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Rcoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
factoGraph
, graphInd
, graphHab
, graphVar
, graphSup
require(FactoMineR) data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) ## Not run: graphCA(res.ca) ## End(Not run)
require(FactoMineR) data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) ## Not run: graphCA(res.ca) ## End(Not run)
Realised the graph of individuals colored after a variable categories
graphHab(res, file = "", dim = 1:2, hab = NULL, ellipse = TRUE, Iselec = "contrib", Rselec = "cos2", Cselec = "contrib", Icoef = 1, Rcoef = 1, Ccoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, options = NULL)
graphHab(res, file = "", dim = 1:2, hab = NULL, ellipse = TRUE, Iselec = "contrib", Rselec = "cos2", Cselec = "contrib", Icoef = 1, Rcoef = 1, Ccoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, options = NULL)
res |
an object of class PCA, CA or MCA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane). |
hab |
a variable name or index to use to color the individuals (or rows) among the variable categories. |
ellipse |
a boolean : if |
Iselec |
the individuals to select ; see the details section. |
Rselec |
the rows to select (for a |
Cselec |
the columns to select (for a |
Icoef |
a numerical coefficient to adjust the individuals selection rule ; see the details section. |
Rcoef |
a numerical coefficient to adjust the rows selection rule (for a |
Ccoef |
a numerical coefficient to adjust the columns selection rule (for a |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
options |
a character string that gives the output options fir the figures.
If NULL, |
The Iselec
argument (respectively Rselec
or Cselec
) is used in order to select a part of the elements that are drawn and described. For example, you can use either :
- Iselec = 1:5
then the individuals (respectively the rows or the columns) numbered 1 to 5 are drawn.
- Iselec = c("name1","name5")
then the individuals (respectively the rows or the columns) named name1
and name5
are drawn.
- Iselec = "contrib 10"
then the 10 active or illustrative individuals (respectively the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "contrib"
then the optimal number of active or illustrative individuals (respectively the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 5"
then the 5 active or illustrative individuals (respectively the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 0.8"
then the active or illustrative individuals (respectively the rows or the columns) that have a cos2
higher to 0.8
on the plane are drawn.
- Iselec = "cos2"
then the optimal number of active or illustrative individuals (respectively the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Icoef
argument (respectively Rcoef
or Ccoef
) is used in order to adjust the selection of the elements when based on Iselec = "contrib"
or Iselec = "cos2"
. For example :
- if Icoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Icoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
factoGraph
, graphInd
, graphCA
, graphVar
, graphSup
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphHab(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphHab(res.pca) ## End(Not run)
Realise the optimised individuals graph
graphInd(res, file = "", dim = 1:2, Iselec = "contrib", Icoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphInd = NULL, options=NULL)
graphInd(res, file = "", dim = 1:2, Iselec = "contrib", Icoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphInd = NULL, options=NULL)
res |
an object of class PCA or MCA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane). |
Iselec |
the individuals to select ; see the details section. |
Icoef |
a numerical coefficient to adjust the individuals selection rule ; see the details section. |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
codeGraphInd |
a character string corresponding to the code to use for the individuals graph. |
options |
a character string that gives the output options fir the figures.
If NULL, |
The Iselec
argument is used in order to select a part of the individuals that are drawn and described. For example, you can use either :
- Iselec = 1:5
and then the individuals numbered 1 to 5 are drawn.
- Iselec = c("name1","name5")
then the individuals named name1
and name5
are drawn.
- Iselec = "contrib 10"
then the 10 active or illustrative individuals that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "contrib"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 5"
then the 5 active or illustrative individuals that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 0.8"
then the active or illustrative individuals that have a cos2
higher to 0.8
on the plane are drawn.
- Iselec = "cos2"
then the optimal number of active or illustrative individuals that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Icoef
argument is used in order to adjust the selection of the individuals when based on Iselec = "contrib"
or Iselec = "cos2"
. For example :
- if Icoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Icoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
factoGraph
, graphHab
, graphCA
, graphVar
, graphSup
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphInd(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphInd(res.pca) ## End(Not run)
Realise the optimised graph of supplementary variables
graphSup(res, file = "", dim = 1:2, Mselec = "cos2", Mcoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, options=NULL)
graphSup(res, file = "", dim = 1:2, Mselec = "cos2", Mcoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, options=NULL)
res |
an object of class PCA, CA or MCA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane). |
Mselec |
the supplementary variables to select ; see the details section. |
Mcoef |
a numerical coefficient to adjust the supplementary variables selection rule ; see the details section. |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
options |
a character string that gives the output options fir the figures.
If NULL, |
The Mselec
argument is used in order to select a part of the illustrative variables that are drawn and described. For example, you can use either :
- Mselec = 1:5
then the illustrative variables numbered 1 to 5 are drawn.
- Mselec = c("name1","name5")
then the illustrative variables named name1
and name5
are drawn.
- Mselec = "cos2 5"
then the 5 illustrative variables that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Mselec = "cos2 0.8"
then the illustrative variables that have a cos2
higher to 0.8
on the plane are drawn.
- Mselec = "cos2"
then the optimal number of illustrative variables that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Mcoef
argument is used in order to adjust the selection of the illustrative variables when based on Mselec = "cos2"
. For example :
- if Mcoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Mcoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
factoGraph
, graphInd
, graphHab
, graphCA
, graphVar
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphSup(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphSup(res.pca) ## End(Not run)
Realise the optimised variables graph
graphVar(res, file = "", dim = 1:2, Vselec = "cos2", Vcoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphVar=NULL, options=NULL)
graphVar(res, file = "", dim = 1:2, Vselec = "cos2", Vcoef = 1, figure.title = "Figure", graph = TRUE, cex = 0.7, codeGraphVar=NULL, options=NULL)
res |
an object of class PCA or MCA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane). |
Vselec |
the variables to select ; see the details section. |
Vcoef |
a numerical coefficient to adjust the variables selection rule ; see the details section. |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
codeGraphVar |
a character string corresponding to the code to use for the variables graph. |
options |
a character string that gives the output options fir the figures.
If NULL, |
The Vselec
argument is used in order to select a part of the variables that are drawn and described. For example, you can use either :
- Vselec = 1:5
then the variables numbered 1 to 5 are drawn.
- Vselec = c("name1","name5")
then the variables named name1
and name5
are drawn.
- Vselec = "contrib 10"
then the 10 active or illustrative variables that have the highest contribution on the 2 dimensions of the plane are drawn.
- Vselec = "contrib"
then the optimal number of active or illustrative variables that have the highest contribution on the 2 dimensions of the plane are drawn.
- Vselec = "cos2 5"
then the 5 active or illustrative variables that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Vselec = "cos2 0.8"
then the active or illustrative variables that have a cos2
higher to 0.8
on the plane are drawn.
- Vselec = "cos2"
then the optimal number of active or illustrative variables that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Vcoef
argument is used in order to adjust the selection of the variables when based on Vselec = "contrib"
or Vselec = "cos2"
. For example :
- if Vcoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Vcoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
Simon Thuleau and Francois Husson
factoGraph
, graphInd
, graphHab
, graphCA
, graphSup
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphVar(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) graphVar(res.pca) ## End(Not run)
Analysis of the inertia distribution among each axis, the amount and the significativity
inertiaDistrib(res, file = "", ncp = NULL, q = 0.95, time = "10000L", parallel = TRUE, figure.title = "Figure", graph = TRUE, options = NULL)
inertiaDistrib(res, file = "", ncp = NULL, q = 0.95, time = "10000L", parallel = TRUE, figure.title = "Figure", graph = TRUE, options = NULL)
res |
an object of class PCA, CA or MCA. |
file |
the file path where to write the description in Rmarkdown language. If not specified, the description is written in the console. |
ncp |
an integer to force the number of dimension to analyse. |
q |
the quantile of computed values to use as reference value (ie. the confidence about the signification of dimensions). |
time |
a character indicating the loop condition. This string is made of a number and a letter coupled. The number X with letter |
parallel |
a boolean : if |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
options |
a character string that gives the output options fir the figures.
If NULL, |
ncp |
the number of significant dimensions (or the dimensions kept). |
Simon Thuleau and Francois Husson
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) inertiaDistrib(res.pca, q = 0.95, time = "10s") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) inertiaDistrib(res.ca, q = 0.99, time = "10000L") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) inertiaDistrib(res.mca, dim = 1:8, q = 0.90, time = "10s") ## End(Not run)
## Not run: data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) inertiaDistrib(res.pca, q = 0.95, time = "10s") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) inertiaDistrib(res.ca, q = 0.99, time = "10000L") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) inertiaDistrib(res.mca, dim = 1:8, q = 0.90, time = "10s") ## End(Not run)
Compute all the package functions : detection of outliers, evaluation of inertia distribution, dimensions description, classification and realisation of graphical views. All the results are written as Word, html or PDF documents.
Investigate(res, file = "Investigate.Rmd", document = c("html_document"), Iselec = "contrib", Vselec = "cos2", Rselec = "contrib", Cselec = "cos2", Mselec = "cos2", Icoef = 1, Vcoef = 1, Rcoef = 1, Ccoef = 1, Mcoef = 1, ncp = NULL, time = "10s", nclust = -1, mmax = 10, nmax = 10, hab = NULL, ellipse = TRUE, display.HCPC = TRUE, out.selec = TRUE, remove.temp = TRUE, parallel = TRUE, cex = 0.7, openFile = TRUE, keepRmd = FALSE, codeGraphInd = NULL, codeGraphVar=NULL, codeGraphCA = NULL, options = NULL, language = "auto")
Investigate(res, file = "Investigate.Rmd", document = c("html_document"), Iselec = "contrib", Vselec = "cos2", Rselec = "contrib", Cselec = "cos2", Mselec = "cos2", Icoef = 1, Vcoef = 1, Rcoef = 1, Ccoef = 1, Mcoef = 1, ncp = NULL, time = "10s", nclust = -1, mmax = 10, nmax = 10, hab = NULL, ellipse = TRUE, display.HCPC = TRUE, out.selec = TRUE, remove.temp = TRUE, parallel = TRUE, cex = 0.7, openFile = TRUE, keepRmd = FALSE, codeGraphInd = NULL, codeGraphVar=NULL, codeGraphCA = NULL, options = NULL, language = "auto")
res |
a PCA, CA or MCA object. |
file |
the file path where to write the description in Rmarkdown language. If the file already exists, its content is overwritten. If not specified, the description is written in the console. |
document |
a character vector giving the document format desired between "word_document", "pdf_document" and "html_document". |
Iselec |
the individuals to select ; see the details section. |
Vselec |
the variables to select ; see the details section. |
Rselec |
the rows to select (for a |
Cselec |
the columns to select (for a |
Mselec |
the supplementary variables to select ; see the details section. |
Icoef |
a numerical coefficient to adjust the individuals selection rule ; see the details section. |
Vcoef |
a numerical coefficient to adjust the variables selection rule ; see the details section. |
Rcoef |
a numerical coefficient to adjust the rows selection rule (for a |
Ccoef |
a numerical coefficient to adjust the columns selection rule (for a |
Mcoef |
a numerical coefficient to adjust the supplementary variables selection rule ; see the details section. |
ncp |
an integer to force the number of dimension to analyse. |
time |
a character indicating the loop condition. This string is made of a number and a letter coupled. The number X with letter |
nclust |
an integer to force the number of cluster for the classification. |
mmax |
an integer giving the maximum number of individuals (or rows) to illustrate each group (by defaut 10). |
nmax |
an integer giving the maximum number of variables (or columns) to illustrate each group of individuals (by defaut 10). |
hab |
a variable name or index to use to color the individuals (or rows) among the variable categories. |
ellipse |
a boolean : if |
display.HCPC |
a boolean : if |
out.selec |
a boolean : if |
remove.temp |
a boolean : if |
parallel |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
openFile |
Open the file with the appropriate application; TRUE by default |
keepRmd |
Keep the Rmd file; FALSE by default |
codeGraphInd |
a character string corresponding to the code to use for the individuals graph. |
codeGraphVar |
a character string corresponding to the code to use for the variables graph. |
codeGraphCA |
a character string corresponding to the code to use for the CA graph. |
options |
a character string that gives the output options fir the figures.
If NULL, |
language |
possible values "auto", "en", or "fr": by default, "auto" detects the language (English or French), "en" for English and "fr" for "French" |
The Iselec
argument (respectively Vselec
, Rselec
or Cselec
) is used in order to select a part of the elements that are drawn and described. For example, you can use either :
- Iselec = 1:5
then the individuals (respectively the variables, the rows or the columns) numbered 1 to 5 are drawn.
- Iselec = c("name1","name5")
then the individuals (respectively the variables, the rows or the columns) named name1
and name5
are drawn.
- Iselec = "contrib 10"
then the 10 active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "contrib"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest contribution on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 5"
then the 5 active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Iselec = "cos2 0.8"
then the active or illustrative individuals (respectively the variables, the rows or the columns) that have a cos2
higher to 0.8
on the plane are drawn.
- Iselec = "cos2"
then the optimal number of active or illustrative individuals (respectively the variables, the rows or the columns) that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Icoef
argument (respectively Vcoef
, Rcoef
or Ccoef
) is used in order to adjust the selection of the elements when based on Iselec = "contrib"
or Iselec = "cos2"
. For example :
- if Icoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Icoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
the function creates and opens a Word, html or PDF document that contains all the descriptions of analysis.
Simon Thuleau and Francois Husson
require(FactoMineR) data(decathlon) ## Not run: res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) Investigate(res.pca, file = "PCA.Rmd", document = "html_document", time = "1000L", parallel = FALSE) data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) Investigate(res.ca, file = "CA.Rmd", document = "pdf_document") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) Investigate(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) ## End(Not run)
require(FactoMineR) data(decathlon) ## Not run: res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) Investigate(res.pca, file = "PCA.Rmd", document = "html_document", time = "1000L", parallel = FALSE) data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) Investigate(res.ca, file = "CA.Rmd", document = "pdf_document") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) Investigate(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) ## End(Not run)
Detection of singular individuals that concentrates too much inertia.
outliers(res, file = "", Vselec = "cos2", Vcoef = 1, nmax = 10, figure.title = "Figure", graph = TRUE, cex = 0.7, options = NULL)
outliers(res, file = "", Vselec = "cos2", Vcoef = 1, nmax = 10, figure.title = "Figure", graph = TRUE, cex = 0.7, options = NULL)
res |
an object of class PCA or MCA. |
file |
a numerical vector giving the factorial dimensions for with to compute the eigen values calculation. |
Vselec |
the variables to select ; see the details section. |
Vcoef |
a numerical coefficient to adjust the variables selection rule ; see the details section. |
nmax |
an integer giving the maximum number of variables to illustrate each outlier (by default 10). |
figure.title |
the text label to add before graph title. |
graph |
a boolean : if |
cex |
an optional argument for the generic plot functions, used to adjust the size of the elements plotted. |
options |
a character string that gives the output options for the figures.
If NULL, |
The algorithm detects an individual as an outlier if its contribution to the plane if higher to 3 standard deviation.
The Vselec
argument is used in order to select a part of the variables that are drawn and described. For example, you can use either :
- Vselec = 1:5
then the variables numbered 1 to 5 are drawn.
- Vselec = c("name1","name5")
then the variables named name1
and name5
are drawn.
- Vselec = "contrib 10"
then the 10 active or illustrative variables that have the highest contribution on the 2 dimensions of the plane are drawn.
- Vselec = "contrib"
then the optimal number of active or illustrative variables that have the highest contribution on the 2 dimensions of the plane are drawn.
- Vselec = "cos2 5"
then the 5 active or illustrative variables that have the highest cos2 on the 2 dimensions of the plane are drawn.
- Vselec = "cos2 0.8"
then the active or illustrative variables that have a cos2
higher to 0.8
on the plane are drawn.
- Vselec = "cos2"
then the optimal number of active or illustrative variables that have the highest cos2 on the 2 dimensions of the plane are drawn.
The Vcoef
argument is used in order to adjust the selection of the variables when based on Vselec = "contrib"
or Vselec = "cos2"
. For example :
- if Vcoef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if Vcoef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
new.res |
the res object without the outliers (they are completely eliminated). |
res.out |
the res object with the outliers as supplementary individuals. |
memory |
the original res object. |
N |
the number of outliers. |
ID |
the label of outliers. |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) outliers(res.pca, file = "PCA.Rmd") ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) outliers(res.pca, file = "PCA.Rmd") ## End(Not run)
Compile and open a Rmarkdown file.
readRmd(file, document = "html_document")
readRmd(file, document = "html_document")
file |
the file path where to write the description in Rmarkdown langage. If not specified, the description is written in the console. |
document |
a character vector giving the document format desired between "word_document", "pdf_document" and "html_document". This have to be any of those indicated in the file config (by |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) create.rmd(res.pca, file = "PCA.Rmd", document = "pdf_document") readRmd(file = "PCA.Rmd", document = "pdf_document") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) create.rmd(res.ca, file = "CA.Rmd", document = "html_document") readRmd(file = "CA.Rmd", document = "html_document") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) create.rmd(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) readRmd(file = "MCA.Rmd", document = "word_document") ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) create.rmd(res.pca, file = "PCA.Rmd", document = "pdf_document") readRmd(file = "PCA.Rmd", document = "pdf_document") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) create.rmd(res.ca, file = "CA.Rmd", document = "html_document") readRmd(file = "CA.Rmd", document = "html_document") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) create.rmd(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) readRmd(file = "MCA.Rmd", document = "word_document") ## End(Not run)
Read the script of a file and return each line as a character chain
scriptRmd(file, output = "code.R")
scriptRmd(file, output = "code.R")
file |
the file path to read. |
output |
the file path to write the R code. |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) create.rmd(res.pca, file = "PCA.Rmd", document = "pdf_document") scriptRmd(file = "PCA.Rmd") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) create.rmd(res.ca, file = "CA.Rmd", document = "html_document") scriptRmd(file = "CA.Rmd") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) create.rmd(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) scriptRmd(file = "MCA.Rmd") ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) create.rmd(res.pca, file = "PCA.Rmd", document = "pdf_document") scriptRmd(file = "PCA.Rmd") data(children) res.ca = CA(children, row.sup = 15:18, col.sup = 6:8, graph = FALSE) create.rmd(res.ca, file = "CA.Rmd", document = "html_document") scriptRmd(file = "CA.Rmd") data(tea) res.mca = MCA(tea, quanti.sup = 19,quali.sup = 20:36, graph = FALSE) create.rmd(res.mca, file = "MCA.Rmd", document = c("word_document", "pdf_document")) scriptRmd(file = "MCA.Rmd") ## End(Not run)
Select the best elements to plot in a graph
selection(res, dim = 1:2, margin = 1, selec = "cos2", coef = 1)
selection(res, dim = 1:2, margin = 1, selec = "cos2", coef = 1)
res |
an object of class PCA, CA or MCA. |
dim |
a 2 dimensional numerical vector giving the factorial dimensions to use for the representation (by default the first plane). |
margin |
an integer (by default 1). If equals 1, the function computes on the individuals (or rows). If equals 2, the function computes on the active variables (or columns). If equals 3, the function computes on the supplementary variables. |
selec |
the elements to select ; see the details section. |
coef |
a numerical coefficient to adjust the elements selection rule ; see the details section. |
The selec
argument is used in order to select a part of the elements that are drawn and described. For example, you can use either :
- selec = 1:5
then the elements numbered 1 to 5 are drawn.
- selec = c("name1","name5")
then the elements named name1
and name5
are drawn.
- selec = "contrib 10"
then the 10 active or illustrative elements that have the highest contribution on the 2 dimensions of the plane are drawn.
- selec = "contrib"
then the optimal number of active or illustrative elements that have the highest contribution on the 2 dimensions of the plane are drawn.
- selec = "cos2 5"
then the 5 active or illustrative elements that have the highest cos2 on the 2 dimensions of the plane are drawn.
- selec = "cos2 0.8"
then the active or illustrative elements that have a cos2
higher to 0.8
on the plane are drawn.
- selec = "cos2"
then the optimal number of active or illustrative elements that have the highest cos2 on the 2 dimensions of the plane are drawn.
The coef
argument is used in order to adjust the selection of the elements when based on selec = "contrib"
or selec = "cos2"
. For example :
- if coef = 2
, the threshold is 2 times higher, and thus 2 times more restrictive.
- if coef = 0.5
, the threshold is 2 times lower, and thus 2 times less restrictive.
drawn |
the elements selected. |
what.drawn |
the criterion of selection (as a sentence). |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) selection(res.pca, margin = 1, selec = "contrib 10") ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) selection(res.pca, margin = 1, selec = "contrib 10") ## End(Not run)
Return the class of the factorial object (ie. the kind of analysis performed)
whichFacto(res)
whichFacto(res)
res |
an object of class PCA, CA or MCA. |
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) whichFacto(res.pca) ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) whichFacto(res.pca) ## End(Not run)
Writes text or dumps a variable in a Rmarkdown file, and declares the utilisation and the configuration of a chunk.
writeRmd(..., file = "", append = TRUE, sep = " ", end = "\n", dump = FALSE, start = FALSE, stop = FALSE, options = NULL)
writeRmd(..., file = "", append = TRUE, sep = " ", end = "\n", dump = FALSE, start = FALSE, stop = FALSE, options = NULL)
... |
some R objects or other arguments to pass to the |
file |
the file path where to write the description in Rmarkdown langage. If not specified, the description is written in the console. |
append |
a boolean, if TRUE the text is written at the end of the file. Else it is overwritten. |
sep |
a character chain to insert between each element written in the file (by default a blank space). |
end |
a character chain to add at the end of the text written in the file (by default a line break). |
dump |
a boolean : if |
start |
a boolean : if |
stop |
a boolean : if |
options |
a character chain listing the options to declare for a chunk declaration. |
To learn about all the possible chunck options, see https://yihui.org/knitr/options.
Anyway, to declare a R langage chunk, write at least "r"
as option.
Simon Thuleau and Francois Husson
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) create.rmd(res.pca, file = "PCA.Rmd", document = "pdf_document") drawn = selection(res.pca)$drawn writeRmd(start = TRUE, options = "r, echo = FALSE, fig.align = 'center', fig.height = 3.5, fig.width = 5.5", file = "PCA.Rmd", end = "") writeRmd("drawn", file = file, dump = TRUE) writeRmd("plot.PCA(res, select = drawn, choix = 'ind', invisible = 'quali', title = '')", stop = TRUE, file = "PCA.Rmd") writeRmd("**", figure.title, " - ", "Individuals factor map (PCA)", "**", file = "PCA.Rmd", sep = "") ## End(Not run)
## Not run: require(FactoMineR) data(decathlon) res.pca = PCA(decathlon, quanti.sup = c(11:12), quali.sup = c(13), graph = FALSE) create.rmd(res.pca, file = "PCA.Rmd", document = "pdf_document") drawn = selection(res.pca)$drawn writeRmd(start = TRUE, options = "r, echo = FALSE, fig.align = 'center', fig.height = 3.5, fig.width = 5.5", file = "PCA.Rmd", end = "") writeRmd("drawn", file = file, dump = TRUE) writeRmd("plot.PCA(res, select = drawn, choix = 'ind', invisible = 'quali', title = '')", stop = TRUE, file = "PCA.Rmd") writeRmd("**", figure.title, " - ", "Individuals factor map (PCA)", "**", file = "PCA.Rmd", sep = "") ## End(Not run)