# 簡單線性迴歸

${\displaystyle {\hat {\beta }}=r_{x,y}{\frac {s_{y}}{s_{x}}}}$

## 計算迴歸式

${\displaystyle y=\alpha +\beta x}$

${\displaystyle y_{i}=\alpha +\beta x_{i}+\varepsilon _{i},i=1,\ldots ,n}$

${\displaystyle Q(\alpha ,\beta )=\sum _{i=1}^{n}{\hat {\varepsilon }}_{i}^{\,2}=\sum _{i=1}^{n}(y_{i}-\alpha -\beta x_{i})^{2}}$

{\textstyle {\begin{aligned}{\hat {\alpha }}&={\bar {y}}-({\hat {\beta }}\,{\bar {x}}),\\{\hat {\beta }}&={\frac {\sum _{i=1}^{n}(x_{i}-{\bar {x}})(y_{i}-{\bar {y}})}{\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}\\&={\frac {s_{x,y}}{s_{x}^{2}}}\\&=r_{xy}{\frac {s_{y}}{s_{x}}}\end{aligned}}}

${\displaystyle {\hat {\alpha }}}$${\displaystyle {\hat {\beta }}}$帶入

${\displaystyle {\hat {y}}={\hat {\alpha }}+{\hat {\beta }}x}$

${\displaystyle {\frac {{\hat {y}}-{\bar {y}}}{s_{y}}}=r_{xy}{\frac {x-{\bar {x}}}{s_{x}}}}$

${\displaystyle {\overline {xy}}}$表示對應的xy的乘積和，

${\displaystyle {\overline {xy}}={\frac {1}{n}}\sum _{i=1}^{n}x_{i}y_{i}}$

${\displaystyle r_{xy}={\frac {{\overline {xy}}-{\bar {x}}{\bar {y}}}{\sqrt {\left({\overline {x^{2}}}-{\bar {x}}^{2}\right)\left({\overline {y^{2}}}-{\bar {y}}^{2}\right)}}}}$

${\displaystyle R^{2}=r_{xy}^{2}}$

### 迴歸係數（斜率）的意義

${\displaystyle {\hat {\beta }}}$的估計式分子乘以${\displaystyle {\frac {(x_{i}-{\bar {x}})}{(x_{i}-{\bar {x}})}}}$，可改寫為

${\displaystyle {\hat {\beta }}={\frac {\sum _{i=1}^{n}(x_{i}-{\bar {x}})(y_{i}-{\bar {y}})}{\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}={\frac {\sum _{i=1}^{n}\left((x_{i}-{\bar {x}})^{2}\times {\frac {(y_{i}-{\bar {y}})}{(x_{i}-{\bar {x}})}}\right)}{\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}}$

### 截距的意義

${\displaystyle {\hat {\alpha }}}$可經由下列式子估算： ${\displaystyle {\hat {\alpha }}={\bar {y}}-{\hat {\beta }}\ {\bar {x}}}$。 由於${\displaystyle {\hat {\beta }}=\tan(\theta )=dy/dx\rightarrow dy=dx\times {\hat {\beta }}}$，其中${\displaystyle \theta }$即為與橫軸正值的夾角，可以得到${\displaystyle {\hat {\alpha }}={\bar {y}}-dx\times {\hat {\beta }}={\bar {y}}-dy}$

## 參考文獻

1. ^ Seltman, Howard J. Experimental Design and Analysis (PDF). 2008-09-08: 227.
2. ^ Statistical Sampling and Regression: Simple Linear Regression. Columbia University. [2016-10-17]. When one independent variable is used in a regression, it is called a simple regression;(...)
3. ^ Lane, David M. Introduction to Statistics (PDF). : 462.
4. ^ Zou KH; Tuncali K; Silverman SG. Correlation and simple linear regression.. Radiology. 2003, 227 (3): 617–22. ISSN 0033-8419. OCLC 110941167. PMID 12773666. doi:10.1148/radiol.2273011499 （English）.
5. ^ Altman, Naomi; Krzywinski, Martin. Simple linear regression. Nature Methods. 2015, 12 (11): 999–1000. ISSN 1548-7091. OCLC 5912005539. PMID 26824102. doi:10.1038/nmeth.3627 （English）.
6. ^ Kenney, J. F. and Keeping, E. S. (1962) "Linear Regression and Correlation." Ch. 15 in Mathematics of Statistics, Pt. 1, 3rd ed. Princeton, NJ: Van Nostrand, pp. 252–285