How to calculate coefficient of variation within group?
1
0
Entering edit mode
Ahdee ▴ 50
@ahdee-8938
Last seen 6 weeks ago
United States

Hi I'm using VOOM from limma to calculate DEG. However, for the statistical cutoff, effective size ( log2 fold change), I wanted to first use RNAseqPower to calculate the appropriate log fold changes.
The instruction is pretty straightforward, however what I'm confused about is how to calculate coefficient of variation of counts within each of the two groups, cv as input.

I know how to calculate CV for each gene from the cpm but I guess I'm confused about how to calculate the overall CV for the entire group? For example the gene KRAS I just need to calculate (Standard Deviation / Mean) but how do I do this for all genes and come up with a CV for each of my group?

is it for example just:

apply ( cpm, 2, function (x) sd(x)/mean(x))


thanks in advance! A.

edgeR limma RNASeqPower • 115 views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia

The CV required by RNAseqPower is the same as that computed by edgeR::estimateCommonDisp. You cannot compute it using the sd and mean functions because it is the CV of an unobserved quantity.

However your question seems based on some mistaken premises. RNAseqPower does not calculate log-fold-changes and log-fold-change should not be used as a statistical cutoff. The purpose of RNAseqPower is to estimate required sample size, but that becomes pointless if you have already done the experiment.

ADD COMMENT
0
Entering edit mode

Thanks Gordon for the estimateCommonDisp. I see your point. However what I want to do was to do post lookback to see if a certain effective size given my already fixed sample size has enough power. I know that its reverse but its something I wanted to do as a side to check if the log fold cutoff makes sense. On the same line of thought, how would you pick a logfold cutoff?

ADD REPLY
0
Entering edit mode

My advice regarding how to choose a log fold cutoff is not to use one. As I hinted in my answer to you above, I don't recommend that fold change cutoffs should not be used in a DE analysis.

More generally, it is not clear to me how relevant RNAseqPower is to a voom analysis. RNAseqPower defines fold changes differently to those that are returned by voom (limma's logFCs are shrunk whereas RNAseqPower's are not) and the statistical analysis assumed by RNAseqPower is different to what is done by limma. So voom's power may differ from what RNAseqPower predicts.

ADD REPLY

Login before adding your answer.

Traffic: 474 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