Merge branch 'master' of ssh://jmd@git.sv.gnu.org/srv/git/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 23 Feb 2009 21:57:42 +0000 (06:57 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 23 Feb 2009 21:57:42 +0000 (06:57 +0900)
src/language/stats/regression.q
src/math/linreg.c
src/math/linreg.h
tests/command/regression-qr.sh
tests/command/regression.sh

index d82d5549adf3ea6e96ff308f442c03a55d94a7b3..68db454d40edfbc38316884903f893227fd9bc0b 100644 (file)
@@ -148,7 +148,7 @@ reg_stats_r (pspp_linreg_cache * c)
   assert (c != NULL);
   rsq = c->ssm / c->sst;
   adjrsq = 1.0 - (1.0 - rsq) * (c->n_obs - 1.0) / (c->n_obs - c->n_indeps);
-  std_error = sqrt ((c->n_indeps - 1.0) / (c->n_obs - 1.0));
+  std_error = sqrt (pspp_linreg_mse (c));
   t = tab_create (n_cols, n_rows, 0);
   tab_dim (t, tab_natural_dimensions);
   tab_box (t, TAL_2, TAL_2, -1, TAL_1, 0, 0, n_cols - 1, n_rows - 1);
@@ -281,7 +281,7 @@ reg_stats_anova (pspp_linreg_cache * c)
   int n_cols = 7;
   int n_rows = 4;
   const double msm = c->ssm / c->dfm;
-  const double mse = c->sse / c->dfe;
+  const double mse = pspp_linreg_mse (c);
   const double F = msm / mse;
   const double pval = gsl_cdf_fdist_Q (F, c->dfm, c->dfe);
 
index a50aa7d8f105aaff4a6921ee84a88539956d3122..f5ae33e5823f4f79cfaccd73637316baa2f96d0f 100644 (file)
@@ -737,3 +737,9 @@ pspp_linreg_with_cov (const struct covariance_matrix *full_cov,
   design_matrix_destroy (cov);
 }
 
+double pspp_linreg_mse (const pspp_linreg_cache *c)
+{
+  assert (c != NULL);
+  return (c->sse / c->dfe);
+}
+
index 53f47a611c71dd92b808379bb905370fc01bbdde..f9d8c9b3f740abfc161ea7df2ecf20131985f700 100644 (file)
@@ -222,4 +222,5 @@ void pspp_linreg_set_indep_variable_mean (pspp_linreg_cache *, const struct vari
   Regression using only the covariance matrix.
  */
 void pspp_linreg_with_cov (const struct covariance_matrix *, pspp_linreg_cache *);
+double pspp_linreg_mse (const pspp_linreg_cache *);
 #endif
index b90402d718aa6b6a2b6a5fdbf91fa3df68187640..5f4936d81b6cdf8ba06d4f60848cdedc4e678736 100755 (executable)
@@ -1582,7 +1582,7 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 #============#========#=================#==========================#
 #          R #R Square|Adjusted R Square|Std. Error of the Estimate#
 #========#===#========#=================#==========================#
-#        |.05#     .00|              .00|                       .00#
+#        |.05#     .00|              .00|                      8.11#
 #========#===#========#=================#==========================#
 2.2 REGRESSION.  ANOVA
 #===================#==============#====#===========#=====#============#
index db33445e65e75ffec91960868e64ee3d7e099291..a8e1942e5326143c9f7d2fdd5a40ae820b33f52e 100755 (executable)
@@ -95,7 +95,7 @@ diff -b  $TEMPDIR/pspp.list - << EOF
 #============#========#=================#==========================#
 #          R #R Square|Adjusted R Square|Std. Error of the Estimate#
 #========#===#========#=================#==========================#
-#        |.97#     .94|              .93|                       .33#
+#        |.97#     .94|              .93|                      1.34#
 #========#===#========#=================#==========================#
 2.2 REGRESSION.  ANOVA
 #===================#==============#==#===========#======#============#