vcovSqrt-method: Sqrt of co-variance matrix for 'dream()' fit

vcovSqrtR Documentation

Sqrt of co-variance matrix for dream() fit

Description

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

Usage

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

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

## S4 method for signature '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, ]))


GabrielHoffman/variancePartition documentation built on April 30, 2024, 10:01 p.m.