plot.MBPCAOS: plot.MBPCAOS

View source: R/plot.MBPCAOS.R

plot.MBPCAOSR Documentation

plot.MBPCAOS

Description

Visualisation of results from MBPCAOS method. See details for available plots.

Usage

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

Arguments

x

an object of class MBPCAOS

choice

the graph to plot possible values are "screeplot","quantif","indiv","cor","modalities","mixed","squared loadings". 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

boolean (FALSE by default), if TRUE supplementary variables are added in factorial representation

sub.var.quantif

a vector with variable of interest (quantification plots).

sub.bloc

a scalar indicating the block to plot for variables graphs (i.e if sub.bloc == 1, variables of the first block are plotted) (all.var plot).

size.label

size of label in graphs (all plots).

size.legend

size of label in graphs (all plots).

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)

min.contribution

(all.var plot) 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)

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).

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.size.freq

boolean (FALSE by default); if TRUE size of categories are proportional to their citation frequencies (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.

For mixed variables

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

  • squared.loadings: plot of the squared loadings of all the variables.

For blocs

  • blocks: contribution of each block to principal components. The contribution of one block is calculated as the squared sum of the loading of the variables in the block, divided by the block scaling of the block.

All graph are ggplot object

Value

A ggplot object

Examples


#'data('antibiotic')
antb.uses <- antibiotic[,c('Atb.conso','Atb.Sys')]
health <- antibiotic[,c('Age','Loss')]
vet.practices <- antibiotic[,c(6:15)]
antibiotic <- data.frame(antb.uses,health,vet.practices)
# Defining blocks
blocks.name =  c("antibiotic.uses","Health.of.turkeys","Veterinary.practices")
blocks <- c(2,2,10)

# Level of scaling
level.scale <- rep(NA,ncol(antibiotic))
res.nature <- nature.variables(antibiotic)
level.scale [res.nature$p.numeric] <- "num"
level.scale [res.nature$p.quali] <- "nom"
#Warning; the ordinal nature of variables can not be detected automaticaly.
level.scale[c(1,14)] <- "ord"

# MBPCAOS
res.MBPCAOS <- MBPCAOS(data = antibiotic,
                     level.scale = level.scale,
                      blocks = blocks,
                      blocks.name = blocks.name,
                      nb.comp = 3)

# Blocks graphs
plot.MBPCAOS(x = res.MBPCAOS,choice = 'blocks')


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