cv.glmSparseNet: Calculate cross validating GLM model with network-based...

Description Usage Arguments Details Value Examples

View source: R/network.cv.glmnet.R

Description

network parameter accepts:

Usage

1
2
3
4
5
6
7
8
cv.glmSparseNet(
  xdata,
  ydata,
  network,
  network.options = networkOptions(),
  experiment.name = NULL,
  ...
)

Arguments

xdata

input data, can be a matrix or MultiAssayExperiment

ydata

response data compatible with glmnet

network

type of network, see below

network.options

options to calculate network

experiment.name

Name of experiment in MultiAssayExperiment

...

parameters that cv.glmnet accepts

Details

* string to calculate network based on data (correlation, covariance) * matrix representing the network * vector with already calculated penalty weights (can also be used directly glmnet)

Value

an object just as cv.glmnet

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
## Not run: 
    # Gaussian model
    xdata <- matrix(rnorm(500), ncol = 5)
    cv.glmSparseNet(xdata, rnorm(nrow(xdata)), 'correlation',
                    family = 'gaussian')
    cv.glmSparseNet(xdata, rnorm(nrow(xdata)), 'covariance',
                    family = 'gaussian')

## End(Not run)

#
#
# Using MultiAssayExperiment with survival model


#
# load data
xdata <- MultiAssayExperiment::miniACC

#
# build valid data with days of last follow up or to event
event.ix <- which(!is.na(xdata$days_to_death))
cens.ix <- which(!is.na(xdata$days_to_last_followup))
xdata$surv_event_time <- array(NA, nrow(colData(xdata)))
xdata$surv_event_time[event.ix] <- xdata$days_to_death[event.ix]
xdata$surv_event_time[cens.ix] <- xdata$days_to_last_followup[cens.ix]

#
# Keep only valid individuals
valid.ix <- as.vector(!is.na(xdata$surv_event_time) &
                      !is.na(xdata$vital_status) &
                      xdata$surv_event_time > 0)
xdata.valid <- xdata[, rownames(colData(xdata))[valid.ix]]
ydata.valid <- colData(xdata.valid)[,c('surv_event_time', 'vital_status')]
colnames(ydata.valid) <- c('time', 'status')

#
cv.glmSparseNet(xdata.valid,
                ydata.valid,
                nfolds          = 5,
                family          = 'cox',
                network         = 'correlation',
                experiment.name = 'RNASeq2GeneNorm')

glmSparseNet documentation built on April 14, 2021, 6 p.m.