+ int v;
+ double result = 1.0;
+
+ const struct interact_params *iap = &cat->iap[i];
+
+ double dfp = 1.0;
+ for (v = 0; v < iact->n_vars; ++v)
+ {
+ const struct variable *var = iact->vars[v];
+
+ const union value *val = case_data (c, var);
+ const int width = var_get_width (var);
+ const struct variable_node *vn = lookup_variable (&cat->varmap, var, hash_pointer (var, 0));
+
+ const unsigned int hash = value_hash (val, width, 0);
+ const struct value_node *valn = lookup_value (&vn->valmap, val, hash, width);
+
+ double bin = 1.0;
+
+ const double df = iap->df_prod[v] / dfp;
+
+ /* Translate the subscript into an index for the individual variable */
+ const int index = ((subscript - base_index) % iap->df_prod[v] ) / dfp;
+ dfp = iap->df_prod [v];
+
+ if (effects_coding && valn->index == df )
+ bin = -1.0;
+ else if ( valn->index != index )
+ bin = 0;
+
+ result *= bin;
+ }
+
+ return result;
+}
+
+
+/* Returns unity if the value in case C at SUBSCRIPT is equal to the category
+ for that subscript */
+double
+categoricals_get_dummy_code_for_case (const struct categoricals *cat, int subscript,
+ const struct ccase *c)
+{
+ return categoricals_get_code_for_case (cat, subscript, c, false);
+}
+
+/* Returns unity if the value in case C at SUBSCRIPT is equal to the category
+ for that subscript.
+ Else if it is the last category, return -1.
+ Otherwise return 0.
+ */
+double
+categoricals_get_effects_code_for_case (const struct categoricals *cat, int subscript,
+ const struct ccase *c)
+{
+ return categoricals_get_code_for_case (cat, subscript, c, true);