pspp-dev
[Top][All Lists]
Advanced

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

Re: [warnings 7/7] GLM: Fix compiler warnings.


From: John Darrington
Subject: Re: [warnings 7/7] GLM: Fix compiler warnings.
Date: Sat, 18 Sep 2010 07:09:34 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On my laptop I've got a complete rewrite of the GLM procedure.  It's just 
waiting
for a function to calculate the sums of squares.  The existing reg_sweep doesn't
seem to work when there is more than one factor.  Once we've got that , we'll 
have
a working and correct GLM.
On Fri, Sep 17, 2010 at 09:36:32PM -0700, Ben Pfaff wrote:
     ---
      src/language/stats/glm.q |   82 
++++++++++++++++++++--------------------------
      1 files changed, 36 insertions(+), 46 deletions(-)
     
     diff --git a/src/language/stats/glm.q b/src/language/stats/glm.q
     index 4de00e3..1e5d896 100644
     --- a/src/language/stats/glm.q
     +++ b/src/language/stats/glm.q
     @@ -1,5 +1,5 @@
      /* PSPP - a program for statistical analysis.
     -   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
     +   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
      
         This program is free software: you can redistribute it and/or modify
         it under the terms of the GNU General Public License as published by
     @@ -22,28 +22,30 @@
      #include <math.h>
      #include <stdlib.h>
      
     -#include <data/case.h>
     -#include <data/casegrouper.h>
     -#include <data/casereader.h>
     -#include <data/dictionary.h>
     -#include <data/missing-values.h>
     -#include <data/procedure.h>
     -#include <data/transformations.h>
     -#include <data/value-labels.h>
     -#include <data/variable.h>
     -#include <language/command.h>
     -#include <language/dictionary/split-file.h>
     -#include <language/data-io/file-handle.h>
     -#include <language/lexer/lexer.h>
     -#include <libpspp/compiler.h>
     -#include <libpspp/message.h>
     -#include <math/covariance.h>
     -#include <math/categoricals.h>
     -#include <math/linreg.h>
     -#include <math/moments.h>
     -#include <output/tab.h>
     -
     -#include "xalloc.h"
     +#include "data/case.h"
     +#include "data/casegrouper.h"
     +#include "data/casereader.h"
     +#include "data/dictionary.h"
     +#include "data/missing-values.h"
     +#include "data/procedure.h"
     +#include "data/transformations.h"
     +#include "data/value-labels.h"
     +#include "data/variable.h"
     +#include "language/command.h"
     +#include "language/data-io/file-handle.h"
     +#include "language/dictionary/split-file.h"
     +#include "language/lexer/lexer.h"
     +#include "libpspp/compiler.h"
     +#include "libpspp/message.h"
     +#include "math/categoricals.h"
     +#include "math/covariance.h"
     +#include "math/interaction.h"
     +#include "math/linreg.h"
     +#include "math/moments.h"
     +#include "output/tab.h"
     +
     +#include "gl/xalloc.h"
     +
      #include "gettext.h"
      
      /* (headers) */
     @@ -98,12 +100,12 @@ static bool run_glm (struct casereader *,
        two-way interactions.
       */
      static void
     -check_interactions (struct dataset *ds, struct cmd_glm *cmd)
     +check_interactions (struct cmd_glm *cmd)
      {
        size_t i;
        size_t j;
        size_t k = 0;
     -  struct variable **interaction_vars;
     +  const struct variable **interaction_vars;
      
        /* 
           User did not specify the design matrix, so we 
     @@ -153,7 +155,7 @@ cmd_glm (struct lexer *lexer, struct dataset *ds)
      
        if (!lex_match_id (lexer, "DESIGN"))
          {
     -      check_interactions (ds, &cmd);
     +      check_interactions (&cmd);
          }
         /* Data pass. */
        grouper = casegrouper_create_splits (proc_open (ds), dataset_dict (ds));
     @@ -191,7 +193,7 @@ glm_custom_design (struct lexer *lexer, struct dataset 
*ds,
      {
        size_t n_allocated = 2;
        size_t n_members;
     -  struct variable **interaction_vars;
     +  const struct variable **interaction_vars;
        struct variable *this_var;
      
        interactions = xnmalloc (n_allocated, sizeof (*interactions));
     @@ -250,17 +252,6 @@ glm_custom_dependent (struct lexer *lexer, struct 
dataset *ds,
        return 1;
      }
      
     -static linreg *
     -fit_model (const struct covariance *cov,
     -     const struct variable *dep_var, 
     -     const struct variable ** indep_vars, 
     -     size_t n_data, size_t n_indep)
     -{
     -  linreg *result = NULL;
     -  
     -  return result;
     -}
     -
      static bool
      run_glm (struct casereader *input,
         struct cmd_glm *cmd,
     @@ -269,16 +260,15 @@ run_glm (struct casereader *input,
        casenumber row;
        const struct variable **numerics = NULL;
        const struct variable **categoricals = NULL;
     -  int n_indep = 0;
     -  linreg *model = NULL; 
        pspp_linreg_opts lopts;
        struct ccase *c;
     -  size_t i;
     -  size_t n_data;          /* Number of valid cases. */
     +  size_t i, j, k;
        size_t n_categoricals = 0;
        size_t n_numerics;
        struct casereader *reader;
        struct covariance *cov;
     +  struct casereader *r;
     +  struct categoricals *cats;
      
        c = casereader_peek (input, 0);
        if (c == NULL)
     @@ -325,8 +315,8 @@ run_glm (struct casereader *input,
          }
        numerics = xnmalloc (n_numerics, sizeof *numerics);
        categoricals = xnmalloc (n_categoricals, sizeof (*categoricals));
     -  size_t j = 0;
     -  size_t k = 0;
     +  j = 0;
     +  k = 0;
        for (i = 0; i < cmd->n_by; i++)
          {
            if (var_is_alpha (cmd->v_by[i]))
     @@ -359,7 +349,7 @@ run_glm (struct casereader *input,
            k++;
          }
      
     -  struct categoricals *cats =
     +  cats =
          categoricals_create (categoricals, n_categoricals,
                         NULL, MV_NEVER,
                         NULL, NULL, NULL, NULL);
     @@ -373,7 +363,7 @@ run_glm (struct casereader *input,
                                             MV_ANY, NULL, NULL);
        reader = casereader_create_filter_missing (reader, categoricals, 
n_categoricals,
                                             MV_ANY, NULL, NULL);
     -  struct casereader *r = casereader_clone (reader);
     +  r = casereader_clone (reader);
      
        reader = casereader_create_counter (reader, &row, -1);
        
     -- 
     1.7.1
     
     
     _______________________________________________
     pspp-dev mailing list
     address@hidden
     http://lists.gnu.org/mailman/listinfo/pspp-dev

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

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