// the .intersection preserves order, important!
self.regressors = {name: list(df.columns.intersection(cols)) for name, cols in sorted(regressors.items())}
else:
self.regressors = {name: df.columns.tolist() for name in sorted(self._fitted_parameter_names)}
assert all(
len(cols) > 0 for cols in self.regressors.values()
), "All parameters must have at least one column associated with it. Did you mean to include a constant column?"
After Change
df = self._filter_dataframe_to_covariates(df).astype(float)
self.regressors, Xs = self._create_design_matrices(regressors)
_index = pd.MultiIndex.from_tuples(
sum(([(name, col) for col in columns] for name, columns in self.regressors.items()), [])