def compute(self, method='logistic'):
"""
Compute propensity score and measures of goodness-of-fit
Parameters
----------
method : str
Propensity score estimation method. Either 'logistic' or 'probit'
"""
predictors = sm.add_constant(self.covariates, prepend=False)
if method == 'logistic':
model = sm.Logit(self.treatment, predictors).fit(disp=False, warn_convergence=True)
elif method == 'probit':
model = sm.Probit(self.treatment, predictors).fit(disp=False, warn_convergence=True)
else:
raise ValueError('Unrecognized method')
return model.predict()
评论列表
文章目录