李旭分享 http://blog.sciencenet.cn/u/lixujeremy 代码与散打爱好者!

博文

Maths: The Negative Values of R2

已有 3958 次阅读 2015-3-25 11:03 |个人分类:Mathematics|系统分类:科研笔记

非常地意外,温度及降水数据(自变量)拟合NDVI(因变量)的回归模型复判定系数(Multiple Coefficient of Determination)竟然是负值,为了永远铭记这一百年不遇的发现,特此开贴记录。

Matlab中调用regress()函数完成计算。公式如下:

nDNs=b(1)+b(2)*pDNs+b(3)*tDNs

b(1)=0b(2)=9.001485523185693e-06b(3)=0.028094617649913

R2=-0.11865890F-statistics=4.9956303>F(1,27)=4.21(临界值),p=0.033880889<0.05,通过α=0.05的显著性检验。R2是负值,合理的解释One version of calculating R2 can only give positive numbers as it is effectively the square of r. On the other hand a common method of computing R2 is 1 - sum of square in model/sum of square for uncorrelated (horizontal line) - if the model is completely inappropriate it will give a worse sum of squares than a flat line.

网上一则比较全面的解释:

R2 compares the fit of the chosen model with that of a horizontal straight line (the null hypothesis). If the chosen model fits worse than a horizontal line, then R2 is negative. Note that R2 is not always the square of anything, so it can have a negative value without violating any rules of math. R2 is negative only when the chosen model does not follow the trend of the data, so fits worse than a horizontal line.

附上示例数据及代码(negativer2.rar)。

 

See Also

Important cases where the computational definition of R2 can yield negative values, depending on the definition used, arise where the predictions that are being compared to the corresponding outcomes have not been derived from a model-fitting procedure using those data, and where line arregression is conducted without including an intercept. Additionally, negative values of R2 may occur when fitting non-linear functions to data. In cases where negative values arise, the mean of the data provides a better fit to the outcomes than do the fitted function values, according to this particular criterion.

Note that it is possible to get a negative R-square for equations that do not contain a constant term. Because R-square is defined as the proportion of variance explained by the fit, if the fit is actually worse than just fitting a horizontal line then R-square is negative. In this case, R-square cannot be interpreted as the square of a correlation. Such situations indicate that a constant term should be added to the model.




https://blog.sciencenet.cn/blog-1148346-877108.html

上一篇:Matlab: 裁剪图片
下一篇:Python+ArcPy: Extract by Mask (Spatial Analyst)
收藏 IP: 202.112.90.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-16 09:19

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部