68 |
/* DESCRIPTIVES transformation (for calculating Z-scores). */ |
/* DESCRIPTIVES transformation (for calculating Z-scores). */ |
69 |
struct dsc_trns |
struct dsc_trns |
70 |
{ |
{ |
|
struct trns_header h; |
|
71 |
struct dsc_z_score *z_scores; /* Array of Z-scores. */ |
struct dsc_z_score *z_scores; /* Array of Z-scores. */ |
72 |
int z_score_cnt; /* Number of Z-scores. */ |
int z_score_cnt; /* Number of Z-scores. */ |
73 |
struct variable **vars; /* Variables for listwise missing checks. */ |
struct variable **vars; /* Variables for listwise missing checks. */ |
568 |
(either system or user-missing values that weren't included). |
(either system or user-missing values that weren't included). |
569 |
*/ |
*/ |
570 |
static int |
static int |
571 |
descriptives_trns_proc (struct trns_header *trns, struct ccase * c, |
descriptives_trns_proc (void *trns_, struct ccase * c, |
572 |
int case_idx UNUSED) |
int case_idx UNUSED) |
573 |
{ |
{ |
574 |
struct dsc_trns *t = (struct dsc_trns *) trns; |
struct dsc_trns *t = trns_; |
575 |
struct dsc_z_score *z; |
struct dsc_z_score *z; |
576 |
struct variable **vars; |
struct variable **vars; |
577 |
int all_sysmis = 0; |
int all_sysmis = 0; |
610 |
|
|
611 |
/* Frees a descriptives_trns struct. */ |
/* Frees a descriptives_trns struct. */ |
612 |
static void |
static void |
613 |
descriptives_trns_free (struct trns_header * trns) |
descriptives_trns_free (void *trns_) |
614 |
{ |
{ |
615 |
struct dsc_trns *t = (struct dsc_trns *) trns; |
struct dsc_trns *t = trns_; |
616 |
|
|
617 |
free (t->z_scores); |
free (t->z_scores); |
618 |
assert((t->missing_type != DSC_LISTWISE) ^ (t->vars != NULL)); |
assert((t->missing_type != DSC_LISTWISE) ^ (t->vars != NULL)); |
631 |
cnt++; |
cnt++; |
632 |
|
|
633 |
t = xmalloc (sizeof *t); |
t = xmalloc (sizeof *t); |
|
t->h.proc = descriptives_trns_proc; |
|
|
t->h.free = descriptives_trns_free; |
|
634 |
t->z_scores = xnmalloc (cnt, sizeof *t->z_scores); |
t->z_scores = xnmalloc (cnt, sizeof *t->z_scores); |
635 |
t->z_score_cnt = cnt; |
t->z_score_cnt = cnt; |
636 |
t->missing_type = dsc->missing_type; |
t->missing_type = dsc->missing_type; |
647 |
t->var_cnt = 0; |
t->var_cnt = 0; |
648 |
t->vars = NULL; |
t->vars = NULL; |
649 |
} |
} |
|
|
|
650 |
|
|
651 |
for (cnt = i = 0; i < dsc->var_cnt; i++) |
for (cnt = i = 0; i < dsc->var_cnt; i++) |
652 |
{ |
{ |
681 |
} |
} |
682 |
} |
} |
683 |
|
|
684 |
add_transformation ((struct trns_header *) t); |
add_transformation (descriptives_trns_proc, descriptives_trns_free, t); |
685 |
} |
} |
686 |
|
|
687 |
/* Statistical calculation. */ |
/* Statistical calculation. */ |