-
Notifications
You must be signed in to change notification settings - Fork 34
Description
The current approach of wrapping fitted StatisticalModel
objects within DataFrameStatisticalModel
/DataTableStatisticalModel
objects has a major limitation: we can only @delegate
functions that we know about, i.e. only those defined in StatsBase. This sounds problematic in the long term, where custom model types defined in packages may want to support new operations.
A solution to this would be to move from the current composition approach (wrapper) to inheritance. StatisticalModel
object would be required to have some predefined fields, like coefnames
, formula
, modelmatrix
and modelframe
. The fit
method from StatsModels would set these fields after fitting the model, so that they can be accessed later both by generic methods and by custom methods defined for a given model type.
This solution would for example allow implementing a generic Wald test function in StatsBase (JuliaStats/StatsBase.jl#300), which would use the coefficient names stored in the object. This is not possible with the current DataFrameStatisticalModel
approach, where coefficient names can only be accessed by methods designed for DataFrameStatisticalModel
, which therefore cannot live in StatsBase.