for col, i in pred_df.design_info.column_name_indexes.items():
pred_data = pred_df.iloc[:, i]
lev_data = grpr_df.multiply(pred_data, axis=0)
// Also rename intercepts and skip if already added.
// This can happen if user specifies something like
// random=["1|school", "student|school"].
if col == "Intercept":
if grpr in self.terms:
continue
label = "1|%s" % grpr
else:
label = col + "|" + grpr
prior = priors.pop(label, priors.get("random", None))
// Categorical or continuous is determined from data
ld = lev_data.values
if ((ld == 0) | (ld == 1)).all():
lev_data = lev_data.astype(int)
cat = True
else:
cat = False
pred_data = pred_data[:, None] // Must be 2D later
term = RandomTerm(self, label, lev_data, pred_data,
grpr_df.values, categorical=cat)
self.terms[label] = term
self.built = False
def _add_y(self, variable, prior=None, family="gaussian", link=None, *args,