plot.PCAOS: plot.PCAOS

View source: R/plot.PCAOS.R

plot.PCAOSR Documentation

plot.PCAOS

Description

Visualisation of results from PCAOS method. See details for available plot.

Usage

## S3 method for class 'PCAOS'
plot(
  x,
  choice = "ind",
  comp = c(1, 2),
  coloring.indiv = NULL,
  supp.var = FALSE,
  sub.var.quantif = NULL,
  ellipse = FALSE,
  level.conf = 0.95,
  size.label = 3.5,
  size.legend = 10,
  min.contribution = 0,
  label.size.freq = FALSE,
  ordinal.as.direction = FALSE,
  label.cat = "var+cat",
  ...
)

Arguments

x

an object of class PCAOS

choice

the available graphs are "screeplot","quantif","ind","numeric","qualitative","all.var". See Details.

comp

a length 2 vector with the components to plot.

coloring.indiv

a vector of length N to color individuals. If NULL, no coloring is applied (individuals plot).

supp.var

TRUE or FALSE; if TRUE supplementary variables are added in factorial representation (individuals and variables plot).

sub.var.quantif

a vector with variable of interest (quantification plots).

ellipse

boolean (FALSE by default), if TRUE, draw ellipses around categories of the qualitative variable considered as supplementary (individuals plot).

level.conf

level of confidence ellipses (individuals plot).

size.label

size of label in graphs (all plots).

size.legend

size of label in graphs (all plots).

min.contribution

variables with a contribution (i.e loading) lower than this value will not be plotted in the 'all.var' graph (useful for dataset with a lot of variables) (all.var plot).

label.size.freq

boolean (FALSE by default); if TRUE size of categories are proportional to their citation frequencies (qualitative and all.var plot).

ordinal.as.direction

boolean (FALSE by default); if TRUE ordinal variables are represented as vectors, from the first categorie to the last one (qualitative and all.var plot).

label.cat

If == 'var+cat', the name of the variable is included in the labels of the categories; if == 'cat', only the name of the categorie is plotted (name of categories should be unique) (qualitative and all.var plot).

...

further arguments passed to or from other methods, such as cex, cex.main, ...

Details

  • screeplot: Representation of the percentage of inertia restituates (Y), for each component (X).

  • quantif: Reprensetation of the quantification of variables trought Optimal Scaling, with original variables (X) and quantified variables (Y).Possibility to select one or more variables of interest with the argument "var.sub".

  • ind: factorial representation of individuals

For numeric variables

  • numeric: factorial representation of numeric variables (also called loading plot) Each numeric variable is represented by it's weight/loadings

For qualitative (i.e nominal and ordinal) variables

  • qualitative: factorial representation of qualitatives variables trough the representation of it's categories. Coordinates of each category is calculted such as the single quantification of the category multiplied by the loading of the associated variable (rank.restriction = one). Or by averaging, per component, the principal component scores for all individuals in the same categories of a particular variable (rank.restriction = no.restriction).

For All variables

  • all.var : factorial representation of all variables (weight for numeric variables, and categories for qualitative variables)

All graph are ggplot object

Value

A ggplot object

Author(s)

Examples

data (antibiotic)
level.scale <- rep(NA,ncol(antibiotic)) #Setting level.scale argument
level.scale[c(2,3,4)] <- "num"
level.scale[c(1,5,6,7,8,9,10,11,12,13,14,15)] <- "nom"
level.scale[c(1,15)] <- "ord"
level.scale

res.PCAOS <- PCA.OS::PCAOS(
 data = antibiotic,
 level.scale = level.scale,
 supp.var = c(1,2)
)

#Individuals graph
PCA.OS::plot.PCAOS(x = res.PCAOS,choice = "ind",coloring = antibiotic$Atb.conso)
PCA.OS::plot.PCAOS(x = res.PCAOS,choice = "ind",supp.var = TRUE,ellipse = TRUE)

#Quantifications
PCA.OS::plot.PCAOS(x = res.PCAOS,choice = "quantif",sub.var.quantif =  c(4,8))

#Qualitative variables
PCA.OS::plot.PCAOS(x = res.PCAOS,choice = "qualitative",supp.var = TRUE)

#Numeric variables
PCA.OS::plot.PCAOS(x = res.PCAOS,choice = "numeric",supp.var = TRUE)

#All variables
PCA.OS::plot.PCAOS(x = res.PCAOS,choice = "all.var",supp.var = TRUE)


martinparies/PCAOS documentation built on March 15, 2023, 7:19 a.m.