1
我使用版本0.7.3中的pandas.ols
函數。當使用簡單迴歸與窗口迴歸時,我似乎得到調整後的$ R^2 $的值不一致。舉例來說,如果realizedData
和pastData
有600項,然後熊貓OLS中的R^2調整值不一致OLS
model = pandas.ols(y = realizedData, x = pastData, intercept = 0, window = 600)
產生以下的輸出: -
-------------------------Summary of Regression Analysis-------------------------
Formula: Y ~ <1> + <10> + <90000>
Number of Observations: 596
Number of Degrees of Freedom: 3
R-squared: 0.6914
Adj R-squared: 0.6904
Rmse: 699.4880
F-stat (3, 593): 664.3691, p-value: 0.0000
Degrees of Freedom: model 2, resid 593
-----------------------Summary of Estimated Coefficients------------------------
Variable Coef Std Err t-stat p-value CI 2.5% CI 97.5%
--------------------------------------------------------------------------------
1 0.4171 0.0428 9.75 0.0000 0.3333 0.5010
10 0.4362 0.0688 6.34 0.0000 0.3014 0.5709
90000 0.0623 0.0319 1.95 0.0517 -0.0003 0.1249
---------------------------------End of Summary---------------------------------
,而只是用
model = pandas.ols(y = realizedData, x = pastData, intercept = 0)
給出: -
-------------------------Summary of Regression Analysis-------------------------
Formula: Y ~ <1> + <10> + <90000>
Number of Observations: 596
Number of Degrees of Freedom: 3
R-squared: 0.6914
Adj R-squared: 0.3053
Rmse: 699.4880
F-stat (3, 593): 1.7909, p-value: 0.1477
Degrees of Freedom: model 2, resid 593
-----------------------Summary of Estimated Coefficients------------------------
Variable Coef Std Err t-stat p-value CI 2.5% CI 97.5%
--------------------------------------------------------------------------------
1 0.4171 0.0428 9.75 0.0000 0.3333 0.5010
10 0.4362 0.0688 6.34 0.0000 0.3014 0.5709
90000 0.0623 0.0319 1.95 0.0517 -0.0003 0.1249
---------------------------------End of Summary---------------------------------
請注意,除了所調整的$ R^2 $值之外,輸出是相同的。
這是一個錯誤還是我做錯了什麼?