Python for Finance: Part II: 3 Using Regressions for Financial Analysis

Regression

Mortgage
1. Size: Explanatory variable
2. Price: Dependent variable

Simple regression: Using only one variable
y = mx + b
y = α + βx

Multivariate regression: Using more than one variable

Implementation

Are all regressions created equal? Learning how to distinguish good

Y = α + βx + error

Residuals
– The best fitting line minimizes the sum of the squared residuals
=> OLS (ordinary least square) estimates

Good vs. Bad regressions (a comparison of explanatory power)
– Using the R square

S2 = (Σ (X-X)2) / (N-1)

TSS = Σ(X-X)2

TSS(Total Sum of Squares):
– provides a sense of the variability of data

R2 = 1 – SSR / TSS
– R square varies between 0% – 100%.
– The higher it is, the more predictive power the model has.

ページトップへ