From 65d87cf950fb5383a272905f2d7fdf94bcabfda2 Mon Sep 17 00:00:00 2001 From: Jason H Stover Date: Wed, 17 Nov 2010 10:40:13 -0500 Subject: [PATCH] Fixed degrees of freed in t-stat for intercept --- src/language/stats/regression.q | 2 +- tests/language/stats/regression.at | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/language/stats/regression.q b/src/language/stats/regression.q index 8f9979ae..53ac594b 100644 --- a/src/language/stats/regression.q +++ b/src/language/stats/regression.q @@ -206,7 +206,7 @@ reg_stats_coeff (linreg * c, void *aux_) tab_double (t, 4, 1, 0, 0.0, NULL); t_stat = linreg_intercept (c) / std_err; tab_double (t, 5, 1, 0, t_stat, NULL); - pval = 2 * gsl_cdf_tdist_Q (fabs (t_stat), 1.0); + pval = 2 * gsl_cdf_tdist_Q (fabs (t_stat), (double) (linreg_n_obs (c) - linreg_n_coeffs (c))); tab_double (t, 6, 1, 0, pval, NULL); for (j = 0; j < linreg_n_coeffs (c); j++) { diff --git a/tests/language/stats/regression.at b/tests/language/stats/regression.at index 11ce07fa..0ea3efc8 100644 --- a/tests/language/stats/regression.at +++ b/tests/language/stats/regression.at @@ -38,7 +38,7 @@ Table: ANOVA Table: Coefficients ,,B,Std. Error,Beta,t,Significance -,(Constant),2.19,2.36,.00,.93,.52 +,(Constant),2.19,2.36,.00,.93,.38 ,v0,1.81,1.05,.17,1.72,.12 ,v1,-3.43,.33,-1.03,-10.33,.00 ,,,,,, @@ -1585,7 +1585,7 @@ Table: ANOVA Table: Coefficients ,,B,Std. Error,Beta,t,Significance -,(Constant),1.24,.42,.00,2.95,.21 +,(Constant),1.24,.42,.00,2.95,.00 ,v1,1.37,.72,.05,1.89,.06 ,,,,,, ]) -- 2.30.2