data.visualisation: Grouped Data Visualisation by PCA, MDS, PCADA and PLSDA

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Grouped data visualisation by PCA, MDS, PCADA and PLSDA.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  pca.plot.wrap(data.list,title="plotting",...) 

  mds.plot.wrap(data.list,method="euclidean",title="plotting",...) 

  pca.plot.wrap(data.list,title="plotting",...) 

  lda.plot.wrap.1(data.list,title="plotting",...) 

  pls.plot.wrap(data.list,title="plotting",...) 
  

Arguments

data.list

A two-layer list structure, in which the second layer include a data frame called dat and a factor of class label called cls. Noticed that names of the first layer of data.list should be given. data.list can be produced by dat.sel.

method

The distance measure to be used. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given. It is only for mds.plot.wrap.

title

A part of title string for plotting.

...

Further arguments to lattice. See corresponding entry in xyplot for non-trivial details of lattice. One argument is ep: an integer flag for ellipse. 1 and 2 for plotting overall and group ellipse, respectively. Otherwise, none. For details, see panel.elli.1.

Value

mds.plot.wrap returns a handle for MDS plot.

All other four functions return a list with components: the first one is an object of class "trellis" for data visualisation; the second one is also an object of class "trellis" but plotting the corresponding variables, PCs (principal components), LDs (linear discrimniants) and LCs (latent components); and the third one is a matrix of these variables.

Note

There is a slight differences between lda.plot.wrap.1 and lda.plot.wrap. The former plots the two-class grouped data, which has one linear discriminant (LD1), with strip plot. The later plots the two-class data by LD1 vs LD2 which is identical to LD1. Hence lda.plot.wrap is more general and can be applied to fusion of two and more class data sets.

Author(s)

Wanchang Lin

See Also

pcaplot, mdsplot, plot.pcalda, plot.plsc, dat.sel, grpplot, panel.elli.1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
data(iris)
x <- subset(iris, select = -Species)
y <- iris$Species
## generate data list by dat.sel
iris.pw <- dat.sel(x,y,choices=NULL)
names(iris.pw)

pca.p <- pca.plot.wrap(iris.pw, ep=2)
pca.p[[1]]     ## visualised by PCA
pca.p[[2]]     ## plot PCA variables
pca.p[[3]]     ## matrix of PCA variables

mds.p <- mds.plot.wrap(iris.pw)
mds.p

pls.p  <- pls.plot.wrap(iris.pw)
pls.p[[1]]
pls.p[[2]]
pls.p[[3]]

lda.p <- lda.plot.wrap.1(iris.pw)
lda.p[[1]]
lda.p[[2]]
lda.p[[3]]
lda.plot.wrap(iris.pw)$lda.p

## only plot iris data
ph <- pca.plot.wrap(list(list(dat=x, cls=y)))$pca.p  
## Not given data names
ph
update(ph, strip=FALSE)       ## strip is an argument of lattice

tmp <- list(iris.dat=list(dat=x, cls=y))
pca.plot.wrap(tmp)$pca.p
pca.plot.wrap(tmp,strip=FALSE)$pca.p
pls.plot.wrap(tmp,strip=FALSE)$pls.p
lda.plot.wrap(tmp,strip=FALSE)$lda.p

data(abr1)
cls <- factor(abr1$fact$class)
dat <- preproc(abr1$pos, method="log")
## pair-wise data set
dat.pw <- dat.sel(dat, cls,choices=c("2","3","4"))

## add mult-class
idx <- grep("2|3|4",cls)
cls.234 <- factor(cls[idx])
dat.234 <- dat[idx,,drop = FALSE]

## combine all
dat.tmp <- c(dat.pw, 
             "2~3~4"=list(list(dat=dat.234,cls=cls.234)),
             all=list(list(dat=dat, cls=cls)))

## PCA
ph <- pca.plot.wrap(dat.tmp, title="abr1", par.strip.text = list(cex=0.75), 
                     scales=list(cex =.75,relation="free"), ep=2) 
## See function grpplot for usage of ep.
ph[[1]]
ph[[2]]                     

##PLSDA
ph <- pls.plot.wrap(dat.tmp, title="abr1", par.strip.text = list(cex=0.75), 
                     scales=list(cex =.75,relation="free"), ep=2) 
ph[[1]]
ph[[2]]                     

## PCADA
ph <- lda.plot.wrap(dat.tmp, title="abr1", par.strip.text = list(cex=0.75), 
                     scales=list(cex =.75,relation="free")) 
ph[[1]]
ph[[2]]    

mt documentation built on Feb. 2, 2022, 1:07 a.m.