r squared
multiple r squared
adjusted r squared
http://web.maths.unsw.edu.au/~adelle/Garvan/Assays/GoodnessOfFit.html
Goodness-of-Fit Statistics
Sum of Squares Due to Error
This statistic measures the total deviation of the response values from the fit to the response values. It is also called the summed square of residuals and is usually labelled as SSE.
- SSE = Sum
(i=1 to n)
- {
wi
- (
yi - fi
- )
2
- }
Here yi is the observed data value and fi is the predicted value from the fit. wi is the weighting applied to each data point, usually wi = 1.
A value closer to 0 indicates that the model has a smaller random error component, and that the fit will be more useful for prediction.
R-Square
This statistic measures how successful the fit is in explaining the variation of the data. Put another way, R-square is the square of the correlation between the response values and the predicted response values. It is also called the square of the multiple correlation coefficient and the coefficient of multiple determination.
R-square is defined as
- R-square = 1 - [Sum
(i=1 to n)
- {
wi
- (
yi - fi
- )
2
- }] /[Sum
(i=1 to n)
- {
wi
- (
yi - yav
- )
2
- }] = 1 - SSE/SST
Here fi is the predicted value from the fit, yav is the mean of the observed data yi is the observed data value. wi is the weighting applied to each data point, usually wi=1. SSE is the sum of squares due to error and SST is the total sum of squares.
R-square can take on any value between 0 and 1, with a value closer to 1 indicating that a greater proportion of variance is accounted for by the model. For example, an R-square value of 0.8234 means that the fit explains 82.34% of the total variation in the data about the average.
If you increase the number of fitted coefficients in your model, R-square will increase although the fit may not improve in a practical sense. To avoid this situation, you should use the degrees of freedom adjusted R-square statistic described below.
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.
Degrees of Freedom Adjusted R-Square
This statistic uses the R-square statistic defined above, and adjusts it based on the residual degrees of freedom. The residual degrees of freedom is defined as the number of response values nminus the number of fitted coefficients m estimated from the response values.
v = n-m
v indicates the number of independent pieces of information involving the n data points that are required to calculate the sum of squares. Note that if parameters are bounded and one or more of the estimates are at their bounds, then those estimates are regarded as fixed. The degrees of freedom is increased by the number of such parameters.
The adjusted R-square statistic is generally the best indicator of the fit quality when you compare two models that are nested – that is, a series of models each of which adds additional coefficients to the previous model.
- adjusted R-square = 1 - SSE(
n
- -1)/SST(
v
- )
The adjusted R-square statistic can take on any value less than or equal to 1, with a value closer to 1 indicating a better fit. Negative values can occur when the model contains terms that do not help to predict the response.
Root Mean Squared Error
This statistic is also known as the fit standard error and the standard error of the regression. It is an estimate of the standard deviation of the random component in the data, and is defined as
- RMSE =
s
- = (MSE)
½
where MSE is the mean square error or the residual mean square
- MSE=SSE/
v
Just as with SSE, an MSE value closer to 0 indicates a fit that is more useful for prediction.
r squared的更多相关文章
- 机器学习:衡量线性回归法的指标(MSE、RMSE、MAE、R Squared)
一.MSE.RMSE.MAE 思路:测试数据集中的点,距离模型的平均距离越小,该模型越精确 # 注:使用平均距离,而不是所有测试样本的距离和,因为距离和受样本数量的影响 1)公式: MSE:均方误差 ...
- 线性函数拟合R语言示例
线性函数拟合(y=a+bx) 1. R运行实例 R语言运行代码如下:绿色为要提供的数据,黄色标识信息为需要保存的. x<-c(0.10,0.11, 0.12, 0.13, 0.14, ...
- R语言︱非结构化数据处理神器——rlist包
本文作者:任坤,厦门大学王亚南经济研究院金融硕士生,研究兴趣为计算统计和金融量化交易,pipeR,learnR,rlist等项目的作者. 近年来,非关系型数据逐渐获得了更广泛的关注和使用.下面分别列举 ...
- R语言命令汇总
> qqplot(spear,fastrankweight)> qqplot(spear,fastrankweight,main="title")> qqplot ...
- R ggplot2 线性回归
摘自 http://f.dataguru.cn/thread-278300-1-1.html library(ggplot2) x=1:10y=rnorm(10)a=data.frame(x= x, ...
- r语言与dataframe
什么是DataFrame 引用 r-tutor上的定义: DataFrame 是一个表格或者类似二维数组的结构,它的各行表示一个实例,各列表示一个变量. 没错,DataFrame就是类似于Excel表 ...
- R语言学习笔记(二十四):plyr包的用法
plyr 这个包,提供了一组规范的数据结构转换形式. Input/Output list data frame array list llply() ldply() laply() data fram ...
- a note of R software write Function
Functionals “To become significantly more reliable, code must become more transparent. In particular ...
- Advanced R之构造子集
转发请声明出处:http://www.cnblogs.com/lizichao/p/4794733.html 构造子集 R构造子集的操作功能强大而且速度快.精通构造子集者可以用简洁的方式表达复杂的操作 ...
随机推荐
- [LeetCode] Jump Game 数组控制
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- MySQL的@与@@区别
MySQL的@与@@区别 @x 是 用户自定义的变量 (User variables are written as @var_name) @@x 是 global或session变量 (@@glo ...
- 标准C程序设计七---47
Linux应用 编程深入 语言编程 标准C程序设计七---经典C11程序设计 以下内容为阅读: <标准C程序设计>(第7版) 作者 ...
- mysql 初始化脚本
脚本须知: 1. 确认mysql的数据目录,二进制日志目录,中继日志的目录,安装目录的位置 2. 初始化会对前三个目录执行清空操作,不过清空前该脚本对其进行了压缩打包统一存放在/tmp目录下 3. 脚 ...
- C#连接OleDBConnection数据库的操作
对于不同的.net数据提供者,ADO.NET采用不同的Connection对象连接数据库.这些Connection对我们屏蔽了具体的实现细节,并提供了一种统一的实现方法. Connection类有四种 ...
- vue生命周期回调方法
最近在用vue开发一个商品列表页,因需要根据请求回的字段是否有内容来显示隐藏该字段, 但因为vue异步加载导致显示隐藏方法不起作业(主要是判断条件取不到页面渲染内容),围观了vue生命周期后发现upd ...
- 2002-2003 ACM-ICPC Northeastern European Regional Contest (NEERC 02)
B Bricks 计算几何乱搞 题意: 给你个立方体,问你能不能放进一个管道里面. 题解: 这是一道非常迷的题,其问题在于,你可以不正着放下去,你需要斜着放.此时你需要枚举你旋转的角度,来判断是否可行 ...
- Maven依赖机制理解
假设一个项目需要用到日志组件Log4j,那么有如下方式添加这个组件. 一.传统方式: 1.访问官网https://logging.apache.org/log4j/2.x/download.html, ...
- c++中.dll与.lib文件的生成与使用的详解
两种库: • 包含了函数所在的DLL文件和文件中函数位置的信息(入口),代码由运行时加载在进程空间中的DLL提供,称为动态链接库dynamic link library.• 包含函数代码本身,在编译时 ...
- 以面试官的角度看strcpy函数
一:笔试或者面试的总结 之 一 (1)在笔试或者面试中常常会被问道,strcpy memmove memcpy 函数的实现.有时也会问你STL 中string的 split 和 trim的实现.有的 ...