cv_glmnet_plot: Plot the Cross-Validation Curve Produced by cv.glmnet

Description Usage Arguments Value Author(s) Examples

View source: R/statVisual.R

Description

Plots the cross-validation curve, and upper and lower standard error curves, as a function of the values of the tuning parameter lambda.

Usage

1
2
3
4
5
cv_glmnet_plot(x, 
	       y, 
	       family = "binomial", 
	       addThemeFlag = TRUE, 
	       ...)

Arguments

x

a matrix with rows are subjects and columns are numeric variables (predictors). No missing values are allowed.

y

a vector of response. The number of elements of y is the same as the number of rows of x.

family

character. Indicating response type. see the description in glmnet.

addThemeFlag

logical. Indicates if light blue background and white grid should be added to the figure.

...

other input parameters for glmnet function.

Value

A list with 9 elements. data, layers, scales, mapping, theme, coordinates, facet plot_env, and labels.

Author(s)

Wenfei Zhang <Wenfei.Zhang@sanofi.com>, Weiliang Qiu <Weiliang.Qiu@sanofi.com>, Xuan Lin <Xuan.Lin@sanofi.com>, Donghui Zhang <Donghui.Zhang@sanofi.com>

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
library(dplyr)
library(tibble)
library(glmnet)

data(esSim)
print(esSim)

# expression data
dat = exprs(esSim)
print(dim(dat))
print(dat[1:2,])

# phenotype data
pDat = pData(esSim)
print(dim(pDat))
print(pDat[1:2,])

# feature data
fDat = fData(esSim)
print(dim(fDat))
print(fDat[1:2,])

# choose the first 6 probes (3 OE probes, 2 UE probes, and 1 NE probe)
pDat$probe1 = dat[1,]
pDat$probe2 = dat[2,]
pDat$probe3 = dat[3,]
pDat$probe4 = dat[4,]
pDat$probe5 = dat[5,]
pDat$probe6 = dat[6,]

print(pDat[1:2, ])

# check histograms of probe 1 expression in cases and controls
print(table(pDat$grp, useNA = "ifany"))


statVisual(type = "cv_glmnet_plot",
           x = as.matrix(pDat[, c(3:8)]), 
           y = pDat$grp, 
           family = "binomial")

cv_glmnet_plot(x = as.matrix(pDat[, c(3:8)]), 
               y = pDat$grp, 
               family = "binomial")

statVisual documentation built on Feb. 21, 2020, 1:08 a.m.