Python-广义线性模型系数

时间:2018-06-28 15:08:31

标签: python regression spline coefficients

我正在比较Python中的不同回归模型(线性,多项式和样条曲线),以获得对数对数curve的斜率系数,并在以后插入新曲线。

我在这里使用最后一段代码(Ctrl +'Generating natural三次三次样条'):https://www.analyticsvidhya.com/blog/2018/03/introduction-regression-splines-python-codes/),我打印了对应于我的数据集的summary

我的问题:摘要中的系数是斜率的系数,还是与统计模型GML(在这种情况下为二项式回归)有关?

代码如下:

from patsy import dmatrix
import statsmodels.api as sm

# Generating natural cubic spline
transformed_x3 = dmatrix("cr(train,df = 3)", {"train": X_train}, return_type='dataframe') 
fit3 = sm.GLM(y_train, transformed_x3).fit()

# Prediction on validation set
pred3 = fit3.predict(dmatrix("cr(valid, df=3)", {"valid": X_valid}, return_type='dataframe'))

xp = np.linspace(3e+04, 5e+06, 50)
pred3 = fit3.predict(dmatrix("cr(xp, df=3)", {"xp": xp}, return_type='dataframe'))

print (fit3.summary())

预先感谢您的帮助!

0 个答案:

没有答案
相关问题