我想在Python中运行创建一个虚拟变量回归。因此,我有一个2000到2020年的比率列表,我想从以下模型中估计非危机(NC)和危机(C)期间的α和β,其中包含关于α和风险因子系数的虚拟变量:
其中,Dnc,t是虚拟变量,对于非危机时期,t取值为1,否则为0;Dc,t是虚拟变量,其值为1,否则为0。现在,我想在python中运行这个回归。
发布于 2021-04-09 00:58:49
假设您正在寻找Logistic回归,并且在Pandas数据帧中已经有了X和Y变量
from sklearn.linear_model import LogisticRegression
X, y = Your_Predictor_Variables, Your_Target_Variable
clf = LogisticRegression(random_state=0).fit(X, y)
print(clf.coef_, clf.intercept_)
https://stackoverflow.com/questions/67008417
复制相似问题