本文整理汇总了Python中statsmodels.api.Logit方法的典型用法代码示例。如果您正苦于以下问题:Python api.Logit方法的具体用法?Python api.Logit怎么用?Python api.Logit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块statsmodels.api的用法示例。
在下文中一共展示了api.Logit方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: compute
点赞 6
# 需要导入模块: from statsmodels import api [as 别名]
# 或者: from statsmodels.api import Logit [as 别名]
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()
开发者ID:kellieotto,项目名称:pscore_match,代码行数:19,
示例2: Nagelkerke_Rsquare
点赞 6
# 需要导入模块: from statsmodels import api [as 别名]
# 或者: from statsmodels.api import Logit [as 别名]
def Nagelkerke_Rsquare(self,columns):
cols=columns.copy()
cols.append('intercept')
log_clf=sm.Logit(self.data[self.target],self.data[cols])
N=self.data.shape[0]
# result=log_clf.fit(disp=0,method='powell')
try:
result=log_clf.fit(disp=0)
except:
result=log_clf.fit(disp=0,method='powell')
llf=result.llf
llnull=result.llnull
lm=np.exp(llf)
lnull=np.exp(llnull)
naglkerke_rsquare=(1-(lnull/lm)**(2/N))/(1-lnull**(2/N))
return naglkerke_rsquare
开发者ID:dominance-analysis,项目名称:dominance-analysis,代码行数:18,
示例3: Cox_and_Snell_Rsquare
点赞 6
# 需要导入模块: from statsmodels import api [as 别名]
# 或者: from statsmodels.api import Logit [as 别名]
def Cox_and_Snell_Rsquare(self,columns):
cols=columns.copy()
cols.append('intercept')
log_clf=sm.Logit(self.data[self.target],self.data[cols])
N=self.data.shape[0]
# result=log_clf.fit(disp=0,method='powell')
try:
result=log_clf.fit(disp=0)