In this post we will move toward the statistical measure for a good fit.

### R-Squared

- A good fit will have
- SSE (Minimum or Maximum?)
- SSR (Minimum or Maximum?)
- And we know SST= SSE + SSR
- SSE/SST(Minimum or Maximum?)
- SSR/SST(Minimum or Maximum?)

- The
*coefficient of determination*is the portion of the total variation in the dependent variable that is explained by variation in the independent variable - The coefficient of determination is also called
*R-squared*and is denoted as R2

R^2=SSR/SST

where 0<= R2<=1

### Practice : R- Square

(We are continuing with the python session from posts 204.1.1 – 204.1.4; we have already built models required for this practice session)

- What is the R-square value of Passengers vs Promotion_Budget model?
- What is the R-square value of Passengers vs Inter_metro_flight_ratio?

In [19]:

```
#What is the R-square value of Passengers vs Promotion_Budget model?
fitted1.summary()
```

Out[19]:

In [20]:

```
#What is the R-square value of Passengers vs Inter_metro_flight_ratio
fitted2.summary()
```

Out[20]:

Dep. Variable: | Passengers | R-squared: | 0.242 |
---|---|---|---|

Model: | OLS | Adj. R-squared: | 0.232 |

Method: | Least Squares | F-statistic: | 24.90 |

Date: | Wed, 27 Jul 2016 | Prob (F-statistic): | 3.58e-06 |

Time: | 11:48:27 | Log-Likelihood: | -848.30 |

No. Observations: | 80 | AIC: | 1701. |

Df Residuals: | 78 | BIC: | 1705. |

Df Model: | 1 | ||

Covariance Type: | nonrobust |

coef | std err | t | P>|t| | [95.0% Conf. Int.] | |
---|---|---|---|---|---|

Intercept | 2.044e+04 | 4993.747 | 4.093 | 0.000 | 1.05e+04 3.04e+04 |

Inter_metro_flight_ratio | 3.507e+04 | 7027.768 | 4.990 | 0.000 | 2.11e+04 4.91e+04 |

Omnibus: | 10.172 | Durbin-Watson: | 1.385 |
---|---|---|---|

Prob(Omnibus): | 0.006 | Jarque-Bera (JB): | 10.098 |

Skew: | 0.822 | Prob(JB): | 0.00641 |

Kurtosis: | 3.573 | Cond. No. | 9.48 |