pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/language/stats ChangeLog regression.q


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src/language/stats ChangeLog regression.q
Date: Fri, 28 Apr 2006 13:25:53 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Branch:         
Changes by:     Jason H Stover <address@hidden> 06/04/28 13:25:53

Modified files:
        src/language/stats: ChangeLog regression.q 

Log message:
        pass only the necessary variables to model->residual

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/stats/ChangeLog.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/stats/regression.q.diff?tr1=1.18&tr2=1.19&r1=text&r2=text

Patches:
Index: pspp/src/language/stats/ChangeLog
diff -u pspp/src/language/stats/ChangeLog:1.15 
pspp/src/language/stats/ChangeLog:1.16
--- pspp/src/language/stats/ChangeLog:1.15      Wed Apr 26 19:16:07 2006
+++ pspp/src/language/stats/ChangeLog   Fri Apr 28 13:25:53 2006
@@ -1,3 +1,8 @@
+2006-04-28  Jason Stover  <address@hidden>
+
+       * regression.q (regression_trns_resid_proc): Pass only the
+       variables used in the model to (*model->residual)().
+
 2006-04-26  Jason Stover  <address@hidden>
 
        * regression.q: Added support for multiple transformations.
Index: pspp/src/language/stats/regression.q
diff -u pspp/src/language/stats/regression.q:1.18 
pspp/src/language/stats/regression.q:1.19
--- pspp/src/language/stats/regression.q:1.18   Wed Apr 26 19:16:08 2006
+++ pspp/src/language/stats/regression.q        Fri Apr 28 13:25:53 2006
@@ -600,64 +600,36 @@
 regression_trns_resid_proc (void *t_, struct ccase *c, int case_idx UNUSED)
 {
   size_t i;
-  size_t n_vars;
-  size_t n_vals = 0;
-  struct reg_trns *t = t_;
+  size_t n_vals;
+  struct reg_trns *trns = t_;
   pspp_linreg_cache *model;
-  union value *output;
-  union value *tmp;
+  union value *output = NULL;
   const union value **vals = NULL;
   const union value *obs = NULL;
   struct variable **vars = NULL;
-  struct variable **model_vars = NULL;
   
-  assert (t!= NULL);
-  model = t->c;
+  assert (trns!= NULL);
+  model = trns->c;
   assert (model != NULL);
   assert (model->depvar != NULL);
   assert (model->resid != NULL);
-  
-  dict_get_vars (default_dict, &vars, &n_vars, 1u << DC_SYSTEM);
-  vals = xnmalloc (n_vars, sizeof (*vals));
-  model_vars = xnmalloc (n_vars, sizeof (*model_vars));
-  assert (vals != NULL);
+
+  vars = xnmalloc (model->n_coeffs, sizeof (*vars));
+  n_vals = (*model->get_vars) (model, vars);
+
+  vals = xnmalloc (n_vals, sizeof (*vals));
   output = case_data_rw (c, model->resid->fv);
   assert (output != NULL);
 
-  for (i = 0; i < n_vars; i++)
+  for (i = 0; i < n_vals; i++)
     {
-      /* Use neither the predicted values nor the dependent variable. */
-      if (vars[i]->index != model->resid->index &&
-         vars[i]->index != model->depvar->index)
-           {
-             if (vars[i]->type == ALPHA && vars[i]->obs_vals != NULL)
-               {
-                 tmp = vars[i]->obs_vals->vals;
-               }
-             else 
-               {
-                 tmp = NULL;
-               }
-             /* 
-                Make sure the variable we use is in the linear model.
-             */
-             if (pspp_linreg_get_coeff (model, vars[i], tmp) != NULL)
-               {
-                 vals[n_vals] = case_data (c, i);
-                 model_vars[n_vals] = vars[i];
-                 n_vals++;
-               }
-           }
-      if (vars[i]->index == model->depvar->index)
-       {
-         obs = case_data (c, i);
-         assert (obs != NULL);
-       }
+      vals[i] = case_data (c, vars[i]->fv);
     }
+  obs = case_data (c, model->depvar->fv);
   output->f = (*model->residual) ((const struct variable **) vars, 
                                  vals, obs, model, n_vals);
   free (vals);
-  free (model_vars);
+  free (vars);
   return TRNS_CONTINUE;
 }
 /* 
@@ -689,12 +661,11 @@
              int n_trns)
 {
   static int trns_index = 1;
-  char name[LONG_NAME_LEN + 1];
+  char name[LONG_NAME_LEN];
   struct variable *new_var;
   struct reg_trns *t = NULL;
 
   t = xmalloc (sizeof (*t));
-  assert (t != NULL);
   t->trns_id = trns_index;
   t->n_trns = n_trns;
   t->c = c;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]