R: Plot maps of the factor scores of the observations and their...
GraphDistatisBoot
R Documentation
Plot maps of the factor scores
of the observations and their bootstrapped
confidence intervals (as confidence ellipsoids or peeled hulls)
for a DISTATIS analysis.
Description
GraphDistatisBoot plots maps of the factor scores of the observations
from a distatis analysis.
GraphDistatisBoot gives a map of the factors scores of the observations plus the
boostrapped confidence intervals drawn as "Confidence Ellipsoids" at percentage%.
The factor scores of the observations ($res4Splus$F from distatis)
FBoot
is the bootstrapped factor scores array (FBoot obtained from BootFactorScores or BootFromCompromise)
axis1
The dimension for the horizontal axis of the plots.
axis2
The dimension for the vertical axis of the plots.
item.colors
When present, should be a column matrix (dimensions of observations and 1).
Gives the color-names to be used to color the plots.
Can be obtained as the output
of this or the other graph routine. If NULL, prettyGraphs chooses.
ZeTitle
General title for the plots.
constraints
constraints for the axes
nude
When TRUE do not plot the names of the observations
Ctr
Contributions of each observation. If NULL (default), these are computed from FS
lwd
Thickness of the line plotting the ellipse or hull.
ellipses
a boolean. When TRUE will plot ellipses (from car package). When FALSE will plot peeled hulls (from prettyGraphs package).
fill
when TRUE, fill in the ellipse with color. Related to ellipses only.
fill.alpha
transparency index when filling in the ellipses. Related to ellipses only.
percentage
A value to determine the percent coverage of the bootstrap partial factor scores to provide ellipse or hull confidence intervals.
Details
The ellipses are plotted using the function dataEllipse() from the
package car. The peeled hulls are plotted using the function peeledHulls() from the package prettyGraphs.
Note that, in the current version, the graphs are plotted as R-plots
and are not passed back by the function.
So the graphs need to be saved "by hand" from the R graphic windows.
We plan to improve this in a future version.
Value
constraints
A set of plot constraints that are returned.
item.colors
A set of colors for the observations are returned.
Author(s)
Derek Beaton and Herve Abdi
References
The plots are similar to the graphs described in:
Abdi, H., Williams, L.J., Valentin, D., & Bennani-Dosse, M. (2012). STATIS and DISTATIS: Optimum multi-table principal component analysis and three way metric multidimensional scaling. Wiley Interdisciplinary Reviews: Computational Statistics, 4, 124–167.
Abdi, H., Dunlop, J.P., & Williams, L.J. (2009). How to compute reliability estimates and display confidence and tolerance intervals for pattern classiffers using the Bootstrap and 3-way multidimensional scaling (DISTATIS). NeuroImage, 45, 89–95.
Abdi, H., & Valentin, D., (2007). Some new and easy ways to describe, compare, and evaluate products and assessors. In D., Valentin, D.Z. Nguyen, L. Pelletier (Eds)
New trends in sensory evaluation of food and non-food products.
Ho Chi Minh (Vietnam):
Vietnam National University-Ho chi Minh City Publishing House. pp. 5–18.
# 1. Load the Sort data set from the SortingBeer example (available from the DistatisR package)
data(SortingBeer)
# Provide an 8 beers by 10 assessors results of a sorting task
#-----------------------------------------------------------------------------
# 2. Create the set of distance matrices (one distance matrix per assessor)
# (ues the function DistanceFromSort)
DistanceCube <- DistanceFromSort(Sort)
#-----------------------------------------------------------------------------
# 3. Call the DISTATIS routine with the cube of distance as parameter
testDistatis <- distatis(DistanceCube)
# The factor scores for the beers are in
# testDistatis$res4Splus$F
# the partial factor score for the beers for the assessors are in
# testDistatis$res4Splus$PartialF
#
# 4. Get the bootstraped factor scores (with default 1000 iterations)
BootF <- BootFactorScores(testDistatis$res4Splus$PartialF)
#-----------------------------------------------------------------------------
# 5. Create the Graphics with GraphDistatisBoot
#
GraphDistatisBoot(testDistatis$res4Splus$F,BootF)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DistatisR)
Loading required package: prettyGraphs
Loading required package: car
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DistatisR/GraphDistatisBoot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GraphDistatisBoot
> ### Title: Plot maps of the factor scores of the observations and their
> ### bootstrapped confidence intervals (as confidence ellipsoids or peeled
> ### hulls) for a DISTATIS analysis.
> ### Aliases: GraphDistatisBoot
> ### Keywords: DistatisR
>
> ### ** Examples
>
> # 1. Load the Sort data set from the SortingBeer example (available from the DistatisR package)
> data(SortingBeer)
> # Provide an 8 beers by 10 assessors results of a sorting task
> #-----------------------------------------------------------------------------
> # 2. Create the set of distance matrices (one distance matrix per assessor)
> # (ues the function DistanceFromSort)
> DistanceCube <- DistanceFromSort(Sort)
>
> #-----------------------------------------------------------------------------
> # 3. Call the DISTATIS routine with the cube of distance as parameter
> testDistatis <- distatis(DistanceCube)
> # The factor scores for the beers are in
> # testDistatis$res4Splus$F
> # the partial factor score for the beers for the assessors are in
> # testDistatis$res4Splus$PartialF
> #
> # 4. Get the bootstraped factor scores (with default 1000 iterations)
> BootF <- BootFactorScores(testDistatis$res4Splus$PartialF)
[1] Bootstrap On Factor Scores. Iterations #:
[2] 1000
> #-----------------------------------------------------------------------------
> # 5. Create the Graphics with GraphDistatisBoot
> #
> GraphDistatisBoot(testDistatis$res4Splus$F,BootF)
dev.new(): using pdf(file="Rplots141.pdf")
$constraints
$constraints$minx
[1] -0.5694769
$constraints$maxx
[1] 0.5694769
$constraints$miny
[1] -0.5694769
$constraints$maxy
[1] 0.5694769
$item.colors
[,1]
[1,] "#305ABF"
[2,] "#84BF30"
[3,] "#BF30AD"
[4,] "#30BFA7"
[5,] "#BF7D30"
[6,] "#5430BF"
[7,] "#36BF30"
[8,] "#BF3060"
>
>
>
>
>
>
> dev.off()
png
2
>