From ece069a01277d416d305fb273081353e536da929 Mon Sep 17 00:00:00 2001 From: Jeff Paril <55180317+jeffersonfparil@users.noreply.github.com> Date: Wed, 24 Jan 2024 10:09:56 +1100 Subject: [PATCH] Correcting StudentT distribution df as n-1 from p-1 --- src/gwas/mle.rs | 2 +- src/gwas/ols.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gwas/mle.rs b/src/gwas/mle.rs index d59c7e7..940e5c8 100644 --- a/src/gwas/mle.rs +++ b/src/gwas/mle.rs @@ -173,7 +173,7 @@ impl Regression for UnivariateMaximumLikelihoodEstimation { if n != n_ { return Err(Error::new(ErrorKind::Other, "The number of samples in the dependent and independent variables are not the same size.")); } - let d = StudentsT::new(0.0, 1.0, p as f64 - 1.0).unwrap(); + let d = StudentsT::new(0.0, 1.0, n as f64 - 1.0).unwrap(); self.t = Array1::from_elem(p, f64::NAN); self.pval = Array1::from_elem(p, f64::NAN); for i in 0..p { diff --git a/src/gwas/ols.rs b/src/gwas/ols.rs index dac8f13..c4ed796 100644 --- a/src/gwas/ols.rs +++ b/src/gwas/ols.rs @@ -136,7 +136,7 @@ impl Regression for UnivariateOrdinaryLeastSquares { if n != n_ { return Err(Error::new(ErrorKind::Other, "The number of samples in the dependent and independent variables are not the same size.")); } - let d = StudentsT::new(0.0, 1.0, p as f64 - 1.0).unwrap(); + let d = StudentsT::new(0.0, 1.0, n as f64 - 1.0).unwrap(); self.t = Array1::from_elem(p, f64::NAN); self.pval = Array1::from_elem(p, f64::NAN); for i in 0..p {