Skip to content

Commit 136fe56

Browse files
authored
Merge pull request #138 from JoramSoch/master
added 5 proofs
2 parents 805202b + 21fd59b commit 136fe56

6 files changed

Lines changed: 502 additions & 15 deletions

File tree

I/ToC.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -483,21 +483,26 @@ title: "Table of Contents"
483483
1.3. Simple linear regression <br>
484484
&emsp;&ensp; 1.3.1. *[Definition](/D/slr)* <br>
485485
&emsp;&ensp; 1.3.2. **[Special case of multiple linear regression](/P/slr-mlr)** <br>
486-
&emsp;&ensp; 1.3.3. **[Ordinary least squares](/P/slr-ols)** <br>
487-
&emsp;&ensp; 1.3.4. **[Expectation of estimates](/P/slr-olsmean)** <br>
488-
&emsp;&ensp; 1.3.5. **[Variance of estimates](/P/slr-olsvar)** <br>
489-
&emsp;&ensp; 1.3.6. **[Distribution of estimates](/P/slr-olsdist)** <br>
490-
&emsp;&ensp; 1.3.7. **[Effects of mean-centering](/P/slr-meancent)** <br>
491-
&emsp;&ensp; 1.3.8. *[Regression line](/D/regline)* <br>
492-
&emsp;&ensp; 1.3.9. **[Regression line includes center of mass](/P/slr-comp)** <br>
493-
&emsp;&ensp; 1.3.10. **[Projection of data point to regression line](/P/slr-proj)** <br>
494-
&emsp;&ensp; 1.3.11. **[Sums of squares](/P/slr-sss)** <br>
495-
&emsp;&ensp; 1.3.12. **[Transformation matrices](/P/slr-mat)** <br>
496-
&emsp;&ensp; 1.3.13. **[Sum of residuals is zero](/P/slr-ressum)** <br>
497-
&emsp;&ensp; 1.3.14. **[Correlation with covariate is zero](/P/slr-rescorr)** <br>
498-
&emsp;&ensp; 1.3.15. **[Residual variance in terms of sample variance](/P/slr-resvar)** <br>
499-
&emsp;&ensp; 1.3.16. **[Correlation coefficient in terms of slope estimate](/P/slr-corr)** <br>
500-
&emsp;&ensp; 1.3.17. **[Coefficient of determination in terms of correlation coefficient](/P/slr-rsq)** <br>
486+
&emsp;&ensp; 1.3.3. **[Ordinary least squares](/P/slr-ols)** (1) <br>
487+
&emsp;&ensp; 1.3.4. **[Ordinary least squares](/P/slr-ols2)** (2) <br>
488+
&emsp;&ensp; 1.3.5. **[Expectation of estimates](/P/slr-olsmean)** <br>
489+
&emsp;&ensp; 1.3.6. **[Variance of estimates](/P/slr-olsvar)** <br>
490+
&emsp;&ensp; 1.3.7. **[Distribution of estimates](/P/slr-olsdist)** <br>
491+
&emsp;&ensp; 1.3.8. **[Effects of mean-centering](/P/slr-meancent)** <br>
492+
&emsp;&ensp; 1.3.9. *[Regression line](/D/regline)* <br>
493+
&emsp;&ensp; 1.3.10. **[Regression line includes center of mass](/P/slr-comp)** <br>
494+
&emsp;&ensp; 1.3.11. **[Projection of data point to regression line](/P/slr-proj)** <br>
495+
&emsp;&ensp; 1.3.12. **[Sums of squares](/P/slr-sss)** <br>
496+
&emsp;&ensp; 1.3.13. **[Transformation matrices](/P/slr-mat)** <br>
497+
&emsp;&ensp; 1.3.14. **[Weighted least squares](/P/slr-wls)** (1) <br>
498+
&emsp;&ensp; 1.3.15. **[Weighted least squares](/P/slr-wls2)** (2) <br>
499+
&emsp;&ensp; 1.3.16. **[Maximum likelihood estimation](/P/slr-mle)** (1) <br>
500+
&emsp;&ensp; 1.3.17. **[Maximum likelihood estimation](/P/slr-mle2)** (2) <br>
501+
&emsp;&ensp; 1.3.18. **[Sum of residuals is zero](/P/slr-ressum)** <br>
502+
&emsp;&ensp; 1.3.19. **[Correlation with covariate is zero](/P/slr-rescorr)** <br>
503+
&emsp;&ensp; 1.3.20. **[Residual variance in terms of sample variance](/P/slr-resvar)** <br>
504+
&emsp;&ensp; 1.3.21. **[Correlation coefficient in terms of slope estimate](/P/slr-corr)** <br>
505+
&emsp;&ensp; 1.3.22. **[Coefficient of determination in terms of correlation coefficient](/P/slr-rsq)** <br>
501506

502507
1.4. Multiple linear regression <br>
503508
&emsp;&ensp; 1.4.1. *[Definition](/D/mlr)* <br>

P/slr-mle.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2021-11-16 08:34:00
9+
10+
title: "Maximum likelihood estimation for simple linear regression"
11+
chapter: "Statistical Models"
12+
section: "Univariate normal data"
13+
topic: "Simple linear regression"
14+
theorem: "Maximum likelihood estimation"
15+
16+
sources:
17+
18+
proof_id: "P287"
19+
shortcut: "slr-mle"
20+
username: "JoramSoch"
21+
---
22+
23+
24+
**Theorem:** Given a [simple linear regression model](/D/mlr) with independent observations
25+
26+
$$ \label{eq:slr}
27+
y = \beta_0 + \beta_1 x + \varepsilon, \; \varepsilon_i \sim \mathcal{N}(0, \sigma^2), \; i = 1,\ldots,n \; ,
28+
$$
29+
30+
the [maximum likelihood estimates](/D/mle) of $\beta_0$, $\beta_1$ and $\sigma^2$ are given by
31+
32+
$$ \label{eq:slr-mle}
33+
\begin{split}
34+
\hat{\beta}_0 &= \bar{y} - \hat{\beta}_1 \bar{x} \\
35+
\hat{\beta}_1 &= \frac{s_{xy}}{s_x^2} \\
36+
\hat{\sigma}^2 &= \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2
37+
\end{split}
38+
$$
39+
40+
where $\bar{x}$ and $\bar{y}$ are the [sample means](/D/mean-samp), $s_x^2$ is the [sample variance](/D/var-samp) of $x$ and $s_{xy}$ is the [sample covariance](/D/cov-samp) between $x$ and $y$.
41+
42+
43+
**Proof:** With the [probability density function of the normal distribution](/P/norm-pdf) and [probability under independence](/D/ind), the linear regression equation \eqref{eq:slr} implies the following [likelihood function](/D/lf)
44+
45+
$$ \label{eq:slr-lf}
46+
\begin{split}
47+
p(y|\beta_0,\beta_1,\sigma^2) &= \prod_{i=1}^n p(y_i|\beta_0,\beta_1,\sigma^2) \\
48+
&= \prod_{i=1}^n \mathcal{N}(y_i; \beta_0 + \beta_1 x_i, \sigma^2) \\
49+
&= \prod_{i=1}^n \frac{1}{\sqrt{2 \pi \sigma}} \cdot \exp \left[ -\frac{(y_i - \beta_0 - \beta_1 x_i)^2}{2 \sigma^2} \right] \\
50+
&= \frac{1}{\sqrt{(2 \pi \sigma^2)^n}} \cdot \exp\left[ -\frac{1}{2 \sigma^2} \sum_{i=1}^n (y_i - \beta_0 - \beta_1 x_i)^2 \right]
51+
\end{split}
52+
$$
53+
54+
and the [log-likelihood function](/D/llf)
55+
56+
$$ \label{eq:slr-ll}
57+
\begin{split}
58+
\mathrm{LL}(\beta_0,\beta_1,\sigma^2) &= \log p(y|\beta_0,\beta_1,\sigma^2) \\
59+
&= -\frac{n}{2} \log(2\pi) - \frac{n}{2} \log (\sigma^2) -\frac{1}{2 \sigma^2} \sum_{i=1}^n (y_i - \beta_0 - \beta_1 x_i)^2 \; .
60+
\end{split}
61+
$$
62+
63+
<br>
64+
The derivative of the log-likelihood function \eqref{eq:slr-ll} with respect to $\beta_0$ is
65+
66+
$$ \label{eq:dLL-dbeta0}
67+
\frac{\mathrm{d}\mathrm{LL}(\beta_0,\beta_1,\sigma^2)}{\mathrm{d}\beta_0} = \frac{1}{\sigma^2} \sum_{i=1}^n (y_i - \beta_0 - \beta_1 x_i)
68+
$$
69+
70+
and setting this derivative to zero gives the MLE for $\beta_0$:
71+
72+
$$ \label{eq:beta0-mle}
73+
\begin{split}
74+
\frac{\mathrm{d}\mathrm{LL}(\hat{\beta}_0,\hat{\beta}_1,\hat{\sigma}^2)}{\mathrm{d}\beta_0} &= 0 \\
75+
0 &= \frac{1}{\hat{\sigma}^2} \sum_{i=1}^n (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i) \\
76+
0 &= \sum_{i=1}^n y_i - n \hat{\beta}_0 - \hat{\beta}_1 \sum_{i=1}^n x_i \\
77+
\hat{\beta}_0 &= \frac{1}{n} \sum_{i=1}^n y_i - \hat{\beta}_1 \frac{1}{n} \sum_{i=1}^n x_i \\
78+
\hat{\beta}_0 &= \bar{y} - \hat{\beta}_1 \bar{x} \; .
79+
\end{split}
80+
$$
81+
82+
<br>
83+
The derivative of the log-likelihood function \eqref{eq:slr-ll} at $\hat{\beta}_0$ with respect to $\beta_1$ is
84+
85+
$$ \label{eq:dLL-dbeta1}
86+
\frac{\mathrm{d}\mathrm{LL}(\hat{\beta}_0,\beta_1,\sigma^2)}{\mathrm{d}\beta_1} = \frac{1}{\sigma^2} \sum_{i=1}^n (x_i y_i - \hat{\beta}_0 x_i - \beta_1 x_i^2) \\
87+
$$
88+
89+
and setting this derivative to zero gives the MLE for $\beta_1$:
90+
91+
$$ \label{eq:beta1-mle}
92+
\begin{split}
93+
\frac{\mathrm{d}\mathrm{LL}(\hat{\beta}_0,\hat{\beta}_1,\hat{\sigma}^2)}{\mathrm{d}\beta_0} &= 0 \\
94+
0 &= \frac{1}{\hat{\sigma}^2} \sum_{i=1}^n (x_i y_i - \hat{\beta}_0 x_i - \hat{\beta}_1 x_i^2) \\
95+
0 &= \sum_{i=1}^n x_i y_i - \hat{\beta}_0 \sum_{i=1}^n x_i - \hat{\beta}_1 \sum_{i=1}^n x_i^2) \\
96+
0 &\overset{\eqref{eq:beta0-mle}}{=} \sum_{i=1}^n x_i y_i - (\bar{y} - \hat{\beta}_1 \bar{x}) \sum_{i=1}^n x_i - \hat{\beta}_1 \sum_{i=1}^n x_i^2 \\
97+
0 &= \sum_{i=1}^n x_i y_i - \bar{y} \sum_{i=1}^n x_i + \hat{\beta}_1 \bar{x} \sum_{i=1}^n x_i - \hat{\beta}_1 \sum_{i=1}^n x_i^2 \\
98+
0 &= \sum_{i=1}^n x_i y_i - n \bar{x} \bar{y} + \hat{\beta}_1 n \bar{x}^2 - \hat{\beta}_1 \sum_{i=1}^n x_i^2 \\
99+
\hat{\beta}_1 &= \frac{\sum_{i=1}^n x_i y_i - \sum_{i=1}^n \bar{x} \bar{y}}{\sum_{i=1}^n x_i^2 - \sum_{i=1}^n \bar{x}^2} \\
100+
\hat{\beta}_1 &= \frac{\sum_{i=1}^n (x_i - \bar{x}) (y_i - \bar{y})}{\sum_{i=1}^n (x_i - \bar{x})^2} \\
101+
\hat{\beta}_1 &= \frac{s_{xy}}{s_x^2} \; .
102+
\end{split}
103+
$$
104+
105+
<br>
106+
The derivative of the log-likelihood function \eqref{eq:slr-ll} at $(\hat{\beta}_0,\hat{\beta}_1)$ with respect to $\sigma^2$ is
107+
108+
$$ \label{eq:dLL-ds2}
109+
\frac{\mathrm{d}\mathrm{LL}(\hat{\beta}_0,\hat{\beta}_1,\sigma^2)}{\mathrm{d}\sigma^2} = - \frac{n}{2\sigma^2} + \frac{1}{2(\sigma^2)^2} \sum_{i=1}^n (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2
110+
$$
111+
112+
and setting this derivative to zero gives the MLE for $\sigma^2$:
113+
114+
$$ \label{eq:s2-mle}
115+
\begin{split}
116+
\frac{\mathrm{d}\mathrm{LL}(\hat{\beta}_0,\hat{\beta}_1,\hat{\sigma}^2)}{\mathrm{d}\sigma^2} &= 0 \\
117+
0 &= - \frac{n}{2\hat{\sigma}^2} + \frac{1}{2(\hat{\sigma}^2)^2} \sum_{i=1}^n (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2 \\
118+
\frac{n}{2\hat{\sigma}^2} &= \frac{1}{2(\hat{\sigma}^2)^2} \sum_{i=1}^n (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2 \\
119+
\hat{\sigma}^2 &= \frac{1}{n} \sum_{i=1}^n (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2 \; .
120+
\end{split}
121+
$$
122+
123+
<br>
124+
Together, \eqref{eq:beta0-mle}, \eqref{eq:beta1-mle} and \eqref{eq:s2-mle} constitute the MLE for simple linear regression.

P/slr-mle2.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2021-11-16 11:53:00
9+
10+
title: "Maximum likelihood estimation for simple linear regression"
11+
chapter: "Statistical Models"
12+
section: "Univariate normal data"
13+
topic: "Simple linear regression"
14+
theorem: "Maximum likelihood estimation"
15+
16+
sources:
17+
18+
proof_id: "P290"
19+
shortcut: "slr-mle2"
20+
username: "JoramSoch"
21+
---
22+
23+
24+
**Theorem:** Given a [simple linear regression model](/D/mlr) with independent observations
25+
26+
$$ \label{eq:slr}
27+
y = \beta_0 + \beta_1 x + \varepsilon, \; \varepsilon_i \sim \mathcal{N}(0, \sigma^2), \; i = 1,\ldots,n \; ,
28+
$$
29+
30+
the [maximum likelihood estimates](/D/mle) of $\beta_0$, $\beta_1$ and $\sigma^2$ are given by
31+
32+
$$ \label{eq:slr-mle}
33+
\begin{split}
34+
\hat{\beta}_0 &= \bar{y} - \hat{\beta}_1 \bar{x} \\
35+
\hat{\beta}_1 &= \frac{s_{xy}}{s_x^2} \\
36+
\hat{\sigma}^2 &= \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2
37+
\end{split}
38+
$$
39+
40+
where $\bar{x}$ and $\bar{y}$ are the [sample means](/D/mean-samp), $s_x^2$ is the [sample variance](/D/var-samp) of $x$ and $s_{xy}$ is the [sample covariance](/D/cov-samp) between $x$ and $y$.
41+
42+
43+
**Proof:** [Simple linear regression is a special case of multiple linear regression](/P/slr-mlr) with
44+
45+
$$ \label{eq:slr-mlr}
46+
X = \left[ 1_n, \, x \right] \quad \text{and} \quad \beta = \left[ \begin{matrix} \beta_0 \\ \beta_1 \end{matrix} \right]
47+
$$
48+
49+
and [weighted least sqaures estimates](/P/mlr-mle) are given by
50+
51+
$$ \label{eq:mlr-mle}
52+
\begin{split}
53+
\hat{\beta} &= (X^\mathrm{T} V^{-1} X)^{-1} X^\mathrm{T} V^{-1} y \\
54+
\hat{\sigma}^2 &= \frac{1}{n} (y-X\hat{\beta})^\mathrm{T} V^{-1} (y-X\hat{\beta}) \; .
55+
\end{split}
56+
$$
57+
58+
Under independent observations, the covariance matrix is
59+
60+
$$ \label{eq:mlr-ind}
61+
V = I_n, \quad \text{such that} \quad V^{-1} = I_n \; .
62+
$$
63+
64+
Thus, we can write out the estimate of $\beta$
65+
66+
$$ \label{eq:slr-mle-b}
67+
\begin{split}
68+
\hat{\beta} &= \left( \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] V^{-1} \left[ \begin{matrix} 1_n & x \end{matrix} \right] \right)^{-1} \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] V^{-1} y \\
69+
&= \left( \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \left[ \begin{matrix} 1_n & x \end{matrix} \right] \right)^{-1} \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] y
70+
\end{split}
71+
$$
72+
73+
which [is equal to the ordinary least squares solution for simple linear regression](/P/slr-ols):
74+
75+
$$ \label{eq:slr-mle-b-qed}
76+
\begin{split}
77+
\hat{\beta}_0 &= \bar{y} - \hat{\beta}_1 \bar{x} \\
78+
\hat{\beta}_1 &= \frac{s_{xy}}{s_x^2} \; .
79+
\end{split}
80+
$$
81+
82+
Additionally, we can write out the estimate of $\sigma^2$:
83+
84+
$$ \label{eq:slr-mle-s2}
85+
\begin{split}
86+
\hat{\sigma}^2 &= \frac{1}{n} (y-X\hat{\beta})^\mathrm{T} V^{-1} (y-X\hat{\beta}) \\
87+
&= \frac{1}{n} \left( y - \left[ \begin{matrix} 1_n & x \end{matrix} \right] \left[ \begin{matrix} \hat{\beta}_0 \\ \hat{\beta}_1 \end{matrix} \right] \right)^\mathrm{T} \left( y - \left[ \begin{matrix} 1_n & x \end{matrix} \right] \left[ \begin{matrix} \hat{\beta}_0 \\ \hat{\beta}_1 \end{matrix} \right] \right) \\
88+
&= \frac{1}{n} \left( y - \hat{\beta}_0 - \hat{\beta}_1 x \right)^\mathrm{T} \left( y - \hat{\beta}_0 - \hat{\beta}_1 x \right) \\
89+
&= \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{\beta}_0 - \hat{\beta}_1 x_i)^2 \; .
90+
\end{split}
91+
$$

P/slr-ols2.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2021-11-16 09:36:00
9+
10+
title: "Ordinary least squares for simple linear regression"
11+
chapter: "Statistical Models"
12+
section: "Univariate normal data"
13+
topic: "Simple linear regression"
14+
theorem: "Ordinary least squares"
15+
16+
sources:
17+
18+
proof_id: "P288"
19+
shortcut: "slr-ols2"
20+
username: "JoramSoch"
21+
---
22+
23+
24+
**Theorem:** Given a [simple linear regression model](/D/slr) with independent observations
25+
26+
$$ \label{eq:slr}
27+
y = \beta_0 + \beta_1 x + \varepsilon, \; \varepsilon_i \sim \mathcal{N}(0, \sigma^2), \; i = 1,\ldots,n \; ,
28+
$$
29+
30+
the parameters minimizing the [residual sum of squares](/D/rss) are given by
31+
32+
$$ \label{eq:slr-ols}
33+
\begin{split}
34+
\hat{\beta}_0 &= \bar{y} - \hat{\beta}_1 \bar{x} \\
35+
\hat{\beta}_1 &= \frac{s_{xy}}{s_x^2}
36+
\end{split}
37+
$$
38+
39+
where $\bar{x}$ and $\bar{y}$ are the [sample means](/D/mean-samp), $s_x^2$ is the [sample variance](/D/var-samp) of $x$ and $s_{xy}$ is the [sample covariance](/D/cov-samp) between $x$ and $y$.
40+
41+
42+
**Proof:** [Simple linear regression is a special case of multiple linear regression](/P/slr-mlr) with
43+
44+
$$ \label{eq:slr-mlr}
45+
X = \left[ 1_n, \, x \right] \quad \text{and} \quad \beta = \left[ \begin{matrix} \beta_0 \\ \beta_1 \end{matrix} \right]
46+
$$
47+
48+
and [ordinary least sqaures estimates](/P/mlr-ols) are given by
49+
50+
$$ \label{eq:mlr-ols}
51+
\hat{\beta} = (X^\mathrm{T} X)^{-1} X^\mathrm{T} y \; .
52+
$$
53+
54+
Writing out equation \eqref{eq:mlr-ols}, we have
55+
56+
$$ \label{eq:slr-ols-b}
57+
\begin{split}
58+
\hat{\beta} &= \left( \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \left[ \begin{matrix} 1_n & x \end{matrix} \right] \right)^{-1} \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] y \\
59+
&= \left( \left[ \begin{matrix} n & n\bar{x} \\ n\bar{x} & x^\mathrm{T} x \end{matrix} \right] \right)^{-1} \left[ \begin{matrix} n \bar{y} \\ x^\mathrm{T} y \end{matrix} \right] \\
60+
&= \frac{1}{n x^\mathrm{T} x - (n\bar{x})^2} \left[ \begin{matrix} x^\mathrm{T} x & -n\bar{x} \\ -n\bar{x} & n \end{matrix} \right] \left[ \begin{matrix} n \bar{y} \\ x^\mathrm{T} y \end{matrix} \right] \\
61+
&= \frac{1}{n x^\mathrm{T} x - (n\bar{x})^2} \left[ \begin{matrix} n \bar{y} \, x^\mathrm{T} x - n \bar{x} \, x^\mathrm{T} y \\ n \, x^\mathrm{T} y - (n \bar{x})(n \bar{y}) \end{matrix} \right] \; .
62+
\end{split}
63+
$$
64+
65+
Thus, the second entry of $\hat{\beta}$ [is equal to](/P/slr-ols):
66+
67+
$$ \label{eq:slr-ols-b1}
68+
\begin{split}
69+
\hat{\beta}_1 &= \frac{n \, x^\mathrm{T} y - (n \bar{x})(n \bar{y})}{n x^\mathrm{T} x - (n\bar{x})^2} \\
70+
&= \frac{x^\mathrm{T} y - n \bar{x} \bar{y}}{x^\mathrm{T} x - n \bar{x}^2} \\
71+
&= \frac{\sum_{i=1}^n x_i y_i - \sum_{i=1}^n \bar{x} \bar{y}}{\sum_{i=1}^n x_i^2 - \sum_{i=1}^n \bar{x}^2} \\
72+
&= \frac{\sum_{i=1}^n (x_i - \bar{x}) (y_i - \bar{y})}{\sum_{i=1}^n (x_i - \bar{x})^2} \\
73+
&= \frac{s_{xy}}{s_x^2} \; .
74+
\end{split}
75+
$$
76+
77+
Moreover, the first entry of $\hat{\beta}$ is equal to:
78+
79+
$$ \label{eq:slr-ols-b2}
80+
\begin{split}
81+
\hat{\beta}_0 &= \frac{n \bar{y} \, x^\mathrm{T} x - n \bar{x} \, x^\mathrm{T} y}{n x^\mathrm{T} x - (n\bar{x})^2} \\
82+
&= \frac{\bar{y} \, x^\mathrm{T} x - \bar{x} \, x^\mathrm{T} y}{x^\mathrm{T} x - n \bar{x}^2} \\
83+
&= \frac{\bar{y} \, x^\mathrm{T} x - \bar{x} \, x^\mathrm{T} y + n \bar{x}^2 \bar{y} - n \bar{x}^2 \bar{y}}{x^\mathrm{T} x - n \bar{x}^2} \\
84+
&= \frac{\bar{y} (x^\mathrm{T} x - n \bar{x}^2) - \bar{x} (x^\mathrm{T} y - n \bar{x} \bar{y})}{x^\mathrm{T} x - n \bar{x}^2} \\
85+
&= \frac{\bar{y} (x^\mathrm{T} x - n \bar{x}^2)}{x^\mathrm{T} x - n \bar{x}^2} - \frac{\bar{x} (x^\mathrm{T} y - n \bar{x} \bar{y})}{x^\mathrm{T} x - n \bar{x}^2} \\
86+
&= \bar{y} - \bar{x} \, \frac{\sum_{i=1}^n x_i y_i - \sum_{i=1}^n \bar{x} \bar{y}}{\sum_{i=1}^n x_i^2 - \sum_{i=1}^n \bar{x}^2} \\
87+
&= \bar{y} - \hat{\beta}_1 \bar{x} \; .
88+
\end{split}
89+
$$

0 commit comments

Comments
 (0)