+ const struct interaction *iact = categoricals_get_interaction_by_subscript (cat, subscript);
+
+ const int i = reverse_variable_lookup_short (cat, subscript);
+
+ const int base_index = cat->iap[i].base_subscript_short;
+
+ 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
+ if ( valn->index == df )
+ bin = -1.0;
+ else
+#endif
+ if ( valn->index != index )
+ bin = 0;
+
+ result *= bin;
+ }
+
+ return result;
+}
+
+
+size_t
+categoricals_get_n_variables (const struct categoricals *cat)
+{
+ printf ("%s\n", __FUNCTION__);
+ return cat->n_vars;
+}
+
+/* Return a case containing the set of values corresponding to SUBSCRIPT */
+const struct ccase *
+categoricals_get_case_by_category (const struct categoricals *cat, int subscript)
+{
+ int vindex = reverse_variable_lookup_long (cat, subscript);
+ const struct interact_params *vp = &cat->iap[vindex];
+ const struct interaction_value *vn = vp->reverse_interaction_value_map [subscript - vp->base_subscript_long];
+
+ return vn->ccase;
+}