bool warn = true;
double sigma_t = 0.0;
- struct datum *row = xcalloc (ost->n_vars, sizeof *row);
+ struct datum *row = XCALLOC (ost->n_vars, struct datum);
double rsq;
struct friedman fr;
fr.rank_sum = xcalloc (ost->n_vars, sizeof *fr.rank_sum);
double prev_x = SYSMIS;
int run_length = 0;
- const double w = weight ? case_data (c, weight)->f: 1.0;
+ const double w = weight ? case_num (c, weight) : 1.0;
fr.cc += w;
{
double x = row[v].x;
/* Replace value by the Rank */
- if ( prev_x == x)
+ if (prev_x == x)
{
/* Deal with ties */
int i;
else
{
row[v].x = v + 1;
- if ( run_length > 0)
+ if (run_length > 0)
{
double t = run_length + 1;
sigma_t += w * (pow3 (t) - t);
}
prev_x = x;
}
- if ( run_length > 0)
+ if (run_length > 0)
{
double t = run_length + 1;
- sigma_t += w * (pow3 (t) - t );
+ sigma_t += w * (pow3 (t) - t);
}
qsort (row, ost->n_vars, sizeof *row, cmp_posn);
rsq = numerator;
- numerator *= 12.0 / (fr.cc * ost->n_vars * ( ost->n_vars + 1));
- numerator -= 3 * fr.cc * ( ost->n_vars + 1);
+ numerator *= 12.0 / (fr.cc * ost->n_vars * (ost->n_vars + 1));
+ numerator -= 3 * fr.cc * (ost->n_vars + 1);
- denominator = 1 - sigma_t / ( fr.cc * ost->n_vars * ( pow2 (ost->n_vars) - 1));
+ denominator = 1 - sigma_t / (fr.cc * ost->n_vars * (pow2 (ost->n_vars) - 1));
fr.chi_sq = numerator / denominator;
- if ( ft->kendalls_w)
+ if (ft->kendalls_w)
{
fr.w = 12 * rsq ;
fr.w -= 3 * pow2 (fr.cc) *