How to define degrees of freedom in eBayes function

136 views Asked by At

I am using Bioconductor limma package. I want to define degree of freedom in eBayes function for microarray analysis. How can I change default degrees of freedom in it? Pleasee see the code below:

fit2 <- eBayes(fit2, 0.01)
1

There are 1 answers

0
Artem On

However the reason to change degrees of freedom after modeling is unclear, as degrees of freedom characterize the amount of variables and observations in your input data. You can change the degrees of freedom of the MArrayLM object, which is an argument of eBayes function. Please see the code below:

# source("https://bioconductor.org/biocLite.R")
# biocLite("limma", suppressUpdates = TRUE)

library(limma)
set.seed(123)
sigma2 <- 0.05 / rchisq(100, df = 10) * 10
y <- matrix(rnorm(100 * 6, sd = sqrt(sigma2)), 100, 6)
design <- cbind(Intercept=1, Group=c(0, 0, 0, 1, 1, 1))
y[1, 4:6] <- y[1, 4:6] + 1
fit <- lmFit(y, design)

fit$df.residual
# [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
# [63] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4

fit$df.residual <- rep(3, 100)

#  Moderated t-statistic
fit <- eBayes(fit, .01)