View source: R/coxphParallel.R
coxphParallel | R Documentation |
This is a non-user function that is managed by RegParallel, the primary function.
coxphParallel(
data,
formula.list,
FUN,
variables,
terms,
startIndex,
blocksize,
blocks,
APPLYFUN,
conflevel,
excludeTerms)
data |
A data-frame that contains all model terms to be tested. Variables that have all zeros will, automatically, be removed. REQUIRED. |
formula.list |
A list containing formulae that can be coerced to formula class via as.formula(). REQUIRED. |
FUN |
Regression function. Must be of form, for example: function(formula, data) glm(formula = formula, family = binomial, data = data). REQUIRED. |
variables |
Vector of variable names in data to be tested independently. Each variable will have its own formula in formula.list. REQUIRED. |
terms |
Vector of terms used in the formulae in formula.list, excluding the primary variable of interest. REQUIRED. |
startIndex |
Starting column index in data object from which processing can commence. REQUIRED. |
blocksize |
Number of variables to test in each foreach loop. REQUIRED. |
blocks |
Total number of blocks required to complete analysis. REQUIRED. |
APPLYFUN |
The apply function to be used within each block during processing. Will be one of: 'mclapply(...)', system=linux/mac and nestedParallel=TRUE; 'parLapply(cl, ...)', system=windows and nestedParallel=TRUE; 'lapply(...)', nestedParallel=FALSE. REQUIRED. |
conflevel |
Confidence level for calculating odds or hazard ratios. REQUIRED. |
excludeTerms |
Remove these terms from the final output. These will simply be grepped out. REQUIRED. |
This is a non-user function that is managed by RegParallel, the primary function.
A data.table
object.
Kevin Blighe <kevin@clinicalbioinformatics.co.uk>
options(scipen=10)
options(digits=6)
col <- 20000
row <- 20
mat <- matrix(
rexp(col*row, rate = .1),
ncol = col)
colnames(mat) <- paste0('gene', 1:ncol(mat))
rownames(mat) <- paste0('sample', 1:nrow(mat))
modelling <- data.frame(
cell = rep(c('B', 'T'), nrow(mat) / 2),
group = c(rep(c('treatment'), nrow(mat) / 2), rep(c('control'), nrow(mat) / 2)),
dosage = t(data.frame(matrix(rexp(row, rate = 1), ncol = row))),
mat,
row.names = rownames(mat))
require(survival)
data <- modelling[,1:800]
variables <- colnames(data)[4:ncol(data)]
data$time <- c(100,200,400,300,200,250,600,1000,886,450,
c(100,200,400,300,200,250,600,1000,886,450)*1.5)
data$alive <- c(0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,1)
res4 <- RegParallel(
data = data,
formula = 'Surv(time, as.integer(alive)) ~ group * [*] + cell',
FUN = function(formula, data)
coxph(formula = formula,
data = data,
ties = 'breslow',
singular.ok = TRUE),
FUNtype = 'coxph',
variables = variables,
blocksize = 399,
cores = 2,
nestedParallel = FALSE,
p.adjust = "none",
conflevel = 97.5,
excludeTerms = c('group', 'cell'),
excludeIntercept = FALSE
)
# spot checks
m <- coxph(formula = Surv(time, as.integer(factor(alive))) ~ group * gene12 + cell, data = data, ties = 'breslow', singular.ok = TRUE)
summary(m)
exp(cbind("Odds ratio" = coef(m), confint.default(m, level = 0.975)))
res4[which(res4$Variable == 'gene12'),]
m <- coxph(formula = Surv(time, as.integer(factor(alive))) ~ group * gene267 + cell, data = data, ties = 'breslow', singular.ok = TRUE)
summary(m)
exp(cbind("Odds ratio" = coef(m), confint.default(m, level = 0.975)))
res4[which(res4$Variable == 'gene267'),]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.