Skip to content

Instantly share code, notes, and snippets.

@Jfortin1
Last active April 14, 2016 19:32
Show Gist options
  • Save Jfortin1/b7c9ad83459fd7363fd78ba8ae53cf65 to your computer and use it in GitHub Desktop.
Save Jfortin1/b7c9ad83459fd7363fd78ba8ae53cf65 to your computer and use it in GitHub Desktop.
Wrapper for vash
# Wrapper to calculate t-statistic from vash with one covariate
getVashT <- function(x, mod, df=NULL, ...){
require(vashr)
require(limma)
fit <- lmFit(x, mod)
if (is.null(df)){
df <- ncol(x)-1
}
temp <- vash(sehat = fit$sigma, df=df, ...)
temp <- fit$coef[,2] / temp$sd.post / fit$stdev.unscaled[,2]
temp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment