올림픽 높이 뛰기 표. Numpy의 regression 함수를 적용해보도록 한다.
| Year | Height(m) | Year | Height(m) |
| 1900 | 3.30 | 1956 | 4.56 |
| 1904 | 3.50 | 1960 | 4.70 |
| 1908 | 3.71 | 1964 | 5.10 |
| 1912 | 3.95 | 1968 | 5.40 |
| 1920 | 4.09 | 1972 | 5.50 |
| 1924 | 3.95 | 1976 | 5.50 |
| 1928 | 4.20 | 1980 | 5.78 |
| 1932 | 4.31 | 1984 | 5.75 |
| 1936 | 4.35 | 1988 | 5.90 |
| 1948 | 4.30 | 1992 | 5.80 |
| 1952 | 4.55 | 1996 | 5.92 |
Least square regression이 SciPy에 포함된 줄 알았더니 그냥 NumPy에 이미 있었다. ^^;
#using lstsq method from numpy
A = vstack ( [ year, ones (len (year) ) ] ).T
m_l , c_l = linalg.lstsq (A, height) [0]
print m_l, c_l
아래 그림에서 녹색은 least square regression 방식이고 붉은색 라인은 first/last point를 이용한 regression이다.
