fold change in Limma is calculated
2
0
Entering edit mode
7.4 years ago
Learner ▴ 280

I am trying to understand how limma calculates the fold change

Is it

log2(mean(groupA)- log2(mean(groupB)

limma • 4.1k views
ADD COMMENT
0
Entering edit mode

could I ask why you removed your motivating example?

ADD REPLY
5
Entering edit mode
7.4 years ago
russhh 5.7k

Shouldn't you be running mean(log2(groupB)) - mean(log2(groupA)) ?

 x <- data.frame(grp = rep(c("a", "b"), each = 3),
                   z = c(4.36e-3, 5.72e-3, 4.17e-3, 2.85e-2, 3.37e-2, 3.27e-2))

You'd have to log-transform these to use them in limma. Nonetheless:

 x
  grp       z
1   a 0.00436
2   a 0.00572
3   a 0.00417
4   b 0.02850
5   b 0.03370
6   b 0.03270

For simplicity we'll use lm

 lm (log2(z) ~ grp, data = x)

    Call:
lm(formula = log2(z) ~ grp, data = x)

Coefficients:
(Intercept)         grpb  
     -7.732        2.746

grpb coef is 2.746 as in limma

Consider both the log of the geometric mean and the log of the arithmetic mean within each group

y <- x %>% 
    group_by(grp) %>%
    summarise(
        log_gmean = mean(log2(z)),
        log_amean = log2(mean(z)))

> y
# A tibble: 2 x 3
     grp log_gmean log_amean
  <fctr>     <dbl>     <dbl>
1      a -7.732321 -7.717857
2      b -4.986189 -4.982411

# Differences in the log-means:
y[2, 2:3] - y[1, 2:3]
  log_gmean log_amean
1  2.746132  2.735446

Difference of the log-geometric-mean is the value you want, not the difference of the log-arithmetic-mean. I can't replicate your value of 2.77 for log(mu_B) - log(mu_A); sorry.

ADD COMMENT

Login before adding your answer.

Traffic: 1941 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6