diff --git a/R/test.R b/R/test.R index 695febb..dbb4d79 100644 --- a/R/test.R +++ b/R/test.R @@ -56,7 +56,7 @@ test_de <- function(devil.fit, contrast, pval_adjust_method = "BH", max_lfc = 10 H <- compute_hessian(devil.fit$beta[gene_idx,], 1 / devil.fit$overdispersion[gene_idx], devil.fit$input_matrix[gene_idx,], devil.fit$design_matrix, devil.fit$size_factors) total_variance <- t(contrast) %*% H %*% contrast #1 - stats::pchisq(mu_test^2 / total_variance, df = 1) - 2 * stats::pt(abs(mu_test) / sqrt(total_variance), df = ncol(Y) - 2, lower.tail = F) + 2 * stats::pt(abs(mu_test) / sqrt(total_variance), df = nsamples - 2, lower.tail = F) }, mc.cores = n.cores) %>% unlist() }