projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
981adc6
)
refactoring
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 27 Aug 2022 21:08:05 +0000
(14:08 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 27 Aug 2022 21:08:05 +0000
(14:08 -0700)
src/language/stats/ctables.c
patch
|
blob
|
history
diff --git
a/src/language/stats/ctables.c
b/src/language/stats/ctables.c
index 68d3e852bada61724c5fcfd5f45696eca28c7903..19c1bb84cc915c612b975f9da4956fca7a6201c3 100644
(file)
--- a/
src/language/stats/ctables.c
+++ b/
src/language/stats/ctables.c
@@
-1224,7
+1224,6
@@
add_summary_spec (struct ctables_axis *axis,
static struct ctables_axis *ctables_axis_parse_stack (
struct ctables_axis_parse_ctx *);
static struct ctables_axis *ctables_axis_parse_stack (
struct ctables_axis_parse_ctx *);
-
static struct ctables_axis *
ctables_axis_parse_primary (struct ctables_axis_parse_ctx *ctx)
{
static struct ctables_axis *
ctables_axis_parse_primary (struct ctables_axis_parse_ctx *ctx)
{
@@
-2663,50
+2662,39
@@
ctables_summary_add (union ctables_summary *s,
double weight)
{
/* To determine whether a case is included in a given table for a particular
double weight)
{
/* To determine whether a case is included in a given table for a particular
- kind of summary, consider the following charts for each variable in the
- table. Only if "yes" appears for every variable for the summary is the
- case counted.
+ kind of summary, consider the following charts for the variable being
+ summarized. Only if "yes" appears is the case counted.
- Categorical variables: VALIDN
COUNT
TOTALN
+ Categorical variables: VALIDN
other
TOTALN
Valid values in included categories yes yes yes
Missing values in included categories --- yes yes
Missing values in excluded categories --- --- yes
Valid values in excluded categories --- --- ---
Valid values in included categories yes yes yes
Missing values in included categories --- yes yes
Missing values in excluded categories --- --- yes
Valid values in excluded categories --- --- ---
- Scale variables: VALIDN
COUNT
TOTALN
+ Scale variables: VALIDN
other
TOTALN
Valid value yes yes yes
Missing value --- yes yes
Missing values include both user- and system-missing. (The system-missing
value is always in an excluded category.)
Valid value yes yes yes
Missing value --- yes yes
Missing values include both user- and system-missing. (The system-missing
value is always in an excluded category.)
+
+ One way to interpret the above table is that scale variables are like
+ categorical variables in which all values are in included categories.
*/
switch (ss->function)
{
case CTSF_TOTALN:
*/
switch (ss->function)
{
case CTSF_TOTALN:
- s->count += weight;
- break;
-
case CTSF_areaPCT_TOTALN:
s->count += weight;
break;
case CTSF_COUNT:
case CTSF_areaPCT_TOTALN:
s->count += weight;
break;
case CTSF_COUNT:
- if (is_scale || is_included)
- s->count += weight;
- break;
-
case CTSF_areaPCT_COUNT:
case CTSF_areaPCT_COUNT:
- if (is_
scale || is_
included)
+ if (is_included)
s->count += weight;
break;
case CTSF_VALIDN:
s->count += weight;
break;
case CTSF_VALIDN:
- if (is_scale
- ? !is_scale_missing
- : !is_missing)
- s->count += weight;
- break;
-
case CTSF_areaPCT_VALIDN:
if (is_scale
? !is_scale_missing
case CTSF_areaPCT_VALIDN:
if (is_scale
? !is_scale_missing
@@
-3297,11
+3285,12
@@
ctables_cell_add__ (struct ctables_section *s, const struct ccase *c,
const struct ctables_summary_spec_set *specs = &ss->specs[cell->sv];
const union value *value = case_data (c, specs->var);
bool is_missing = var_is_value_missing (specs->var, value);
const struct ctables_summary_spec_set *specs = &ss->specs[cell->sv];
const union value *value = case_data (c, specs->var);
bool is_missing = var_is_value_missing (specs->var, value);
- bool scale_missing = specs->is_scale && (is_missing || is_listwise_missing (specs, c));
+ bool is_scale_missing
+ = specs->is_scale && (is_missing || is_listwise_missing (specs, c));
for (size_t i = 0; i < specs->n; i++)
ctables_summary_add (&cell->summaries[i], &specs->specs[i], value,
for (size_t i = 0; i < specs->n; i++)
ctables_summary_add (&cell->summaries[i], &specs->specs[i], value,
- specs->is_scale, scale_missing, is_missing,
+ specs->is_scale,
is_
scale_missing, is_missing,
is_included, weight[specs->specs[i].weighting]);
for (enum ctables_area_type at = 0; at < N_CTATS; at++)
if (!(cell->omit_areas && (1u << at)))
is_included, weight[specs->specs[i].weighting]);
for (enum ctables_area_type at = 0; at < N_CTATS; at++)
if (!(cell->omit_areas && (1u << at)))
@@
-3315,7
+3304,7
@@
ctables_cell_add__ (struct ctables_section *s, const struct ccase *c,
{
add_weight (a->valid, weight);
{
add_weight (a->valid, weight);
- if (!scale_missing)
+ if (!
is_
scale_missing)
for (size_t i = 0; i < s->table->n_sum_vars; i++)
{
const struct variable *var = s->table->sum_vars[i];
for (size_t i = 0; i < s->table->n_sum_vars; i++)
{
const struct variable *var = s->table->sum_vars[i];