在pandas OLS中调整的R ^ 2值不一致

时间:2012-06-27 19:21:52

标签: python pandas

我正在使用版本0.7.3中的pandas.ols函数。当使用简单回归与窗口回归时,我似乎得到了调整后的$ R ^ 2 $的不一致值。例如,如果realizedDatapastData有600个条目,那么

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 $值外,输出相同。

这是一个错误还是我做错了什么?

1 个答案:

答案 0 :(得分:1)

我认为这与缺乏拦截有关。你能否在GitHub上报告一个问题?