Measure of fit
Summary
Setup
- Given an OLS trendline with intercept
y=b1+b2xy=b1+b2x
- where b1,b2b1,b2 are determined by the OLS formula and ei,ˆyiei,^yi are the OLS residuals and the OLS fitted values
TSS, ESS, RSS
- Total sum of squares (TSS)
TSS=n∑i=1(yi−ˉy)2TSS=n∑i=1(yi−¯y)2
- Explained sum of squares (ESS)
ESS=n∑i=1(ˆyi−ˉy)2ESS=n∑i=1(^yi−¯y)2
- Residual sum of squares ( RSS ) (as before)
RSS=n∑i=1e2iRSS=n∑i=1e2i
- Note:
- Sample variance in yy -data is equal to TSS/(n−1)TSS/(n−1)
- Sample variance in ˆy^y -data is equal to ESS/(n−1)ESS/(n−1)
- Sample variance in ee -data is equal to RSS/(n−1)RSS/(n−1)
Coefficient of determination
- Result: TSS=ESS+RSSTSS=ESS+RSS
- Coefficient of determination
R2=ESSTSS=1−RSSTSSR2=ESSTSS=1−RSSTSS
- Result: 0≤R2≤10≤R2≤1