| Llamadas | Ventas | \(x-\bar{x}\) | \(y-\bar{y}\) | \((x-\bar{x})^2\) | \((y-\bar{y})^2\) | \((x-\bar{x})(y-\bar{y})\) |
|---|---|---|---|---|---|---|
| 20 | 30 | -2 | -15 | 4 | 225 | 30 |
| 40 | 60 | 18 | 15 | 324 | 225 | 270 |
| 20 | 40 | -2 | -5 | 4 | 25 | 10 |
| 30 | 60 | 8 | 15 | 64 | 225 | 120 |
| 10 | 30 | -12 | -15 | 144 | 225 | 180 |
| 10 | 40 | -12 | -5 | 144 | 25 | 60 |
| 20 | 40 | -2 | -5 | 4 | 25 | 10 |
| 20 | 50 | -2 | 5 | 4 | 25 | -10 |
| 20 | 30 | -2 | -15 | 4 | 225 | 30 |
| 30 | 70 | 8 | 25 | 64 | 625 | 200 |
\(\bar{x}=\frac{1}{n}\sum_{i=1}^nx_i=\) 22
\(\bar{y}=\frac{1}{n}\sum_{i=1}^ny_i=\) 45
\[ SXX=\sum_{i=1}^n(x_i-\bar{x})^2= 760 \]
\[ SYY=\sum_{i=1}^n(y_i-\bar{y})^2= 1850 \]
\[ SXY=\sum_{i=1}^n(x_i-\bar{x})(x_i-\bar{y})= 900 \]
Pendiente \(\widehat{\beta}_1=\frac{SXY}{SXX}=\) 900 \(/\) 760 \(=\) 1.1842105
Intercepto \(\widehat{\beta}_0=\bar{y}-\widehat{\beta}_1\bar{x}=\) 18.9473684
Ecuación de la recta \(\hat{y}_i=\widehat{\beta}_0+\widehat{\beta}_1x_i=18.947+1.18x_i\)
Correlación entre las llamadas y las ventas \(r_{xy}=\frac{SXY}{\sqrt{SXX}\sqrt{SYY}}=\) 0.7590141
\(RSS=SYY-\frac{(SXY)^2}{SXX}=\) 784.2105263
\(SS_{REG}= SYY-RSS=\) 1065.7894737
| Origen | gl | SS | MS | F | Valor.p |
|---|---|---|---|---|---|
| Regresión | 1 | 1065.7895 | 1065.78947368421 | 10.8724832214765 | 0.0109019296658381 |
| Residual | 8 | 784.2105 | 98.0263157894737 | ||
| Total | 9 | 1850.0000 |
\[H_0=E(Y|X=x)=\beta_0\] \[H_a=E(Y|X=x)=\beta_0+\beta_1x\]
\(F_{crĆtico}=F_{(1-\alpha,1,n-2)}=F_{(0.95,1,8)}=\) 5.3176551
Se rechaza H0: la pendiente es estadĆsticamente significativa.
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-12.632 -5.395 -1.710 6.908 15.526
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 18.9474 8.4988 2.229 0.0563 .
x 1.1842 0.3591 3.297 0.0109 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9.901 on 8 degrees of freedom
Multiple R-squared: 0.5761, Adjusted R-squared: 0.5231
F-statistic: 10.87 on 1 and 8 DF, p-value: 0.0109
EstadĆsticos teóricos
\[ t_0 = \frac{\hat{\beta}_0}{\sqrt{\operatorname{Var}(\hat{\beta}_0)}} \]
\[ t_1 = \frac{\hat{\beta}_1}{\sqrt{\operatorname{Var}(\hat{\beta}_1)}} \]
\[ R^2 = \frac{SS_{Reg}}{SYY} \]
\[ t_1^2 = F \]
\[ t_{crĆtico} = t_{\alpha/2,\,n-2} \]
Sustituyendo valores del ejemplo
\[ t_0 = 2.2294 \]
\[ t_1 = 3.2973 \]
\[ R^2 = \frac{1065.789}{1850} = 0.5761 \]
\[ t_1^2 = 10.8725 \]
\[ F = 10.8725 \]
\[ t_{1,crĆtico} = 2.306 \]
Analysis of Variance Table
Response: y
Df Sum Sq Mean Sq F value Pr(>F)
x 1 1065.79 1065.79 10.873 0.0109 *
Residuals 8 784.21 98.03
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
| \(y_i\) | \(\hat{y}_i\) | LI Ajus | LS Ajus | LI Pred | LS Pred |
|---|---|---|---|---|---|
| 30 | 42.632 | 35.224 | 50.039 | 18.629 | 66.635 |
| 60 | 66.316 | 49.752 | 82.879 | 38.109 | 94.523 |
| 40 | 42.632 | 35.224 | 50.039 | 18.629 | 66.635 |
| 60 | 54.474 | 44.675 | 64.273 | 29.628 | 79.319 |
| 30 | 30.789 | 18.506 | 43.073 | 4.863 | 56.716 |
| 40 | 30.789 | 18.506 | 43.073 | 4.863 | 56.716 |
| 40 | 42.632 | 35.224 | 50.039 | 18.629 | 66.635 |
| 50 | 42.632 | 35.224 | 50.039 | 18.629 | 66.635 |
| 30 | 42.632 | 35.224 | 50.039 | 18.629 | 66.635 |
| 70 | 54.474 | 44.675 | 64.273 | 29.628 | 79.319 |
Intervalo de confianza
\[ \widehat{y} \pm t_{\alpha/2,\,n-2} \sqrt{ \widehat{\sigma}^2 \left( \frac{1}{n} + \frac{(x-\bar{x})^2}{SXX} \right) } \]
donde
\[ SXX = \sum_{i=1}^n (x_i-\bar{x})^2 \]
Intervalo de predicción para una nueva observación
\[ \widetilde{y}_{*} \pm 2\times F_{(1-\frac{\alpha}{2},\,2,\,n-2)} \sqrt{ \widehat{\sigma}^2 \left( 1 + \frac{1}{n} + \frac{(x_{*}-\bar{x})^2}{SXX} \right) } \]