Fitting GLM with a pre-assigned starting parameter #1602

Closed
yizhong opened this Issue Apr 18, 2014 · 1 comment

Projects

None yet

2 participants

@yizhong
yizhong commented Apr 18, 2014

Hi,

I am using generalized linear model in statsmodels to fit biological data, which follows the Gamma distribution.

My question is can we make glm to allow a pre-assigned starting coefficient?
I know the starting point is calculated by "family.starting_mu()": (y+y.mean())/2,
Could it be useful to have a small change at line 386 in generalized_linear_model.py
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/genmod/generalized_linear_model.py#L386
like this:

if starting_coefficient is Null:
mu = self.family.starting_mu(self.endog)
else:
mu = np.dot(exog, starting_coefficient)

I saw the similar question raised before:
#443 (comment)
But I didn't get the point.

The reason for having this, is sometimes we do glm in a loop, the starting coefficient for the current iteration is taking from the previous fitting, namely res_previous.params.
This renders more power to GLM.

Many thanks,

Yi

@jseabold
Member

Closing as a duplicate of #443. We don't yet take start_params for GLM, but it should be pretty simple to fix. Feel free to submit a PR, or maybe I can have a look at it since it really shouldn't be much work.

@jseabold jseabold closed this Apr 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment