Skip to contents

Define generic vcovSqrt() for result of lmFit() and dream()

Usage

vcovSqrt(object, vobj, coef, approx = TRUE)

# S4 method for MArrayLM
vcovSqrt(object, vobj, coef, approx = TRUE)

# S4 method for MArrayLM2
vcovSqrt(object, vobj, coef, approx = TRUE)

Arguments

object

MArrayLM object return by lmFit() or dream()

vobj

EList object returned by voom()

coef

name of coefficient to be extracted

approx

use fast approximation

Value

Computes factor of covariance matrix so that vcov(object) is the same as crossprod(vcovSqrt(object))

Examples

# load simulated data:
# geneExpr: matrix of *normalized* gene expression values
# info: information/metadata about each sample
data(varPartData)

form <- ~Batch

fit <- dream(geneExpr[1:2, ], form, info)
fit <- eBayes(fit)

# Compute covariance directly
Sigma <- vcov(fit, geneExpr[1:2, ])

# Compute factor of covariance
S <- crossprod(vcovSqrt(fit, geneExpr[1:2, ]))