forked from gabraham/flashpca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot2d.cv.scca.Rd
52 lines (45 loc) · 1.25 KB
/
plot2d.cv.scca.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scca.R
\name{plot2d.cv.scca}
\alias{plot2d.cv.scca}
\title{Plot the results of SCCA cross-validation (Pearson correlation) as a 2D
surface. The optimal position is shown as a cross ('+').}
\usage{
\method{plot2d}{cv.scca}(x, dim = 1, plot = FALSE, ...)
}
\arguments{
\item{x}{An object of class "cv.scca"}
\item{dim}{Integer. Which dimension to plot (all will be plotted by
default).}
\item{plot}{Logical. Whether to plot (print) the ggplot2 object or just
return it.}
}
\value{
the ggplot2 object
}
\description{
Plot the results of SCCA cross-validation (Pearson correlation) as a 2D
surface. The optimal position is shown as a cross ('+').
}
\details{
Plots the cross-validated Pearson correlation, as a 2D surface with the
lambda1 and lambda2 penalties on the axes.
}
\examples{
#######################
## HapMap3 chr1 example
data(hm3.chr1)
X <- scale2(hm3.chr1$bed)
n <- nrow(X)
m <- ncol(X)
k <- 5
B <- matrix(stats::rnorm(m * k), m, k)
Y <- X \%*\% B + stats::rnorm(n * k)
r <- cv.scca(X, Y,
standx = "sd", standy = "sd", nfolds = 3, ndim = 2,
lambda1 = seq(1e-3, 1e-1, length = 10),
lambda2 = seq(1e-4, 0.5, length = 8)
)
g <- plot2d(r, dim = 1, plot = FALSE)
print(g)
}