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

      (

y- 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的更多相关文章

  1. 机器学习:衡量线性回归法的指标(MSE、RMSE、MAE、R Squared)

    一.MSE.RMSE.MAE 思路:测试数据集中的点,距离模型的平均距离越小,该模型越精确 # 注:使用平均距离,而不是所有测试样本的距离和,因为距离和受样本数量的影响 1)公式: MSE:均方误差 ...

  2. 线性函数拟合R语言示例

    线性函数拟合(y=a+bx) 1.       R运行实例 R语言运行代码如下:绿色为要提供的数据,黄色标识信息为需要保存的. x<-c(0.10,0.11, 0.12, 0.13, 0.14, ...

  3. R语言︱非结构化数据处理神器——rlist包

    本文作者:任坤,厦门大学王亚南经济研究院金融硕士生,研究兴趣为计算统计和金融量化交易,pipeR,learnR,rlist等项目的作者. 近年来,非关系型数据逐渐获得了更广泛的关注和使用.下面分别列举 ...

  4. R语言命令汇总

    > qqplot(spear,fastrankweight)> qqplot(spear,fastrankweight,main="title")> qqplot ...

  5. R ggplot2 线性回归

    摘自  http://f.dataguru.cn/thread-278300-1-1.html library(ggplot2) x=1:10y=rnorm(10)a=data.frame(x= x, ...

  6. r语言与dataframe

    什么是DataFrame 引用 r-tutor上的定义: DataFrame 是一个表格或者类似二维数组的结构,它的各行表示一个实例,各列表示一个变量. 没错,DataFrame就是类似于Excel表 ...

  7. R语言学习笔记(二十四):plyr包的用法

    plyr 这个包,提供了一组规范的数据结构转换形式. Input/Output list data frame array list llply() ldply() laply() data fram ...

  8. a note of R software write Function

    Functionals “To become significantly more reliable, code must become more transparent. In particular ...

  9. Advanced R之构造子集

    转发请声明出处:http://www.cnblogs.com/lizichao/p/4794733.html 构造子集 R构造子集的操作功能强大而且速度快.精通构造子集者可以用简洁的方式表达复杂的操作 ...

随机推荐

  1. 学习javascript设计模式之发布-订阅(观察者)模式

    1.发布-订阅模式又叫观察者模式,它定义对象之间一种一对多的依赖关系. 2.如何实现发布-订阅模式 2-1.首先指定好发布者 2-2.给发布者添加一个缓冲列表,用户存放回调函数以便通知订阅者 2-3. ...

  2. es6总结(二)--正则表达式和字符串

  3. linux信号-------初涉

    一.信号的本质 软中断信号(signal,又简称为信号)用来通知进程发生了异步事件.在软件层次上是对中断机制的一种模拟,在原理上,一个进程收到一个信号与处理器收到一个中断请求可以说是一样的.信号是进程 ...

  4. cin和scanf的速度差别

    好长时间没有遇到这种问题了,以前虽然知道scanf比cin快,但是没想到快这么多,见图. 50万的数据. scanf输入: cin输入: 网上说用std::ios::sync_with_stdio(f ...

  5. python 中各种数据类型的排序问题

    list #按照list的第二键值排序 disP2P = [[1,2,3],[2,3,4],[4,5,6]] disP2P = sorted(disP2P,key = lambda x:x[2]) s ...

  6. http错误种类及原因

    http://blog.csdn.net/dxykevin/article/details/50950878 [摘要]HTTP状态码(HTTP Status Code)是用以表示网页服务器HTTP响应 ...

  7. 一维数组解最长上升公共子序列(LCIS)

    #include<bits/stdc++.h> using namespace std; + ; int n,a[maxn],b[maxn],dp[maxn]; int main() { ...

  8. sudo apt-get upgrade 不成功遇到问题

    一. sudo apt-get update 和 sudo apt-get upgrade 出错:(Ubuntu更新过程被中断后的问题) Ubuntu的更新过程是先下载完源里的文件就开始执行升级,如果 ...

  9. luogu U10783 名字被和谐了

    链接 https://www.luogu.org/problem/show?pid=U10783 题目背景 众所周知,我们称g是a的约数,当且仅当g是正数且a mod g = 0. 众所周知,若g既是 ...

  10. Spring Boot中实现异步调用之@Async

    一.什么是异步调用 “异步调用”对应的是“同步调用”,同步调用指程序按照定义顺序依次执行,每一行程序都必须等待上一行程序执行完成之后才能执行:异步调用指程序在顺序执行时,不等待异步调用 的语句返回结果 ...