z = rs->runs - mu;
- if ( rs->n < 50)
+ if (rs->n < 50)
{
if (z <= -0.5)
z += 0.5;
struct one_sample_test *otp = UP_CAST (test, struct one_sample_test, parent);
struct runs_test *rt = UP_CAST (otp, struct runs_test, parent);
- struct run_state *rs = xcalloc (otp->n_vars, sizeof (*rs));
+ struct run_state *rs = XCALLOC (otp->n_vars, struct run_state);
- switch ( rt->cp_mode)
+ switch (rt->cp_mode)
{
case CP_MODE:
{
struct ccase *c;
for (; (c = casereader_read (group)); case_unref (c))
{
- const double w = weight ? case_data (c, weight)->f: 1.0;
+ const double w = weight ? case_num (c, weight) : 1.0;
const union value *val = case_data (c, var);
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
x = val->f;
cc += w;
}
- if ( cc > last_cc)
+ if (cc > last_cc)
{
run->cutpoint = x;
}
- else if ( cc == last_cc)
+ else if (cc == last_cc)
{
multimodal = true;
- if ( x > run->cutpoint)
+ if (x > run->cutpoint)
run->cutpoint = x;
}
last_cc = cc;
subcase_init_var (&sc, var, SC_ASCEND);
writer = sort_create_writer (&sc, casereader_get_proto (reader));
- for (; (c = casereader_read (reader)); )
+ for (; (c = casereader_read (reader));)
{
const union value *val = case_data (c, var);
- const double w = weight ? case_data (c, weight)->f: 1.0;
- if ( var_is_value_missing (var, val, exclude))
+ const double w = weight ? case_num (c, weight) : 1.0;
+ if (var_is_value_missing (var, val) & exclude)
{
case_unref (c);
continue;
cc += w;
casewriter_write (writer, c);
}
- subcase_destroy (&sc);
+ subcase_uninit (&sc);
casereader_destroy (reader);
reader = casewriter_make_reader (writer);
struct casereader *reader = casereader_clone (input);
for (; (c = casereader_read (reader)); case_unref (c))
{
- const double w = weight ? case_data (c, weight)->f: 1.0;
+ const double w = weight ? case_num (c, weight) : 1.0;
for (v = 0; v < otp->n_vars; ++v)
{
const struct variable *var = otp->vars[v];
const double x = val->f;
struct run_state *run = &rs[v];
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
run->cutpoint += x * w;
for (; (c = casereader_read (input)); case_unref (c))
{
- const double w = weight ? case_data (c, weight)->f: 1.0;
+ const double w = weight ? case_num (c, weight) : 1.0;
for (v = 0; v < otp->n_vars; ++v)
{
double d = x - run->cutpoint;
short sign = 0;
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
if (d >= 0)