Hello,
I do have a data frame my_dataframe
with parameter estimates (i.e. linear combinations of the model parameters - contrasts).
"ID" "Contrast" "Estimate" "Std. Error" "df" "t-value" "lower" "upper" "Pr(>|t|)"
1 "A - B" 3.2 ....
2 "A - B" ....
3 "A - B" ....
for some few hundred subjects_ (ID column) from one experiment, and would like to get the moderated p.values. (But I do not have the option to run the entire limma pipeline with lmFit eBayes computing the contrasts etc...).
Hence I am wondering if it is possible:
- to determine the prior parameters $s0$, $d0$ using the function fitFDist
from the "Std.Errors" and "df"
and than using those update the std.Error by the formula
$\tilde{s^2}= \frac{d0s0^2 + dgsg^2}{d0+dg}$ ?
If this is the case, is it correct that I just need to run the function with(my_dataframe, squeezeVar(Std.Error, df) )
on my_dataframe
to obtain the posterior variances and subsequently Estimate/posterior.var to obtain the t-statistics?
Thank you Witek
Dear Gordon,
The table is not the table of a single model on one subject but, the result of running the same model on several hundred of subjects and then computing the same contrast on all models. I updated my post to clarify this a bit more. Sorry that it wasn't more precise, I updated it accordingly.
Note that moderation works on residual variances rather than on standard errors, so it needs extra information to that in your data.frame.
This is exactly what I am wondering about, but did not find the time to go through the math yet to understand it better.
What information do I need in the data frame? Just the residual variance or do I also need the design matrices of the model - which might be slightly different for each subject because of missingness in the data?
You need the residual variance (also known as residual standard error or residual mean square) and the residual df.
If you've run the same linear model on all the subjects, and you have the raw data, then it would seem that you could run limma on it directly. What's stopping you from doing that?
You need the residual variance (also known as residual standard error or residual mean square) and the residual df.
These - residual standard error, residual df - I do have for each model. Obviously, I than could then run the
squeezeVar
function as intended. But then how do I update the std:Error of the contrasts?I have updated my answer above.