funCV

Description

Cross validation function

Usage

1
funCV(obj, fold, y.var, trainFun = masomenos, funCvSubset = cvSubsets)

Arguments

obj

a ExpressionSet, matrix or RangedSummarizedExperiment object. If it is a

matrix, columns represent samples

fold

the number of folds in cross validation

y.var

response variable, matrix, data.frame(with 2 columns) or Surv object

trainFun

training function, which takes gene expression matrix X and response variable y as input, the coefficients as output

funCvSubset

function to divide one Expression Set into subsets for cross validation

Value

returns the c statistics of cross validation(CV)

Author(s)

Yuqing Zhang, Christoph Bernau, Levi Waldron

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
 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
106
library(curatedOvarianData)


library(GenomicRanges)


set.seed(8)


data( E.MTAB.386_eset )


eset <- E.MTAB.386_eset[1:100, 1:30]


time <- eset$days_to_death


cens.chr <- eset$vital_status


cens <- c()


for(i in seq_along(cens.chr)){


  if(cens.chr=="living") cens[i] <- 1


  else cens[i] <- 0


}


y <- Surv(time, cens)  


y1 <- cbind(time, cens)





nrows <- 200; ncols <- 6


counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)


rowRanges <- GRanges(rep(c("chr1", "chr2"), c(50, 150)),


                     IRanges(floor(runif(200, 1e5, 1e6)), width=100),


                     strand=sample(c("+", "-"), 200, TRUE))


colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),


                     row.names=LETTERS[1:6])


sset <- SummarizedExperiment(assays=SimpleList(counts=counts),


                             rowRanges=rowRanges, colData=colData)


time <- sample(4500:4700, 6, replace=TRUE)


cens <- sample(0:1, 6, replace=TRUE)


y.vars <- Surv(time, cens)





funCV(eset, 3, y)


funCV(eset, 3, y1, trainFun=plusMinus)


funCV(exprs(eset), 3, y)





funCV(sset, 3, y.vars)


## any training function will do as long as it takes the gene expression matrix X


## and response variable y(matrix, data.frame or Surv object) as parameters, and


## return the coefficients as its value