116 |
struct factor *factor); |
struct factor *factor); |
117 |
|
|
118 |
static void show_percentiles(struct variable **dependent_var, |
static void show_percentiles(struct variable **dependent_var, |
119 |
int n_dep_var, |
int n_dep_var, |
120 |
struct factor *factor); |
struct factor *factor); |
121 |
|
|
122 |
|
|
123 |
|
|
151 |
/* Represent a factor as a string, so it can be |
/* Represent a factor as a string, so it can be |
152 |
printed in a human readable fashion */ |
printed in a human readable fashion */ |
153 |
const char * factor_to_string(const struct factor *fctr, |
const char * factor_to_string(const struct factor *fctr, |
154 |
struct factor_statistics *fs, |
struct factor_statistics *fs, |
155 |
const struct variable *var); |
const struct variable *var); |
156 |
|
|
157 |
|
|
158 |
/* Represent a factor as a string, so it can be |
/* Represent a factor as a string, so it can be |
211 |
multipass_procedure_with_splits (run_examine, &cmd); |
multipass_procedure_with_splits (run_examine, &cmd); |
212 |
|
|
213 |
if ( totals ) |
if ( totals ) |
214 |
free( totals ); |
{ |
215 |
|
free( totals ); |
216 |
|
} |
217 |
|
|
218 |
if ( dependent_vars ) |
if ( dependent_vars ) |
219 |
free (dependent_vars); |
free (dependent_vars); |
469 |
|
|
470 |
|
|
471 |
|
|
472 |
/* Parser for the variables sub command */ |
/* Parser for the variables sub command |
473 |
|
Returns 1 on success */ |
474 |
static int |
static int |
475 |
xmn_custom_variables(struct cmd_examine *cmd ) |
xmn_custom_variables(struct cmd_examine *cmd ) |
476 |
{ |
{ |
|
|
|
477 |
lex_match('='); |
lex_match('='); |
478 |
|
|
479 |
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) |
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) |
480 |
&& token != T_ALL) |
&& token != T_ALL) |
481 |
return 2; |
{ |
482 |
|
return 2; |
483 |
|
} |
484 |
|
|
485 |
if (!parse_variables (default_dict, &dependent_vars, &n_dependent_vars, |
if (!parse_variables (default_dict, &dependent_vars, &n_dependent_vars, |
486 |
PV_NO_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH) ) |
PV_NO_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH) ) |
492 |
assert(n_dependent_vars); |
assert(n_dependent_vars); |
493 |
|
|
494 |
totals = xmalloc( sizeof(struct metrics) * n_dependent_vars); |
totals = xmalloc( sizeof(struct metrics) * n_dependent_vars); |
|
memset ( totals, 0, sizeof(struct metrics) * n_dependent_vars); |
|
495 |
|
|
496 |
if ( lex_match(T_BY)) |
if ( lex_match(T_BY)) |
497 |
{ |
{ |
498 |
return examine_parse_independent_vars(cmd); |
int success ; |
499 |
|
success = examine_parse_independent_vars(cmd); |
500 |
|
if ( success != 1 ) { |
501 |
|
free (dependent_vars); |
502 |
|
free (totals) ; |
503 |
|
} |
504 |
|
return success; |
505 |
} |
} |
506 |
|
|
507 |
return 1; |
return 1; |
513 |
static int |
static int |
514 |
examine_parse_independent_vars(struct cmd_examine *cmd) |
examine_parse_independent_vars(struct cmd_examine *cmd) |
515 |
{ |
{ |
516 |
|
int success; |
517 |
struct factor *sf = xmalloc(sizeof(struct factor)); |
struct factor *sf = xmalloc(sizeof(struct factor)); |
518 |
|
|
519 |
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) |
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) |
520 |
&& token != T_ALL) |
&& token != T_ALL) |
521 |
return 2; |
{ |
522 |
|
free ( sf ) ; |
523 |
|
return 2; |
524 |
|
} |
525 |
|
|
526 |
|
|
527 |
sf->indep_var[0] = parse_variable(); |
sf->indep_var[0] = parse_variable(); |
534 |
|
|
535 |
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) |
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) |
536 |
&& token != T_ALL) |
&& token != T_ALL) |
537 |
return 2; |
{ |
538 |
|
free ( sf ) ; |
539 |
|
return 2; |
540 |
|
} |
541 |
|
|
542 |
sf->indep_var[1] = parse_variable(); |
sf->indep_var[1] = parse_variable(); |
543 |
|
|
558 |
if ( token == '.' || token == '/' ) |
if ( token == '.' || token == '/' ) |
559 |
return 1; |
return 1; |
560 |
|
|
561 |
return examine_parse_independent_vars(cmd); |
success = examine_parse_independent_vars(cmd); |
562 |
|
|
563 |
|
if ( success != 1 ) |
564 |
|
free ( sf ) ; |
565 |
|
|
566 |
|
return success; |
567 |
} |
} |
568 |
|
|
569 |
|
|
815 |
{ |
{ |
816 |
int i; |
int i; |
817 |
for ( i = 0 ; i < n_dependent_vars ; ++i ) |
for ( i = 0 ; i < n_dependent_vars ; ++i ) |
818 |
metrics_destroy(&totals[i]); |
{ |
819 |
|
metrics_destroy(&totals[i]); |
820 |
|
} |
821 |
} |
} |
822 |
|
|
823 |
} |
} |
850 |
n_rows = n_dep_var * n_factors ; |
n_rows = n_dep_var * n_factors ; |
851 |
|
|
852 |
if ( fctr->indep_var[1] ) |
if ( fctr->indep_var[1] ) |
853 |
heading_columns = 3; |
heading_columns = 3; |
854 |
} |
} |
855 |
else |
else |
856 |
{ |
{ |
975 |
if ( 0 != compare_values(&prev, &(*fs)->id[0], |
if ( 0 != compare_values(&prev, &(*fs)->id[0], |
976 |
fctr->indep_var[0]->width)) |
fctr->indep_var[0]->width)) |
977 |
{ |
{ |
978 |
tab_text (tbl, |
tab_text (tbl, |
979 |
1, |
1, |
980 |
(i * n_factors ) + count + |
(i * n_factors ) + count + |
981 |
heading_rows, |
heading_rows, |
982 |
TAB_LEFT | TAT_TITLE, |
TAB_LEFT | TAT_TITLE, |
983 |
value_to_string(&(*fs)->id[0], fctr->indep_var[0]) |
value_to_string(&(*fs)->id[0], fctr->indep_var[0]) |
984 |
); |
); |
985 |
|
|
986 |
if (fctr->indep_var[1] && count > 0 ) |
if (fctr->indep_var[1] && count > 0 ) |
987 |
tab_hline(tbl, TAL_1, 1, n_cols - 1, |
tab_hline(tbl, TAL_1, 1, n_cols - 1, |
988 |
(i * n_factors ) + count + heading_rows); |
(i * n_factors ) + count + heading_rows); |
989 |
|
|
990 |
} |
} |
991 |
|
|
1068 |
n_rows = n_dep_var * 2 * n_extremities * n_factors; |
n_rows = n_dep_var * 2 * n_extremities * n_factors; |
1069 |
|
|
1070 |
if ( fctr->indep_var[1] ) |
if ( fctr->indep_var[1] ) |
1071 |
heading_columns = 3; |
heading_columns = 3; |
1072 |
} |
} |
1073 |
else |
else |
1074 |
{ |
{ |
1245 |
cn->num, 8, 0); |
cn->num, 8, 0); |
1246 |
|
|
1247 |
if ( cn->next ) |
if ( cn->next ) |
1248 |
cn = cn->next; |
cn = cn->next; |
1249 |
|
|
1250 |
} |
} |
1251 |
|
|
1274 |
cn->num, 8, 0); |
cn->num, 8, 0); |
1275 |
|
|
1276 |
if ( cn->next ) |
if ( cn->next ) |
1277 |
cn = cn->next; |
cn = cn->next; |
1278 |
|
|
1279 |
} |
} |
1280 |
|
|
1309 |
n_rows = n_dep_var * n_stat_rows * n_factors; |
n_rows = n_dep_var * n_stat_rows * n_factors; |
1310 |
|
|
1311 |
if ( fctr->indep_var[1] ) |
if ( fctr->indep_var[1] ) |
1312 |
heading_columns = 5; |
heading_columns = 5; |
1313 |
} |
} |
1314 |
else |
else |
1315 |
{ |
{ |
1409 |
); |
); |
1410 |
|
|
1411 |
populate_descriptives(tbl, heading_columns - 2, |
populate_descriptives(tbl, heading_columns - 2, |
1412 |
row, &(*fs)->m[i]); |
row, &(*fs)->m[i]); |
1413 |
|
|
1414 |
count++ ; |
count++ ; |
1415 |
fs++; |
fs++; |
1737 |
int n_factors = 0; |
int n_factors = 0; |
1738 |
int f=0; |
int f=0; |
1739 |
for ( fs = fctr->fs ; *fs ; ++fs ) |
for ( fs = fctr->fs ; *fs ; ++fs ) |
1740 |
++n_factors; |
++n_factors; |
1741 |
|
|
1742 |
chart_write_title(ch, _("Boxplot of %s vs. %s"), |
chart_write_title(ch, _("Boxplot of %s vs. %s"), |
1743 |
var_to_string(vars[i]), var_to_string(fctr->indep_var[0]) ); |
var_to_string(vars[i]), var_to_string(fctr->indep_var[0]) ); |
1874 |
/* Show the percentiles */ |
/* Show the percentiles */ |
1875 |
void |
void |
1876 |
show_percentiles(struct variable **dependent_var, |
show_percentiles(struct variable **dependent_var, |
1877 |
int n_dep_var, |
int n_dep_var, |
1878 |
struct factor *fctr) |
struct factor *fctr) |
1879 |
{ |
{ |
1880 |
struct tab_table *tbl; |
struct tab_table *tbl; |
1881 |
int i; |
int i; |
1900 |
ptiles = (*fs)->m[0].ptile_hash; |
ptiles = (*fs)->m[0].ptile_hash; |
1901 |
|
|
1902 |
if ( fctr->indep_var[1] ) |
if ( fctr->indep_var[1] ) |
1903 |
n_heading_columns = 4; |
n_heading_columns = 4; |
1904 |
} |
} |
1905 |
else |
else |
1906 |
{ |
{ |
2042 |
|
|
2043 |
|
|
2044 |
populate_percentiles(tbl, n_heading_columns - 1, |
populate_percentiles(tbl, n_heading_columns - 1, |
2045 |
row, &(*fs)->m[i]); |
row, &(*fs)->m[i]); |
2046 |
|
|
2047 |
|
|
2048 |
count++ ; |
count++ ; |
2054 |
else |
else |
2055 |
{ |
{ |
2056 |
populate_percentiles(tbl, n_heading_columns - 1, |
populate_percentiles(tbl, n_heading_columns - 1, |
2057 |
i * n_stat_rows * n_factors + n_heading_rows, |
i * n_stat_rows * n_factors + n_heading_rows, |
2058 |
&totals[i]); |
&totals[i]); |
2059 |
} |
} |
2060 |
|
|
2061 |
|
|
2164 |
|
|
2165 |
const char * |
const char * |
2166 |
factor_to_string_concise(const struct factor *fctr, |
factor_to_string_concise(const struct factor *fctr, |
2167 |
struct factor_statistics *fs) |
struct factor_statistics *fs) |
2168 |
|
|
2169 |
{ |
{ |
2170 |
|
|