Based on the discussion below, I understand that you have fitted the same linear model to a few hundred separate datasets (with each subject being a separate dataset). To apply limma empirical Bayes moderation you need to have three vectors storing information from the separate fits:
A vector sigma containing the residual standard errors from the separate fits. This vector is not obtainable from your data.frame. The residual standard error is the square root of the residual mean square and is shown in the output from summary(fit) for each linear model. If you save the summary to out <- summary(fit) then the residual standard error is stored as out$sigma.
A vector df.residual containing the residual degrees of freedom for each regression, which will not all be the same some of the fits have missing values. This will be the same as df in your data.frame.
A vector tstat containing the unmoderated t-statistics from the separate linear models. This will be the same as t-value in your data.frame.
Then you can compute moderated t-statistics and p-values by
Based on the discussion below, I understand that you have fitted the same linear model to a few hundred separate datasets (with each subject being a separate dataset). To apply limma empirical Bayes moderation you need to have three vectors storing information from the separate fits:
A vector sigma containing the residual standard errors from the separate fits. This vector is not obtainable from your data.frame. The residual standard error is the square root of the residual mean square and is shown in the output from summary(fit) for each linear model. If you save the summary to out <- summary(fit) then the residual standard error is stored as out$sigma.
A vector df.residual containing the residual degrees of freedom for each regression, which will not all be the same some of the fits have missing values. This will be the same as df in your data.frame.
A vector tstat containing the unmoderated t-statistics from the separate linear models. This will be the same as t-value in your data.frame.
Then you can compute moderated t-statistics and p-values by
sv <- squeezeVar(sigma^2, df=df.residual) moderated.t <- tstat sigma / sqrt(sv$var.post) df.total <- df.residual + sv$df.prior p.value <- 2pt( abs(moderated.t), df=df.total, lower.tail=FALSE)