Hemos visto que
\[ \hat \beta \rightarrow N(\beta, Q \sigma^2) \]
donde \(Q = (X^TX)^{-1}\). Esto implica que:
\[ \hat \beta_i \rightarrow N(\beta_i, Q_{ii} \sigma^2), \ i = 1,2, \ldots,k \]
donde \(Q_{ij}\) es el elemento ij de la matriz Q. Aplicando las propiedades de la distribución normal
\[ \frac{\hat \beta_i - \beta_i}{\sqrt{Q_{ii} \sigma^2}} \rightarrow N(0,1) \]
Por tanto:
\[ \frac{\hat \beta_i - \beta_i}{se(\hat \beta_i)} \rightarrow t_{n-k-1} \]
donde
\[se(\hat \beta_i) = \sqrt{Q_{ii} \hat s_R^2}\]
Para deducir la expresión anterior se ha tenido en cuenta que
\[ \frac{N(0,1)}{\sqrt{\frac{\chi^2_n}{n}}} \rightarrow t_n \]
Por tanto, el intervalo de confianza \(100(1-\alpha)\)% se escribe como
\[ \hat \beta_i \pm t_{n-k-1;\alpha/2} se(\hat \beta_i) \]
Partimos de la distribución en el muestreo:
\[ \frac{(n-k-1)\hat s_R^2}{\sigma^2} \rightarrow \chi^2_{n-k-1} \]
Despejando:
\[ \frac{(n-k-1)\hat s_R^2}{\chi^2_{n-k-1;\alpha/2}} \leq \sigma^2 \leq \frac{(n-k-1)\hat s_R^2}{\chi^2_{n-k-1;1-\alpha/2}} \]
## 'data.frame': 30 obs. of 7 variables:
## $ Species : num 58 31 3 25 2 18 24 10 8 2 ...
## $ Endemics : num 23 21 3 9 1 11 0 7 4 2 ...
## $ Area : num 25.09 1.24 0.21 0.1 0.05 ...
## $ Elevation: num 346 109 114 46 77 119 93 168 71 112 ...
## $ Nearest : num 0.6 0.6 2.8 1.9 1.9 8 6 34.1 0.4 2.6 ...
## $ Scruz : num 0.6 26.3 58.7 47.4 1.9 ...
## $ Adjacent : num 1.84 572.33 0.78 0.18 903.82 ...
En R podemos calcular la matriz de varianzas de los parámetros estimados, es decir \(var(\hat \beta) = Q_{ii} \hat s_R^2\), mediante:
## (Intercept) Area Elevation Nearest
## (Intercept) 366.88329428 0.1404740421 -0.5807385312 -0.869644244
## Area 0.14047404 0.0005027618 -0.0009642999 0.004811068
## Elevation -0.58073853 -0.0009642999 0.0028796966 -0.013196449
## Nearest -0.86964424 0.0048110685 -0.0131964495 1.111202600
## Scruz -1.39806717 -0.0001826696 0.0011454447 -0.142066647
## Adjacent 0.08587895 0.0001717816 -0.0006098372 0.005297104
## Scruz Adjacent
## (Intercept) -1.3980671735 0.0858789494
## Area -0.0001826696 0.0001717816
## Elevation 0.0011454447 -0.0006098372
## Nearest -0.1420666472 0.0052971041
## Scruz 0.0463981286 -0.0007281114
## Adjacent -0.0007281114 0.0003132967
Por tanto, el standard error de los estimadores, \(se(\hat \beta_i)\) será
## (Intercept) Area Elevation Nearest Scruz Adjacent
## 19.15419782 0.02242235 0.05366280 1.05413595 0.21540225 0.01770019
El valor de la t con n-k-1 = 30-5-1 = 24 grados de libertad es
## [1] 2.063899
El límite inferior (LI) y el límite superior de los intervalos será:
## (Intercept) Area Elevation Nearest Scruz Adjacent
## -32.4641006 -0.0702158 0.2087102 -2.1664857 -0.6850926 -0.1113362
## (Intercept) Area Elevation Nearest Scruz Adjacent
## 46.60054205 0.02233912 0.43021935 2.18477363 0.20404416 -0.03827344
Si lo juntamos todo en una tabla
## estimacion se LI LS
## (Intercept) 7.068220709 19.15419782 -32.4641006 46.60054205
## Area -0.023938338 0.02242235 -0.0702158 0.02233912
## Elevation 0.319464761 0.05366280 0.2087102 0.43021935
## Nearest 0.009143961 1.05413595 -2.1664857 2.18477363
## Scruz -0.240524230 0.21540225 -0.6850926 0.20404416
## Adjacent -0.074804832 0.01770019 -0.1113362 -0.03827344
Directamente, mediante la función confint() de R se pueden obtener dichos valores:
## 2.5 % 97.5 %
## (Intercept) -32.4641006 46.60054205
## Area -0.0702158 0.02233912
## Elevation 0.2087102 0.43021935
## Nearest -2.1664857 2.18477363
## Scruz -0.6850926 0.20404416
## Adjacent -0.1113362 -0.03827344
Si queremos otro nivel de confianza, por ejemplo, 90%:
## 5 % 95 %
## (Intercept) -25.70235310 39.83879452
## Area -0.06230034 0.01442366
## Elevation 0.22765403 0.41127549
## Nearest -1.79435834 1.81264627
## Scruz -0.60905208 0.12800362
## Adjacent -0.10508777 -0.04452190
## [1] 3717.974
Y su intervalo de confianza:
## [1] 2266.822 7195.410