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
besides the open issues that we have on dtype checking (for example with object arrays) there are other problems that we could either explicitly check for, or we add helper functions or methods that do the basic sanity checks of the data for the user.
FAQ: Why does my model not work?
Answer: run model.sanity_check
(we also have an issue for statistical "sanity" check, i.e. run a battery of diagnostics on the model or results.)
rank, condition number, vif, badly scaled (mean, variance) (e.g. should catch integer representation of datetime) (*)
restriction imposed by model, e.g. no constant (unless it's already checked somewhere else)
check of endog: not clear yet. domain violation should raise or warn earlier ?
checking other arrays in some models ?
checks like the following should be caught automatically and raise or warn earlier:
isfinite, but should be added as missing=raise as new default
dtypes if dataframe was used
returns a instance of a simple class, attaches results as attributes and has informative __str__.
This could also add some basic description of the model, i.e. nobs, k_vars, name of model, ...
should be extendable, and maybe add a what='all' keyword if there are expensive things and users just want something light or something specific. (add note in docstring)
(*) threshold for adding a warning statement will be very rough: bad scaling causes problems in Poisson very quickly but not in OLS
we should have a statistic for how many observations we have at each level or category. If we have only a few observations, then the results will noisy.
For checking individual columns of exog, we need to detect which are categorical or have finite support (ok with formula, but need uniques or find mass points to see whether we have general dummies or contrast variables. maybe check (exog == exog.min()).sum(0) to see if there is a mass point, I guess we shouldn't use something like np.unique on likely continuous variables.)
For full sets of categorical variables and interactions (e.g. in a saturated model for the subset of categorical variables) we or users would need a full pivot table, contingency table or similar. I'm not sure we need it for a given exog in addition to the individual column check.
Activity
kshedden commentedon Aug 19, 2014
I have been wanting something like this. There are a number of useful sanity checks for the models I have been working on.
josef-pkt commentedon Jan 11, 2016
I'm thinking about this again.
to get started:
checks of exog like
checks like the following should be caught automatically and raise or warn earlier:
returns a instance of a simple class, attaches results as attributes and has informative
__str__.This could also add some basic description of the model, i.e. nobs, k_vars, name of model, ...
should be extendable, and maybe add a
what='all'keyword if there are expensive things and users just want something light or something specific. (add note in docstring)(*) threshold for adding a warning statement will be very rough: bad scaling causes problems in Poisson very quickly but not in OLS
josef-pkt commentedon Feb 18, 2016
bump a bit to get at least started
http://stackoverflow.com/questions/35490803/logistic-regression-does-not-converge
it would be much easier to point to a method that users can use to do some basic checks on the data. Collinearity checks are in one of my PRs.
josef-pkt commentedon Nov 10, 2016
specific to categorical data:
we should have a statistic for how many observations we have at each level or category. If we have only a few observations, then the results will noisy.
For checking individual columns of exog, we need to detect which are categorical or have finite support (ok with formula, but need uniques or find mass points to see whether we have general dummies or contrast variables. maybe check
(exog == exog.min()).sum(0)to see if there is a mass point, I guess we shouldn't use something like np.unique on likely continuous variables.)For full sets of categorical variables and interactions (e.g. in a saturated model for the subset of categorical variables) we or users would need a full pivot table, contingency table or similar. I'm not sure we need it for a given exog in addition to the individual column check.
josef-pkt commentedon Feb 4, 2020
a list of checks and performance measures for models in R
https://github.com/easystats/performance#comprehensive-model-check
they,
easystats, have several interface packages to make using R models easier