Merge commit 'origin/stable'
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 31 Mar 2009 07:48:51 +0000 (15:48 +0800)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 31 Mar 2009 07:48:51 +0000 (15:48 +0800)
1  2 
Smake
doc/statistics.texi
src/data/por-file-writer.c
src/data/psql-reader.c

diff --combined Smake
index 84537ef08561f7011d846e256f095e487106e3b1,5a76b3c1635f657c1440b7827b303b70ecf2fc5f..4c8d83bc3bdae38f08560b305bb7a754a1220f42
--- 1/Smake
--- 2/Smake
+++ b/Smake
@@@ -5,7 -5,6 +5,7 @@@ GNULIB = ../gnuli
  GNULIB_TOOL = $(GNULIB)/gnulib-tool
  
  GNULIB_MODULES = \
 +      argp \
        assert \
        byteswap \
        c-ctype \
@@@ -16,6 -15,7 +16,7 @@@
        environ \
        exit \
        fatal-signal \
+       fcntl \
        fpieee \
        fprintf-posix \
        full-read \
@@@ -112,7 -112,6 +113,7 @@@ gettextize
  po/POTFILES.in:
        for f in `find src \( -name \*.[qc] -o -name \*.glade \) ! -name .\* -print` ; do \
                if test $$f = src/libpspp/version.c; then continue; fi;   \
 +              if test $$f = src/ui/gui/psppire-marshal.c; then continue; fi; \
                if test -e `dirname $$f`/`basename $$f .c`.q ; then continue; fi; \
                echo $$f ; \
        done | sort | uniq > $@.tmp
diff --combined doc/statistics.texi
index 311f5d7ad98d7588256cf835b58d0e56a2727eda,8fa93b1566a38fe304836d8d473fcc2dde7189b3..985560604b02b52b02440dcd39a36bd1b773c118
@@@ -14,7 -14,6 +14,7 @@@ far
  * ONEWAY::                      One way analysis of variance.
  * RANK::                        Compute rank scores.
  * REGRESSION::                  Linear regression.
 +* RELIABILITY::                 Reliability analysis.
  @end menu
  
  @node DESCRIPTIVES
@@@ -233,7 -232,7 +233,7 @@@ EXAMIN
          /PLOT=@{BOXPLOT, NPPLOT, HISTOGRAM, ALL, NONE@}
          /CINTERVAL n
          /COMPARE=@{GROUPS,VARIABLES@}
 -        /ID=@{case_number, var_name@}
 +        /ID=var_name
          /@{TOTAL,NOTOTAL@}
          /PERCENTILE=[value_list]=@{HAVERAGE, WAVERAGE, ROUND, AEMPIRICAL, EMPIRICAL @}
          /MISSING=@{LISTWISE, PAIRWISE@} [@{EXCLUDE, INCLUDE@}] 
@@@ -272,12 -271,6 +272,12 @@@ If /COMPARE=VARIABLES is specified, the
  each containing one boxplot per dependent variable.
  If the /COMPARE subcommand is ommitted, then PSPP uses the default value of 
  /COMPARE=GROUPS.
 + 
 +The ID subcommand also pertains to boxplots.  If given, it must
 +specify a variable name.   Outliers and extreme cases plotted in
 +boxplots will be labelled with the case from that variable.  Numeric or
 +string variables are permissible.  If the ID subcommand is not given,
 +then the casenumber will be used for labelling.
  
  The CINTERVAL subcommand specifies the confidence interval to use in
  calculation of the descriptives command.  The default it 95%.
@@@ -506,8 -499,6 +506,8 @@@ NPAR TEST
       [ /STATISTICS=@{DESCRIPTIVES@} ]
  
       [ /MISSING=@{ANALYSIS, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
 +
 +     [ /METHOD=EXACT [ TIMER [(n)] ] ]
  @end display
  
  NPAR TESTS performs nonparametric tests. 
@@@ -517,21 -508,10 +517,21 @@@ One or more tests may be specified by u
  If the /STATISTICS subcommand is also specified, then summary statistics are 
  produces for each variable that is the subject of any test.
  
 +Certain tests may take a long time to execute, if an exact figure is required.
 +Therefore, by default asymptotic approximations are used unless the
 +subcommand /METHOD=EXACT is specified.  
 +Exact tests give more accurate results, but may take an unacceptably long 
 +time to perform.  If the TIMER keyword is used, it sets a maximum time,
 +after which the test will be abandoned, and a warning message printed.
 +The time, in minutes, should be specified in parentheses after the TIMER keyword.
 +If the TIMER keyword is given without this figure, then a default value of 5 minutes 
 +is used.
 +
  
  @menu
  * BINOMIAL::                Binomial Test
  * CHISQUARE::               Chisquare Test
 +* WILCOXON::                Wilcoxon Signed Ranks Test
  @end menu
  
  
@@@ -566,7 -546,7 +566,7 @@@ values
  If more than two distinct, non-missing values for a variable
  under test are encountered then an error occurs.
  
- If the test proportion is equal to 0.5, then a one tailed test is
+ If the test proportion is equal to 0.5, then a two tailed test is
  reported.   For any other test proportion, a one tailed test is
  reported.   
  For one tailed tests, if the test proportion is less than
@@@ -611,34 -591,6 +611,34 @@@ sum of the frequencies need not be 1
  If no /EXPECTED subcommand is given, then then equal frequencies 
  are expected.
  
 +@node WILCOXON
 +@subsection Wilcoxon
 +@comment  node-name,  next,  previous,  up
 +@vindex WILCOXON
 +@cindex wilcoxon matched pairs signed ranks test
 +
 +@display
 +     [ /WILCOXON varlist [ WITH varlist [ (PAIRED) ]]]
 +@end display
 +
 +The wilcoxon subcommand tests for differences between means of the 
 +variables listed.  The test does not make any assumptions about the
 +variances of the samples.
 +
 +If the @code{WITH} keyword is omitted, then tests for all
 +combinations of the listed variables are performed.
 +If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
 +is also given, then the number of variables preceding @code{WITH}
 +must be the same as the number following it.
 +In this case, tests for each respective pair of variables are
 +performed.
 +If the @code{WITH} keyword is given, but the
 +@code{(PAIRED)} keyword is omitted, then tests for each combination
 +of variable preceding @code{WITH} against variable following
 +@code{WITH} are performed.
 +
 +If the number of observations is large, and exact tests have been
 +requested. then the test may take a very long time to complete.
  
  @node T-TEST
  @comment  node-name,  next,  previous,  up
@@@ -814,6 -766,7 +814,6 @@@ If the total sum of the coefficients ar
  display a warning, but will proceed with the analysis.
  The @code{CONTRAST} subcommand may be given up to 10 times in order
  to specify different contrast tests.
 -@setfilename ignored
  
  @node RANK
  @comment  node-name,  next,  previous,  up
@@@ -878,50 -831,3 +878,50 @@@ user-missing are to be excluded from th
  INCLUDE means they are to be included.  The default is EXCLUDE.
  
  @include regression.texi
 +
 +
 +@node RELIABILITY
 +@section RELIABILITY
 +
 +@vindex RELIABILITY
 +@display
 +RELIABILITY
 +        /VARIABLES=var_list
 +        /SCALE (@var{name}) = @{var_list, ALL@}
 +        /MODEL=@{ALPHA, SPLIT[(N)]@}
 +        /SUMMARY=@{TOTAL,ALL@}
 +        /MISSING=@{EXCLUDE,INCLUDE@}
 +@end display
 +
 +@cindex Cronbach's Alpha
 +The @cmd{RELIABILTY} command performs reliablity analysis on the data.
 +
 +The VARIABLES subcommand is required. It determines the set of variables 
 +upon which analysis is to be performed.
 +
 +The SCALE subcommand determines which variables reliability is to be 
 +calculated for.  If it is omitted, then analysis for all variables named
 +in the VARIABLES subcommand will be used.
 +Optionally, the @var{name} parameter may be specified to set a string name 
 +for the scale.
 +
 +The MODEL subcommand determines the type of analysis. If ALPHA is specified, 
 +then Cronbach's Alpha is calculated for the scale.  If the model is SPLIT, 
 +then the variables  are divided into 2 subsets.  An optional parameter 
 +@var{N} may be given, to specify how many variables to be in the first subset.
 +If @var{N} is omitted, then it defaults to one half of the variables in the 
 +scale, or one half minus one if there are an odd number of variables.
 +The default model is ALPHA.
 +
 +By default, any cases with user missing, or system missing values for 
 +any variables given 
 +in the VARIABLES subcommand will be omitted from analysis.
 +The MISSING subcommand determines whether user missing values are to 
 +be included or excluded in the analysis.
 +
 +The SUMMARY subcommand determines the type of summary analysis to be performed.
 +Currently there is only one type: SUMMARY=TOTAL, which displays per-item
 +analysis tested against the totals.
 +
 +
 +
index 773969302ebcb9ddc3b06fea93aa1da6c66c313c,a50563ab964275df30365263005dbd1ded5262c9..8de293c5eafb2904d065db08f7779c9980f4e805
@@@ -1,5 -1,5 +1,5 @@@
  /* PSPP - a program for statistical analysis.
 -   Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
 +   Copyright (C) 1997-9, 2000, 2006, 2009 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
@@@ -215,7 -215,8 +215,8 @@@ write_float (struct pfm_writer *w, doub
    char buffer[64];
    format_trig_double (d, floor (d) == d ? DBL_DIG : w->digits, buffer);
    buf_write (w, buffer, strlen (buffer));
-   buf_write (w, "/", 1);
+   if (d != SYSMIS)
+     buf_write (w, "/", 1);
  }
  
  /* Write N to the portable file as an integer field. */
@@@ -463,7 -464,7 +464,7 @@@ por_file_casewriter_write (struct casew
    else
      casewriter_force_error (writer);
  
 -  case_destroy (c);
 +  case_unref (c);
  }
  
  static void
diff --combined src/data/psql-reader.c
index a54b9f8b3888c58320623ea1d53086bc8650a155,9df82b558c69252930fdf932e0ed5575edd3cfa8..be6d0a60759c45746ea01b660ca35e8f1770064b
@@@ -1,5 -1,5 +1,5 @@@
  /* PSPP - a program for statistical analysis.
 -   Copyright (C) 2008 Free Software Foundation, Inc.
 +   Copyright (C) 2008, 2009 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
@@@ -37,7 -37,7 +37,7 @@@
  
  #if !PSQL_SUPPORT
  struct casereader *
 -psql_open_reader (struct psql_read_info *info, struct dictionary **dict)
 +psql_open_reader (struct psql_read_info *info UNUSED, struct dictionary **dict UNUSED)
  {
    msg (ME, _("Support for reading postgres databases was not compiled into this installation of PSPP"));
  
@@@ -75,7 -75,8 +75,7 @@@
  
  static void psql_casereader_destroy (struct casereader *reader UNUSED, void *r_);
  
 -static bool psql_casereader_read (struct casereader *, void *,
 -                                struct ccase *);
 +static struct ccase *psql_casereader_read (struct casereader *, void *);
  
  static const struct casereader_class psql_casereader_class =
    {
@@@ -108,7 -109,8 +108,7 @@@ struct psql_reade
  };
  
  
 -static bool set_value (struct psql_reader *r,
 -                     struct ccase *cc);
 +static struct ccase *set_value (struct psql_reader *r);
  
  
  
@@@ -440,6 -442,10 +440,10 @@@ psql_open_reader (struct psql_read_inf
          break;
        }
  
+       if ( width == 0 && fmt_is_string (fmt.type))
+       fmt.w = width = MAX_SHORT_STRING;
        var = create_var (r, &fmt, width, PQfname (qres, i), i);
        if ( type == NUMERICOID && n_tuples > 0)
        {
@@@ -544,8 -550,9 +548,8 @@@ psql_casereader_destroy (struct caserea
  
  
  
 -static bool
 -psql_casereader_read (struct casereader *reader UNUSED, void *r_,
 -                    struct ccase *cc)
 +static struct ccase *
 +psql_casereader_read (struct casereader *reader UNUSED, void *r_)
  {
    struct psql_reader *r = r_;
  
        return false;
      }
  
 -  return set_value (r, cc);
 +  return set_value (r);
  }
  
 -static bool
 -set_value (struct psql_reader *r,
 -         struct ccase *c)
 +static struct ccase *
 +set_value (struct psql_reader *r)
  {
 -  int i;
 +  struct ccase *c;
    int n_vars;
 +  int i;
  
    assert (r->res);
  
    n_vars = PQnfields (r->res);
  
    if ( r->tuple >= PQntuples (r->res))
 -    return false;
 +    return NULL;
  
 -  case_create (c, r->value_cnt);
 +  c = case_create (r->value_cnt);
    memset (case_data_rw_idx (c, 0)->s, ' ', MAX_SHORT_STRING * r->value_cnt);
  
  
  
    r->tuple++;
  
 -  return true;
 +  return c;
  }
  
  #endif