File: prcomp.resamples.Rd

package info (click to toggle)
r-cran-caret 7.0-1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,036 kB
  • sloc: ansic: 210; sh: 10; makefile: 2
file content (105 lines) | stat: -rw-r--r-- 3,809 bytes parent folder | download | duplicates (3)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/resamples.R
\name{prcomp.resamples}
\alias{prcomp.resamples}
\alias{cluster.resamples}
\alias{cluster}
\alias{plot.prcomp.resamples}
\title{Principal Components Analysis of Resampling Results}
\usage{
\method{prcomp}{resamples}(x, metric = x$metrics[1], ...)

\method{plot}{prcomp.resamples}(x, what = "scree", dims = max(2, ncol(x$rotation)), ...)
}
\arguments{
\item{x}{For \code{prcomp}, an object of class \code{\link{resamples}} and
for \code{plot.prcomp.resamples}, an object of class
\code{plot.prcomp.resamples}}

\item{metric}{a performance metric that was estimated for every resample}

\item{\dots}{For \code{prcomp.resamples}, options to pass to
\code{\link[stats]{prcomp}}, for \code{plot.prcomp.resamples}, options to
pass to Lattice objects (see Details below) and, for
\code{cluster.resamples}, options to pass to \code{hclust}.}

\item{what}{the type of plot: \code{"scree"} produces a bar chart of
standard deviations, \code{"cumulative"} produces a bar chart of the
cumulative percent of variance, \code{"loadings"} produces a scatterplot
matrix of the loading values and \code{"components"} produces a scatterplot
matrix of the PCA components}

\item{dims}{The number of dimensions to plot when \code{what = "loadings"}
or \code{what = "components"}}
}
\value{
For \code{prcomp.resamples}, an object with classes
\code{prcomp.resamples} and \code{prcomp}. This object is the same as the
object produced by \code{prcomp}, but with additional elements: \item{metric
}{the value for the \code{metric} argument} \item{call }{the call}

For \code{plot.prcomp.resamples}, a Lattice object (see Details above)
}
\description{
Performs a principal components analysis on an object of class
\code{\link{resamples}} and returns the results as an object with classes
\code{prcomp.resamples} and \code{prcomp}.
}
\details{
The principal components analysis treats the models as variables and the
resamples are realizations of the variables. In this way, we can use PCA to
"cluster" the assays and look for similarities. Most of the methods for
\code{\link[stats]{prcomp}} can be used, although custom \code{print} and
\code{plot} methods are used.

The plot method uses lattice graphics. When \code{what = "scree"} or
\code{what = "cumulative"}, \code{\link[lattice:xyplot]{barchart}} is used.
When \code{what = "loadings"} or \code{what = "components"}, either
\code{\link[lattice:xyplot]{xyplot}} or \code{\link[lattice:splom]{splom}}
are used (the latter when \code{dims} > 2). Options can be passed to these
methods using \code{...}.

When \code{what = "loadings"} or \code{what = "components"}, the plots are
put on a common scale so that later components are less likely to be
over-interpreted. See Geladi et al. (2003) for examples of why this can be
important.

For clustering, \code{\link[stats]{hclust}} is used to determine clusters of
models based on the resampled performance values.
}
\examples{

\dontrun{
#load(url("http://topepo.github.io/caret/exampleModels.RData"))

resamps <- resamples(list(CART = rpartFit,
                          CondInfTree = ctreeFit,
                          MARS = earthFit))
resampPCA <- prcomp(resamps)

resampPCA

plot(resampPCA, what = "scree")

plot(resampPCA, what = "components")

plot(resampPCA, what = "components", dims = 2, auto.key = list(columns = 3))

clustered <- cluster(resamps)
plot(clustered)

}
}
\references{
Geladi, P.; Manley, M.; and Lestander, T. (2003), "Scatter
plotting in multivariate data analysis," J. Chemometrics, 17: 503-511
}
\seealso{
\code{\link{resamples}}, \code{\link[lattice:xyplot]{barchart}},
\code{\link[lattice:xyplot]{xyplot}}, \code{\link[lattice:splom]{splom}},
\code{\link[stats]{hclust}}
}
\author{
Max Kuhn
}
\keyword{hplot}