plot.stability.path: Plot method for 'stability.path'.

Description Usage Arguments Value Examples

Description

Produce a plot of the stability path obtained by stability selection.

Usage

1
2
3
4
\S4method{plot}{stability.path}(x, y, xvar = "lambda", annot=TRUE,
         main = paste("Stability path for ", slot(x, "penalty")," regularizer", sep=""),
         log.scale = TRUE,  labels = rep("unknown status",p), plot = TRUE,
         sel.mode = c("rank","PFER"), cutoff=0.75, PFER=2, nvar=floor(n/log(p)), ...)

Arguments

x

output of a stability run (must be of class stability.path).

y

used for S4 compatibility.

xvar

variable to plot on the X-axis: either "lambda" (first penalty level) or "fraction" (fraction of the penalty level applied tune by lambda1). Default is "lambda".

annot

logical; should annotation be made on the graph regarding controlled PFER (only relevant when sel.mode equals 'PFER')? Default is TRUE.

main

main title. If none given, a somewhat appropriate title is automatically generated.

log.scale

logical; indicates if a log-scale should be used when xvar="lambda". Default is TRUE.

labels

an optional vector of labels for each variable in the path (e.g., 'relevant'/'irrelevant'). See examples.

plot

logical; indicates if the graph should be plotted. Default is TRUE. If FALSE, only the ggplot2 object is sent back.

sel.mode

a character string, either 'rank' or 'PFER'. In the first case, the selection is based on the rank of total probabilities by variables along the path: the first nvar variables are selected (see below). In the second case, the PFER control is used as described in Meinshausen and Buhlmannn's paper. Default is 'rank'.

cutoff

value of the cutoff probability (only relevant when sel.mode equals 'PFER').

PFER

value of the per-family error rate to control (only relevant when sel.mode equals 'PFER').

nvar

number of variables selected (only relevant when sel.mode equals 'rank'. Default is floor(n/log(p)).

...

used for S4 compatibility.

Value

a list with a ggplot2 object which can be plotted via the print method, and a vector of selected variables corresponding to method of choice ('rank' or 'PFER')

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
## Not run: 
## Simulating multivariate Gaussian with blockwise correlation
## and piecewise constant vector of parameters
beta <- rep(c(0,1,0,-1,0), c(25,10,25,10,25))
Soo  <- matrix(0.75,25,25) ## bloc correlation between zero variables
Sww  <- matrix(0.75,10,10) ## bloc correlation between active variables
Sigma <- bdiag(Soo,Sww,Soo,Sww,Soo) + 0.2
diag(Sigma) <- 1
n <- 100
x <- as.matrix(matrix(rnorm(95*n),n,95) %*% chol(Sigma))
y <- 10 + x %*% beta + rnorm(n,0,10)

## Build a vector of label for true nonzeros
labels <- rep("irrelevant", length(beta))
labels[beta != 0] <- c("relevant")
labels <- factor(labels, ordered=TRUE, levels=c("relevant","irrelevant"))

## Call to stability selection function, 200 subsampling
stab <- stability(x,y, subsamples=200, lambda2=1, min.ratio=1e-2)

## Build the plot an recover the selected variable
plot(stab, labels=labels)
plot(stab, xvar="fraction", labels=labels, sel.mode="PFER", cutoff=0.75, PFER=2)

## End(Not run)

quadrupen documentation built on May 2, 2019, 11:48 a.m.