MakeToleranceIntervals: # 'MakeToleranceIntervals'. Add Tolerance interval hulls or...

View source: R/MakeTIEllipses.R

MakeToleranceIntervalsR Documentation

# MakeToleranceIntervals. Add Tolerance interval hulls or ellipses to factor score plots (e.g., PCA, CA).

Description

MakeToleranceIntervals: Creates the ToleranceIntervals (CI) convex hulls or ellipses for plots for the I or J sets of a CA, PCA, MFA, STATIS, etc. type of analysis The results (Hulls or Ellipses) of MakeToleranceIntervals should be added to the BaseMap created (for example) by the function CreateBaseMap().

Usage

MakeToleranceIntervals(
  data,
  design,
  axis1 = 1,
  axis2 = 2,
  names.of.factors = paste0("Dimension ", c(axis1, axis2)),
  col = NULL,
  centers = NULL,
  line.size = 1,
  line.type = 1,
  alpha.ellipse = 0.3,
  alpha.line = 0.5,
  p.level = 0.66,
  type = "hull"
)

Arguments

data

A set of I*L factor scores (as obtained, for example, from ExPosition::epCA)

design

an I by 1 factor giving the group membership of the I observations.

axis1

(default = 1): the horizontal axis.

axis2

(default = 2): the vertical axis.

names.of.factors

(default is paste0('Dimension ',c(axis1,axis2)): names of the factors. if NULL, name.of.factors is dimnames(data)[2], if dimnames(data)[2] is NULL, the dimensions will be labelled "Dimension ". This parameter is needed to avoid (strange) conflicts when plotting these names as they must be the same as the names of the data used to make the BaseMap plot (i.e., Fi/Fj/Fij)

col

(default = NULL) a string or a vector of strings with color names if NULL use prettyGraphs scheme with prettyGraphs::prettyGraphsColorSelection

centers

(default = NULL), if NULL centers the ellipses on their respective barycenter to center on another center (i.e., item factor scores) provide an I * K data frame or matrix.

line.size

(default = 1): thickness of the line for the ellipses

line.type

(default = 1): the type of line for the ellipses

alpha.ellipse

(default = .3): alpha value (transparency) for the ellipses.

alpha.line

(default = .5): alpha value (transparency) for the lines.

p.level

(default = .66) "p-value for the TI

type

(Default = 'hull') type of interval can be c('ellipse','hull'). Note that fitting an ellipse to the whole distribution of points (i.e., p.level = 1.00) can make the ellipses going out of the graphs and produce strange results or errors. Probably better to use the default option for p.level when using type = 'ellipse'.

Value

LeGraph.elli a graph with convex hulls or ellipses to be added to the base map as created, for example, by the function CreateBaseMap().

Author(s)

Herve Abdi

Examples

## Not run: 
Fij = rbind(Fi,Fj)
# Fi and Fj being factor scores say from ExPosition
ABaseMap <- CreateBaseMap(Fij)
# Here design.matrix is design matrix describing K groups in Fi
GraphHull <- MakeToleranceIntervals(Fi,design.matrix)
print(ABaseMap + GraphHull)  # plot the K TI ellipses

## End(Not run)

HerveAbdi/PTCA4CATA documentation built on July 17, 2022, 5:41 a.m.