Error while running statsmodels in colab "estimate_tweedie_power() missing 1 required positional argument: 'mu'"

749 Views Asked by At

Modeling Tweedie distribution in statsmodels in Google Colab, but I'm getting an error while trying to use estimate_tweedie_power function. Here is the code from my notebook.

#Training model
tweedie_model = sm.GLM(y_train, X_train, exposure = df_train.exposure, family=sm.families.Tweedie(link=None,var_power=1.5,eql=True))
tweedie_result = tweedie_model.fit()

#Using the initial model output to decide the optimum index parameter "p"
GLM.estimate_tweedie_power(training_result, method='brentq', low=1.01, high=5.0)

Here is my error while running estimate_tweedie_power function.

estimate_tweedie_power() missing 1 required positional argument: 'mu'

1

There are 1 best solutions below

0
sushant.more On

You might want to use something like:

tweedie_model.estimate_tweedie_power(tweedie_result.mu, method='brentq', low=1.01, high=5.0)

Reference: https://www.statsmodels.org/stable/_modules/statsmodels/genmod/generalized_linear_model.html#GLM.estimate_tweedie_power