Skip to content

Commit

Permalink
Merge 35d8ffa into 9ce1605
Browse files Browse the repository at this point in the history
  • Loading branch information
josef-pkt committed Sep 2, 2014
2 parents 9ce1605 + 35d8ffa commit 1c7bd85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions statsmodels/base/model.py
Expand Up @@ -206,7 +206,7 @@ def hessian(self, params):

def fit(self, start_params=None, method='newton', maxiter=100,
full_output=True, disp=True, fargs=(), callback=None,
retall=False, **kwargs):
retall=False, skip_hessian=False, **kwargs):
"""
Fit method for likelihood based models
Expand Down Expand Up @@ -250,6 +250,11 @@ def fit(self, start_params=None, method='newton', maxiter=100,
retall : bool, optional
Set to True to return list of solutions at each iteration.
Available in Results object's mle_retvals attribute.
skip_hessian : bool, optional
If False (default), then the negative inverse hessian is calculated
after the optimization. If True, then the hessian will not be
calculated. However, it will be available in methods that use the
hessian in the optimization (currently only with `"newton"`).
Notes
-----
Expand Down Expand Up @@ -398,7 +403,7 @@ def fit(self, start_params=None, method='newton', maxiter=100,
Hinv = cov_params_func(self, xopt, retvals)
elif method == 'newton' and full_output:
Hinv = np.linalg.inv(-retvals['Hessian']) / nobs
else:
elif not skip_hessian:
try:
Hinv = np.linalg.inv(-1 * self.hessian(xopt))
except:
Expand Down
4 changes: 2 additions & 2 deletions statsmodels/genmod/generalized_estimating_equations.py
Expand Up @@ -318,8 +318,8 @@ def unpack_cov(self, bcov):
indicator for convergence of the optimization.
True if the norm of the score is smaller than a threshold
cov_type : string
string indicating whether a "robust", "naive" or "bias_
reduced" covariance is used as default
string indicating whether a "robust", "naive" or "bias_reduced"
covariance is used as default
fit_history : dict
Contains information about the iterations.
fittedvalues : array
Expand Down

0 comments on commit 1c7bd85

Please sign in to comment.