We have
a : X = [ 1 0 1 4 1 14 1 10 1 9 1 8 1 6 1 1 ] y = [ 2.4 7.2 10.3 9.1 10.2 4.1 7.6 3.5 ] [ a b ] = ( X T X ) − 1 X T y = = ( [ 1 1 1 1 1 1 1 1 0 4 14 10 9 8 6 1 ] [ 1 0 1 4 1 14 1 10 1 9 1 8 1 6 1 1 ] ) − 1 [ 1 1 1 1 1 1 1 1 0 4 14 10 9 8 6 1 ] [ 2.4 7.2 10.3 9.1 10.2 4.1 7.6 3.5 ] = = [ 8 52 52 494 ] − 1 [ 54.4 437.7 ] = 1 8 ⋅ 494 − 5 2 2 [ 494 − 52 − 52 8 ] [ 54.4 437.7 ] = 1 1248 [ 4113.2 672.8 ] = = [ 3.29583 0.539103 ] y ′ = 3.29583 + 0.539103 x a:\\X=\left[ \begin{array}{c} \begin{matrix} 1& 0\\ 1& 4\\ 1& 14\\ 1& 10\\\end{matrix}\\ \begin{matrix} 1& 9\\ 1& 8\\ 1& 6\\ 1& 1\\\end{matrix}\\\end{array} \right] \\y=\left[ \begin{array}{c} 2.4\\ 7.2\\ 10.3\\ 9.1\\ 10.2\\ 4.1\\ 7.6\\ 3.5\\\end{array} \right] \\\left[ \begin{array}{c} a\\ b\\\end{array} \right] =\left( X^TX \right) ^{-1}X^Ty=\\=\left( \left[ \begin{matrix} 1& 1& 1& 1& 1& 1& 1& 1\\ 0& 4& 14& 10& 9& 8& 6& 1\\\end{matrix} \right] \left[ \begin{array}{c} \begin{matrix} 1& 0\\ 1& 4\\ 1& 14\\ 1& 10\\\end{matrix}\\ \begin{matrix} 1& 9\\ 1& 8\\ 1& 6\\ 1& 1\\\end{matrix}\\\end{array} \right] \right) ^{-1}\left[ \begin{matrix} 1& 1& 1& 1& 1& 1& 1& 1\\ 0& 4& 14& 10& 9& 8& 6& 1\\\end{matrix} \right] \left[ \begin{array}{c} 2.4\\ 7.2\\ 10.3\\ 9.1\\ 10.2\\ 4.1\\ 7.6\\ 3.5\\\end{array} \right] =\\=\left[ \begin{matrix} 8& 52\\ 52& 494\\\end{matrix} \right] ^{-1}\left[ \begin{array}{c} 54.4\\ 437.7\\\end{array} \right] =\frac{1}{8\cdot 494-52^2}\left[ \begin{matrix} 494& -52\\ -52& 8\\\end{matrix} \right] \left[ \begin{array}{c} 54.4\\ 437.7\\\end{array} \right] =\frac{1}{1248}\left[ \begin{array}{c} 4113.2\\ 672.8\\\end{array} \right] =\\=\left[ \begin{array}{c} 3.29583\\ 0.539103\\\end{array} \right] \\y'=3.29583+0.539103x a : X = ⎣ ⎡ 1 1 1 1 0 4 14 10 1 1 1 1 9 8 6 1 ⎦ ⎤ y = ⎣ ⎡ 2.4 7.2 10.3 9.1 10.2 4.1 7.6 3.5 ⎦ ⎤ [ a b ] = ( X T X ) − 1 X T y = = ⎝ ⎛ [ 1 0 1 4 1 14 1 10 1 9 1 8 1 6 1 1 ] ⎣ ⎡ 1 1 1 1 0 4 14 10 1 1 1 1 9 8 6 1 ⎦ ⎤ ⎠ ⎞ − 1 [ 1 0 1 4 1 14 1 10 1 9 1 8 1 6 1 1 ] ⎣ ⎡ 2.4 7.2 10.3 9.1 10.2 4.1 7.6 3.5 ⎦ ⎤ = = [ 8 52 52 494 ] − 1 [ 54.4 437.7 ] = 8 ⋅ 494 − 5 2 2 1 [ 494 − 52 − 52 8 ] [ 54.4 437.7 ] = 1248 1 [ 4113.2 672.8 ] = = [ 3.29583 0.539103 ] y ′ = 3.29583 + 0.539103 x
b:
The slope is
β = 0.539103 \beta =0.539103 β = 0.539103
Next,
from which
s β = ∑ ( y i − y i ′ ) 2 ( n − 2 ) ∑ ( x i − x ˉ ) 2 = 22.10147 ( 8 − 2 ) ⋅ 156 = 0.153664 s_{\beta}=\sqrt{\frac{\sum{\left( y_i-y_i' \right) ^2}}{\left( n-2 \right) \sum{\left( x_i-\bar{x} \right) ^2}}}=\sqrt{\frac{22.10147}{\left( 8-2 \right) \cdot 156}}=0.153664 s β = ( n − 2 ) ∑ ( x i − x ˉ ) 2 ∑ ( y i − y i ′ ) 2 = ( 8 − 2 ) ⋅ 156 22.10147 = 0.153664
The confidence interval is
( β − t 1 − α / 2 , n − 2 s β , β + t 1 − α / 2 , n − 2 s β ) = = ( 0.53910 − 1.94318 ⋅ 0.15366 , 0.53910 + 1.94318 ⋅ 0.15366 ) = = ( 0.240511 , 0.837689 ) \left( \beta -t_{1-\alpha /2,n-2}s_{\beta},\beta +t_{1-\alpha /2,n-2}s_{\beta} \right) =\\=\left( 0.53910-1.94318\cdot 0.15366,0.53910+1.94318\cdot 0.15366 \right) =\\=\left( 0.240511,0.837689 \right) ( β − t 1 − α /2 , n − 2 s β , β + t 1 − α /2 , n − 2 s β ) = = ( 0.53910 − 1.94318 ⋅ 0.15366 , 0.53910 + 1.94318 ⋅ 0.15366 ) = = ( 0.240511 , 0.837689 )
Comments