X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fnpar-summary.c;h=c9c2c9da1a9d1a215b0152612fc46eb1240b34e7;hb=a9acce47d67e0ab35ce1690e4f1b1ac0121c2d78;hp=efb47458cef3424b0da52de43647effed2172874;hpb=dc78471910e82d59232ce9b137b7c4fc4992d174;p=pspp diff --git a/src/language/stats/npar-summary.c b/src/language/stats/npar-summary.c index efb47458ce..c9c2c9da1a 100644 --- a/src/language/stats/npar-summary.c +++ b/src/language/stats/npar-summary.c @@ -1,20 +1,18 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 2006 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 the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ #include #include @@ -36,7 +34,7 @@ void npar_summary_calc_descriptives (struct descriptives *desc, struct casereader *input, const struct dictionary *dict, - const struct variable *const *vv, + const struct variable *const *vv, int n_vars UNUSED, enum mv_class filter) { @@ -62,24 +60,24 @@ npar_summary_calc_descriptives (struct descriptives *desc, double w = dict_get_case_weight (dict, &c, NULL); minimum = MIN (minimum, val); maximum = MAX (maximum, val); - moments1_add (moments, val, w); + moments1_add (moments, val, w); case_destroy (&c); } casereader_destroy (pass); - moments1_calculate (moments, - &desc[i].n, - &desc[i].mean, + moments1_calculate (moments, + &desc[i].n, + &desc[i].mean, &var, NULL, NULL); desc[i].std_dev = sqrt (var); moments1_destroy (moments); - + desc[i].min = minimum; desc[i].max = maximum; - + i++; } casereader_destroy (input); @@ -88,7 +86,7 @@ npar_summary_calc_descriptives (struct descriptives *desc, void -do_summary_box (const struct descriptives *desc, +do_summary_box (const struct descriptives *desc, const struct variable *const *vv, int n_vars) { @@ -108,53 +106,53 @@ do_summary_box (const struct descriptives *desc, tab_dim (table, tab_natural_dimensions); tab_title (table, _("Descriptive Statistics")); - + tab_headers (table, 1, 0, 1, 0); - tab_box (table, TAL_1, TAL_1, -1, TAL_1, + tab_box (table, TAL_1, TAL_1, -1, TAL_1, 0, 0, table->nc - 1, tab_nr(table) - 1 ); tab_hline (table, TAL_2, 0, tab_nc (table) -1, 2); tab_vline (table, TAL_2, 1, 0, tab_nr (table) - 1); col = 1; - if ( desc ) + if ( desc ) { - tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, + tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, _("N")); col++; - tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, + tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, _("Mean")); col++; - tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, + tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, _("Std. Deviation")); col++; - tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, + tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, _("Minimum")); col++; - tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, + tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, _("Maximum")); col++; } - if ( quartiles ) + if ( quartiles ) { tab_joint_text (table, col, 0, col + 2, 0, TAT_TITLE | TAB_CENTER, _("Percentiles")); tab_hline (table, TAL_1, col, col + 2, 1); - tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, + tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, _("25th")); col++; - tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, + tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, _("50th (Median)")); col++; - tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, + tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, _("75th")); col++; } - for ( v = 0 ; v < n_vars ; ++v ) + for ( v = 0 ; v < n_vars ; ++v ) { tab_text (table, 0, 2 + v, TAT_NONE, var_to_string (vv[v]));