#include "xalloc.h"
#include "gettext.h"
-#define GLM_LARGE_DATA 1000
+#define GLM_LARGE_DATA 10000
/* (headers) */
}
}
}
+ model = pspp_linreg_cache_alloc (n_data, n_indep);
+ model->depvar = v_dependent;
+ /*
+ For large data sets, use QR decomposition.
+ */
+ if (n_data > sqrt (n_indep) && n_data > GLM_LARGE_DATA)
+ {
+ model->method = PSPP_LINREG_QR;
+ }
+ coeff_init (model, X);
+ pspp_linreg_with_cov (X, model);
casereader_destroy (reader);
for (i = 0; i < n_all_vars; i++)
{
}
free (indep_vars);
free (lopts.get_indep_mean_std);
+ pspp_linreg_cache_free (model);
casereader_destroy (input);
return true;
The return value is the number of distinct variables found.
*/
int
-pspp_linreg_get_vars (const void *c_, const struct variable **v)
+pspp_linreg_get_vars (const void *c_, struct variable **v)
{
const pspp_linreg_cache *c = c_;
const struct variable *tmp;
v = xnmalloc (c->n_coeffs, sizeof (*v));
model_vars = xnmalloc (c->n_coeffs, sizeof (*model_vars));
columns = xnmalloc (cov->m->size2, sizeof (*columns));
- n_vars = pspp_linreg_get_vars (c, (const struct variable **) v);
+ n_vars = pspp_linreg_get_vars (c, v);
dep_col = 0;
k = 0;
for (i = 0; i < cov->m->size2; i++)
{
struct design_matrix *cov;
- assert (cov != NULL);
+ assert (full_cov != NULL);
assert (cache != NULL);
cov = rearrange_covariance_matrix (full_cov, cache);
/*
All variables used in the model.
*/
-int pspp_linreg_get_vars (const void *, const struct variable **);
+int pspp_linreg_get_vars (const void *, struct variable **);
struct pspp_coeff *pspp_linreg_get_coeff (const pspp_linreg_cache
*,