irwsva.build: A function for estimating surrogate variables by estimating...

Description Usage Arguments Value Examples

View source: R/irwsva.build.R

Description

This function is the implementation of the iteratively re-weighted least squares approach for estimating surrogate variables. As a buy product, this function produces estimates of the probability of being an empirical control. See the function empirical.controls for a direct estimate of the empirical controls.

Usage

1
irwsva.build(dat, mod, mod0 = NULL, n.sv, B = 5)

Arguments

dat

The transformed data matrix with the variables in rows and samples in columns

mod

The model matrix being used to fit the data

mod0

The null model being compared when fitting the data

n.sv

The number of surogate variables to estimate

B

The number of iterations of the irwsva algorithm to perform

Value

sv The estimated surrogate variables, one in each column

pprob.gam: A vector of the posterior probabilities each gene is affected by heterogeneity

pprob.b A vector of the posterior probabilities each gene is affected by mod

n.sv The number of significant surrogate variables

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(bladderbatch)
data(bladderdata)
dat <- bladderEset[1:5000,]

pheno = pData(dat)
edata = exprs(dat)
mod = model.matrix(~as.factor(cancer), data=pheno)

n.sv = num.sv(edata,mod,method="leek")
res <- irwsva.build(edata, mod, mod0 = NULL,n.sv,B=5) 

jtleek/sva-devel documentation built on March 25, 2020, 4:13 a.m.