Hello, I have a question regarding the discrepancy between the mean of extracted fitted value and calculated mean based on LFC.

First, I want to plot some of our fitted results in barplot, and I tried below code to extract fitted value and plot.

fittedval <- t( t( assays(results)[["mu"]] ) / sizeFactors(results) ) fittedval[gene1,group1] fittedval[gene1,group2]

Next, I plotted mean and standard error based on the log2foldchange and lfcse from result table, like below.

normalized.count <- counts(results, normalized=T) std <- function(x) sd(x)/sqrt(length(x)) # Mean, SE of reference level. m1 <- mean(normalized.count[gene1, group1]) s1 <- std(normalized.count[gene1, group1]) upper.limit <- m1+s1 lower.limit <- m1-s1 # Mean, SE of compared level, based on LFC and LFC-SE. m2 <- m1 * 1/2^results[i,"log2FoldChange"] upper.limit2 <- m1 * 1/2^(results[i,"log2FoldChange"]-results[i,"lfcSE"]) lower.limit2 <- m1 * 1/2^(results[i,"log2FoldChange"]+results[i,"lfcSE"])

Now I got mean, upper limit, lower limit of reference level, and group1.

However, when I plotted, the barplot represents different results between those based on fitted value and those based on log2FoldChange. How can this happen? Thank you very much in advance.

Hello, Thank you very much for the prompt help! I'm sorry now I can't show you the actual values of these, as I'm away from my workstation, but I have many other covariates like six, and I do not use LFC shrinkage.

If you have more than a simple single factor design then the LFC is not necessarily equal to the log ratio of the means, because it takes into account the other factors.

I understand, thank you very much!

Could you please tell me are there any way to extract fitted full model including other factors for the gene, so I can predict expression values considering other factors to reproduce LFC change?

This is outside the scope of what DESeq2 provides.

fittedval <- t( t( assays(results)[["mu"]] ) / sizeFactors(results) )

Thank you for the reply, and I'm sorry for the late response. I understand. If I somehow model (like linear model) the above fittedval data with my six independent variables, can I possibly reproduce the similar LFC? I wonder if there is a hint as LFC got promising results and i want to extract matrix that reproduce these, and when I digged in the code, I got lost in fitBeta function...

You can’t get the same GLM LFC for an arbitrary design with simple operations on the above data. For example, the GLM uses information about the count and the offset which is missing from the above data.