From 38f15c503b7122d4ff1a58950045a31c537a354f Mon Sep 17 00:00:00 2001 From: Jason Stover Date: Mon, 28 Nov 2005 02:37:26 +0000 Subject: [PATCH] QR decomposition for large data sets --- src/regression.q | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/regression.q b/src/regression.q index 02a675f7..30224a62 100644 --- a/src/regression.q +++ b/src/regression.q @@ -40,6 +40,8 @@ #include "var.h" #include "vfm.h" +#define REG_LARGE_DATA 1000 + /* (headers) */ @@ -644,10 +646,17 @@ run_regression (const struct casefile *cf, void *cmd_ UNUSED) (const struct variable *) design_matrix_col_to_var (X, i); assert (lcache->coeff[j].v != NULL); } + /* + For large data sets, use QR decomposition. + */ + if (n_data > sqrt (n_indep) && n_data > REG_LARGE_DATA) + { + lcache->method = PSPP_LINREG_SVD; + } /* Find the least-squares estimates and other statistics. */ - pspp_linreg ((const gsl_vector *) Y, X->m, &lopts, lcache); + pspp_linreg ((const gsl_vector *) Y, X->m, &lopts, lcache); subcommand_statistics (cmd.a_statistics, lcache); gsl_vector_free (Y); design_matrix_destroy (X); -- 2.30.2