1919from statsmodels .base .optimizer import Optimizer
2020
2121
22- _model_params_doc = """
23- Parameters
22+ _model_params_doc = """Parameters
2423 ----------
2524 endog : array_like
26- 1-d endogenous response variable. The dependent variable.
25+ A 1-d endogenous response variable. The dependent variable.
2726 exog : array_like
2827 A nobs x k array where `nobs` is the number of observations and `k`
2928 is the number of regressors. An intercept is not included by default
3433 missing : str
3534 Available options are 'none', 'drop', and 'raise'. If 'none', no nan
3635 checking is done. If 'drop', any observations with nans are dropped.
37- If 'raise', an error is raised. Default is 'none.' """
36+ If 'raise', an error is raised. Default is 'none'. """
3837_extra_param_doc = """
3938 hasconst : None or bool
4039 Indicates whether the RHS includes a user-supplied constant. If True,
4140 a constant is not checked for and k_constant is set to 1 and all
4241 result statistics are calculated as if a constant is present. If
4342 False, a constant is not checked for and k_constant is set to 0.
44- """
43+ **kwargs
44+ Extra arguments that are used to set model properties when using the
45+ formula interface."""
4546
4647
4748class Model (object ):
@@ -117,19 +118,19 @@ def from_formula(cls, formula, data, subset=None, drop_cols=None,
117118 Parameters
118119 ----------
119120 formula : str or generic Formula object
120- The formula specifying the model
121+ The formula specifying the model.
121122 data : array_like
122123 The data for the model. See Notes.
123124 subset : array_like
124125 An array-like object of booleans, integers, or index values that
125126 indicate the subset of df to use in the model. Assumes df is a
126- `pandas.DataFrame`
127+ `pandas.DataFrame`.
127128 drop_cols : array_like
128129 Columns to drop from the design matrix. Cannot be used to
129130 drop terms involving categoricals.
130- args : extra arguments
131- These are passed to the model
132- kwargs : extra keyword arguments
131+ * args
132+ Additional positional argument that are passed to the model.
133+ ** kwargs
133134 These are passed to the model with one exception. The
134135 ``eval_env`` keyword is passed to patsy. It can be either a
135136 :class:`patsy:patsy.EvalEnvironment` object or an integer
@@ -139,7 +140,8 @@ def from_formula(cls, formula, data, subset=None, drop_cols=None,
139140
140141 Returns
141142 -------
142- model : Model instance
143+ model
144+ The model instance.
143145
144146 Notes
145147 -----
@@ -198,12 +200,16 @@ def from_formula(cls, formula, data, subset=None, drop_cols=None,
198200
199201 @property
200202 def endog_names (self ):
201- """Names of endogenous variables"""
203+ """
204+ Names of endogenous variables.
205+ """
202206 return self .data .ynames
203207
204208 @property
205209 def exog_names (self ):
206- """Names of exogenous variables"""
210+ """
211+ Names of exogenous variables.
212+ """
207213 return self .data .xnames
208214
209215 def fit (self ):
@@ -232,9 +238,11 @@ def __init__(self, endog, exog=None, **kwargs):
232238
233239 def initialize (self ):
234240 """
235- Initialize (possibly re-initialize) a Model instance. For
236- instance, the design matrix of a linear model may change
237- and some things must be recomputed.
241+ Initialize (possibly re-initialize) a Model instance.
242+
243+ For example, if the the design matrix of a linear model changes then
244+ initialized can be used to recompute values using the modified design
245+ matrix.
238246 """
239247 pass
240248
@@ -252,20 +260,45 @@ def score(self, params):
252260 Score vector of model.
253261
254262 The gradient of logL with respect to each parameter.
263+
264+ Parameters
265+ ----------
266+ params : ndarray
267+ The parameters to use when evaluating the Hessian.
268+
269+ Returns
270+ -------
271+ ndarray
272+ The score vector evaluated at the parameters.
255273 """
256274 raise NotImplementedError
257275
258276 def information (self , params ):
259277 """
260- Fisher information matrix of model
278+ Fisher information matrix of model.
261279
262- Returns -Hessian of loglike evaluated at params.
280+ Returns -1 * Hessian of the log-loglikelihood evaluated at params.
281+
282+ Parameters
283+ ----------
284+ params : ndarray
285+ The model parameters.
263286 """
264287 raise NotImplementedError
265288
266289 def hessian (self , params ):
267290 """
268- The Hessian matrix of the model
291+ The Hessian matrix of the model.
292+
293+ Parameters
294+ ----------
295+ params : ndarray
296+ The parameters to use when evaluating the Hessian.
297+
298+ Returns
299+ -------
300+ ndarray
301+ The hessian evaluated at the parameters.
269302 """
270303 raise NotImplementedError
271304
0 commit comments