[英]Adding a constant in Multiple Linear Regression using statsmodels
如何向我的 statsmodels 回歸添加常量。
截至目前,模型是這樣的:
model = sm.OLS(y,x).fit()
來自OLS
的文檔:
exog :一個 nobs xk 數組,其中 nobs 是觀察的數量,k 是回歸量的數量。 默認情況下不包含攔截,應由用戶添加。 請參見 statsmodels.tools.add_constant。
X = sm.add_constant(x)
sm.OLS(y,X)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.