You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Cox Model from formula doesn't grab the correct environment #9037
Constructing a proportional hazard model from a formula with smf.phreg (aka PHReg.from_formula) doesn't use the proper environment.
Specifically, PHReg overrides the from_formula class method but doesn't adjust or set the eval_env keyword. It calls Model.from_formula to parse the formula, but Model.from_formula doesn't know that it was called indirectly and therefore underestimates its depth by one. In the default case, Model.from_formula pulls the environment from where it was called, but this is hazard_regression.py rather than the user's environment (where PHReg.from_formula was called). User-defined symbols aren't found, though internal ones like np are available.
This problem should also show up for all the other subclass implementations of from_formulas (e.g., GEE, QIF, OrderedModel).
Activity
BUG: Correct eval depth for formulas using super()
BUG: Correct eval depth for formulas using super()