R 平方和调整后的 R 平方与一个预测变量
R squared and adjusted R squared with one predictor
使用以下方法在 MATLAB 中估计决定系数:
load hospital
y = hospital.BloodPressure(:,1);
X = double(hospital(:,2:5));
X2 = X(:,3);
mdl = fitlm(X2,y);
Estimated Coefficients:
Estimate SE tStat pValue
________ ________ ______ __________
(Intercept) 116.72 3.9389 29.633 1.0298e-50
x1 0.039357 0.025208 1.5613 0.12168
Number of observations: 100, Error degrees of freedom: 98
Root Mean Squared Error: 6.66
R-squared: 0.0243, Adjusted R-Squared 0.0143
F-statistic vs. constant model: 2.44, p-value = 0.122
如果我只在线性模型中使用一个预测变量,为什么 R2 和 adjusted-R2 值相同。如果模型中只有一个预测变量,这些应该可以互换。我在这里错过了什么?
维基百科为adjusted-R2给出了两个定义:
和
我猜你断言 R2 应该等于 adjusted-R2 是基于第一个等式因为当 p 为 1 时,第二项的分子为 0。现在我找不到这方面的参考(令人失望的是,维基文章的这一部分没有引用)但我相当有信心第一个方程实际上是一个近似值。
第二个等式,除了符号外,它还与 Introduction to Statistical Learning, will differ from R2 because dfe is n - p - 1 whereas dft is just n - 1 and thus there is a difference of 1 when p equals 1 (i.e. only one explanatory variable) but the difference should be pretty small. Here is a random example 第 212 页上的等式 6.4 相匹配,它具有 table 的 R2 和 adjusted-R2 即使变量数为 1 也显示差异。
不过你们的差距还是挺大的。我建议你看看你的残差平方和和总平方和,看看你是否可以计算你自己的 R2 和 adjusted-R2 值并查看它们是否匹配。
使用以下方法在 MATLAB 中估计决定系数:
load hospital
y = hospital.BloodPressure(:,1);
X = double(hospital(:,2:5));
X2 = X(:,3);
mdl = fitlm(X2,y);
Estimated Coefficients:
Estimate SE tStat pValue
________ ________ ______ __________
(Intercept) 116.72 3.9389 29.633 1.0298e-50
x1 0.039357 0.025208 1.5613 0.12168
Number of observations: 100, Error degrees of freedom: 98
Root Mean Squared Error: 6.66
R-squared: 0.0243, Adjusted R-Squared 0.0143
F-statistic vs. constant model: 2.44, p-value = 0.122
如果我只在线性模型中使用一个预测变量,为什么 R2 和 adjusted-R2 值相同。如果模型中只有一个预测变量,这些应该可以互换。我在这里错过了什么?
维基百科为adjusted-R2给出了两个定义:
和
我猜你断言 R2 应该等于 adjusted-R2 是基于第一个等式因为当 p 为 1 时,第二项的分子为 0。现在我找不到这方面的参考(令人失望的是,维基文章的这一部分没有引用)但我相当有信心第一个方程实际上是一个近似值。
第二个等式,除了符号外,它还与 Introduction to Statistical Learning, will differ from R2 because dfe is n - p - 1 whereas dft is just n - 1 and thus there is a difference of 1 when p equals 1 (i.e. only one explanatory variable) but the difference should be pretty small. Here is a random example 第 212 页上的等式 6.4 相匹配,它具有 table 的 R2 和 adjusted-R2 即使变量数为 1 也显示差异。
不过你们的差距还是挺大的。我建议你看看你的残差平方和和总平方和,看看你是否可以计算你自己的 R2 和 adjusted-R2 值并查看它们是否匹配。