def setup_class(cls): expected_params = [1, 0.5, 0.5] np.random.seed(1234) nobs = 200 exog = np.ones((nobs, 2)) exog[:nobs//2, 1] = 2 mu_true = exog.dot(expected_params[:-1]) cls.endog = sm.distributions.zigenpoisson.rvs(mu_true, expected_params[-1], 2, 0.5, size=mu_true.shape) model = sm.ZeroInflatedGeneralizedPoisson(cls.endog, exog, p=2) cls.res = model.fit(method='bfgs', maxiter=5000, maxfun=5000, disp=0)
def setup_class(cls): data = sm.datasets.randhie.load(as_pandas=False) cls.endog = data.endog exog = sm.add_constant(data.exog[:,1:4], prepend=False) exog_infl = sm.add_constant(data.exog[:,0], prepend=False) cls.res1 = sm.ZeroInflatedGeneralizedPoisson(data.endog, exog, exog_infl=exog_infl, p=1).fit(method='newton', maxiter=500, disp=0) # for llnull test cls.res1._results._attach_nullmodel = True cls.init_keys = ['exog_infl', 'exposure', 'inflation', 'offset', 'p'] cls.init_kwds = {'inflation': 'logit', 'p': 1} res2 = RandHIE.zero_inflated_generalized_poisson cls.res2 = res2