+categoricals_get_code_for_case (const struct categoricals *cat, int subscript,
+ const struct ccase *c)
+{
+ 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
+ the Nth Category of the IACTth interaction */
+const struct ccase *
+categoricals_get_case_by_category_real (const struct categoricals *cat, int iact, int n)
+{
+ const struct interaction_value *vn;
+
+ const struct interact_params *vp = &cat->iap[iact];
+
+ if ( n >= hmap_count (&vp->ivmap))
+ return NULL;
+
+ vn = vp->reverse_interaction_value_map [n];
+
+ return vn->ccase;
+}
+
+/* Return a the user data corresponding to the Nth Category of the IACTth interaction. */
+void *
+categoricals_get_user_data_by_category_real (const struct categoricals *cat, int iact, int n)