Tools¶
Our tool collection contains some convenience functions for users and functions that were written mainly for internal use.
Additional to this tools directory, several other subpackages have their own
tools modules, for example statsmodels.tsa.tsatools
Module Reference¶
Basic tools tools
¶
These are basic and miscellaneous tools. The full import path is statsmodels.tools.tools.
|
Adds a column of ones to an array |
The next group are mostly helper functions that are not separately tested or insufficiently tested.
|
Returns a dummy matrix given an array of categorical variables. |
|
Erase columns of zeros: can save some time in pseudoinverse. |
|
Return a matrix whose column span is the same as X. |
|
True if (Q, P) contrast C is estimable for (N, P) design D |
|
Return the reciprocal of an array, setting all entries less than or equal to 0 to 0. |
Return the reciprocal of an array, setting all entries equal to 0 as 0. |
|
|
Unsqueeze a collapsed array |
Numerical Differentiation¶
|
Gradient of function, or Jacobian if function f returns 1d array |
|
Calculate gradient or Jacobian with complex step derivative approximation |
|
Calculate Hessian with finite difference derivative approximation |
|
Calculate Hessian with finite difference derivative approximation |
|
Calculate Hessian with finite difference derivative approximation |
|
Calculate Hessian with complex-step derivative approximation |
Measure for fit performance eval_measures
¶
The first group of function in this module are standalone versions of information criteria, aic bic and hqic. The function with _sigma suffix take the error sum of squares as argument, those without, take the value of the log-likelihood, llf, as argument.
The second group of function are measures of fit or prediction performance, which are mostly one liners to be used as helper functions. All of those calculate a performance or distance statistic for the difference between two arrays. For example in the case of Monte Carlo or cross-validation, the first array would be the estimation results for the different replications or draws, while the second array would be the true or observed values.
|
Akaike information criterion |
|
Akaike information criterion |
|
Akaike information criterion (AIC) with small sample correction |
|
Akaike information criterion (AIC) with small sample correction |
|
Bayesian information criterion (BIC) or Schwarz criterion |
|
Bayesian information criterion (BIC) or Schwarz criterion |
|
Hannan-Quinn information criterion (HQC) |
|
Hannan-Quinn information criterion (HQC) |
|
bias, mean error |
|
interquartile range of error |
|
maximum absolute error |
|
mean absolute error |
|
median absolute error |
|
median bias, median error |
|
mean squared error |
|
root mean squared error |
|
standard deviation of error |
|
variance of error |