Documentos de Académico
Documentos de Profesional
Documentos de Cultura
RLMEJMPLO
RLMEJMPLO
Antigedad X1 ( aos)
Horas de trabajo X2
(horas/da)
24.6
11
33.0
13
36.6
13
39.8
14
28.6
12
y = 0 + 1 x1 + 2 x2 +
Si desarrollamos esta ecuacin en odas las observaciones de la muestra,
obtenemos el sistema de siguiente:
y 1 = 0 + 1 1 + 2 11 + 1
y = + 3 + 13 +
1
2
2
2 0
y 3 = 0 + 1 4 + 2 13 + 3
y = + 4 + 14 +
0
1
2
4
4
y 5 = 0 + 1 2 + 2 12 + 5
Que podemos escribir matricialmente como
Y = X +
Donde:
24.6
1
33.0
1
Y = 36.0 X = 1
39.8
1
28.0
1
1 11
3 13
4 13
4 14
2 12
1
2
0
= 3
= 1
4
2
5
e = Y X
Para construir el modelo de ajuste se tiene que minimizar la suma de
cuadrados de los residuos.
n
i =1
i =1
2
Q( ) = ei2 = ( yi yi ) = eT e = (Y X )T ( Y X )
Q( ) = Y T Y T X T Y Y T X + T X T X
Q( ) = Y T Y 2 T X T Y + T X T X
Derivando Q con respecto a
ecuaciones normales
( X X ) = X
T
Resolviendo para
se obtiene:
1
T
= ( X X ) X TY
El vector
es el vector de los estimadores mnimos cuadrticos de los
parmetros del modelo.
( X X ) = X
T
se
n
n
x
i1
i =1
n
xi 2
i =1
n
xik
i=1
x
x
2
i1
i =1
x
i =1
n
i =1
i2
2
i2
i =1
n
i =1
ik i1
i1 i 2
i =1
n
i1 i 2
i1
i =1
n
i =1
n
xik xi1
i =1
n
xik xi 2
i =1
n
xik2
i =1
ik i 2
i =1
ik
0 e1
1 e2
= e3
2
e
k k
24.6
1
33.0
1
Y = 36.0 X = 1
39.8
1
28.0
1
1 11
3 13
4 13
4 14
2 12
1 1 1 1 1
X T = 1 3 4 4 2
11 13 13 14 12
Entonces,
1 1 1 1 1 1
X T X = 1 3 4 4 2 1
11 13 13 14 12 1
1
1 11
3 13 5 14 63
4 13 = 14 46 182
4 14 63 182 799
2 12
(X X )
T
5 14 63
= 14 46 182
63 182 799
181 .5 14 17.5
= 14
1.3
1.4
17.5 1.4 1.7
24.6
1 1 1 1 1 33.0 162.6
X T Y = 1 3 4 4 2 36.6 = 486.4
11 13 13 14 12 39.8 2075.8
28.6
As el vector de parmetros estimados de la regresin
= ( X T X )
y = 5 + 2.6 x1 + 2.4 x2
Interpretacin de los parmetros
1. Interpretacin de
2. Interpretacin de
0 = 5
Nos indica los gastos en miles de pesos de una computadora personal con cero
aos de antigedad y cero horas semanales de trabajo. Es evidente que en
este caso no tiene ningn sentido.
1 = 2.6
Nos indica el incremento de los gastos en miles de pesos por cada ao de
antigedad de una computadora personal, sin tener en cuenta el nmero de
horas diarias de uso. As pues, por cada ao que pase, tendremos 2,6 x 1.000
= 2600 computadora personal ms en los gastos de mantenimiento de una
computadora personal.
2 = 2.4
Nos indica el incremento en los gastos en miles de pesos por cada hora diaria
de uso sin tener en cuenta la antigedad de la computadora personal. Tenemos
que por cada hora de trabajo adicional, tendremos un incremento de 2,4 x 1.000
= 2.400 pesos en los gastos anuales de mantenimiento de una computadora
personal.
R2 =
R2 =
SCR
SCE
= 1
SCT
SCT
1 n
SCT
2
S =
(
y
y
)
=
i
n 1 i=1
n 1
2
y
1 n
SCR
2
S = ( yi y ) =
k i =1
k
2
y
n
n
1
1
SCE
2
S =
ei2 =
( yi yi ) =
n k 1 i =1
n k 1 i =1
n k 1
2
e
Donde
SCT = Suma de Cuadrados Totales
SCR = Suma de Cuadrados de la Regresin
SCE = Suma de Cuadrados de los residuos
Ya se demostr que:
y1 y
d1
y y
d
D = 2 = 2
d
y
y
n
n
SCT = ( yi y ) = D T D = [ y1 y
2
i =1
y1 y
y y
y2 y yn y ] 2
y
n
y1 1
y 1
2 =
y n 1
x11
x12
x21
x22
x1n
x2 n
0
xk 1
1
xk 2
2
xkn
w1 y1 y
w y y
w = 2 = 2
w
y
n n
de donde,
SCR= ( y i y ) = wT w = [ y1 y
2
i =1
y1 y
y y
y 2 y y n y ] 2
e1 y1 y1
e y y
2
e = 2 = 2
e
y
y
n
n n
de donde,
SCE = ( yi y i ) = eT e = [ y1 y1
2
i =1
y2 y2
y1 y1
y y
2
yn y n ] 2
y
y
n
n
SCT = ( yi y )
i =1
7.92
0.48
7
.
28
3.98
y1
1
y
1
2
y3 = X = 1
y
4
1
y5
1
1
3
4
4
2
11
24
13 5 34
13 2.6 = 36.6
14 2.4 39
29
12
10
SCR= ( y i y )
i =1
8.52
1.48
6
.
48
3.52
La diferencia entre los valores observados y los valores estimados nos permite
obtener los residuos:
e1 y1 y1 24.6 24 0.6
e y y 33 34 1
2
2 2
e = e3 = y3 y3 = 36.6 36.6 = 0
e
y
y
39.8
39
0.8
4
4
4
e5 y5 y5 28.6 29 0.4
Por lo tanto
2
SCE = ( yi y i )
i =1
0.6
1
0
.
8
0.4
11
SCR 145.81
R =
=
= 0.985
SCT 147.97
SCE
2.16
R2 = 1
= 1
= 1 0.015 = 0.985
SCT
147.97
2
Este resultado nos dice que el modelo de regresin mltiple obtenido explica el
98,5% de la variabilidad de los gastos de las computadoras personales. Dado
que est muy cerca del 100%, por el momento se puede considerar como un
buen modelo.
El coeficiente de determinacin ajustado
El coeficiente de determinacin ajustado, R 2 , se define de la siguiente forma
R2 = 1
SCE / ( n k 1)
SCT / ( n 1)
Esta medida se utiliza para tener en cuenta el hecho de que las variables
independientes irrelevantes provocan una pequea reduccin en la suma de
los cuadrados de los residuos. Por lo tanto, el R 2 permite comparar de mejor
manera los modelos de regresin lineal mltiple que tiene diferentes nmeros
de variables independientes
El R 2 para el ejemplo ser entonces:
R2 = 1
SCE / ( n k 1)
2.16 / 2
= 1
= 0,970804
SCT / ( n 1)
147.97 / 4
12
13
F=
SCR / k
SCE /(n k 1)
Si la hiptesis nula es cierta y, por tanto, no existe ningn tipo de relacin lineal
entre Y y las variables Xi, el estadstico tendr un valor cercano a uno. Pero
cuando existe cierta relacin, la suma de los cuadrados de la regresin
(numerador) aumenta y la suma de los cuadrados de los errores (denominador)
disminuye, de manera que el valor del estadstico de contraste aumenta. Si
este valor supera un valor crtico de la distribucin F, entonces rechazamos la
hiptesis nula.
Establecemos un criterio de decisin a partir de un nivel de significacin :
A partir de este valor crtico de la distribucin F de Snedecor:
Si
F > F; k; n-k-1, rechazamos H0; por tanto, el modelo explica
significativamente la variable Y. Es decir, el modelo s que contribuye con
informacin a explicar la variable Y.
Si F < F; k; n-k-1, no rechazamos H0; por tanto, el modelo no explica de forma
significativa la variable Y.
Tambin podemos hacerlo a partir del p-valor: p = P(F; k; n-k-1 > f ).
Si p , se rechaza la hiptesis nula H0.
Si p > , no se rechaza la hiptesis nula H0.
Los clculos necesarios se pueden resumir en la tabla siguiente, conocida
como TABLA DE ANLISIS DE VARAINZA
Fuente de Suma de
Variacin cuadrados
Grados
de
libertad
Cuadrados medios
x1,x2,.xk
SCR
CMR=SCR/k
SCE
n-k-1
CME=SCE/(n - k - 1)
SCT
n-1
Estadstico
de prueba
CMR/CME
14
Cuadrados medios
72,955
1,08
Estadstico
de prueba
67,5509259
15
se2 =
n
1
SCE
2
( yi yi ) =
n k 1 i =1
n k 1
( )
E j = j
( )
2 diag ( X T X )
var 0
16
( )
var 1
var k
( )
j N j , qij
se2 =
n
1
SCE
2
( yi yi ) =
n k 1 i =1
n k 1
De manera que:
( )
se2 diag ( X T X )
var 0
var k
( )
var 1
( )
( )
s = var j , para
j
17
j = 1,2,...,k
(X X )
T
181.5 14 17.5
= 14
1.3 1.4
17.5 1.4 1.7
y = 5 + 2.6 x1 + 2.4 x 2
Adems
se2 =
SCE
2.16
=
= 1.08
n k 1
2
De esta manera:
( )
( )
( )
j j
s
18
j j
t / 2 ,n k 1 = 1
P t / 2 ,n k 1
s
j
j t / 2 ,n k 1 s
donde
Para el ejemplo:
19
j :
0.
t=
j
s
Contraste para 1
1. Establecemos las hiptesis nula y alternativa:
20
t=
1
s
2.6
= 2.20
1.18
t=
2
s
2.3
= 1.77
1.35
21
observed
40
36
32
28
24
24
28
32
36
40
predicted
Residual Plot
1
residual
0.6
0.2
-0.2
-0.6
-1
1
1.5
2.5
X1
22
3.5
Residual Plot
1
residual
0.6
0.2
-0.2
-0.6
-1
11
11.5
12
12.5
13
13.5
14
X2
23
The StatAdvisor
--------------The output shows the results of fitting a multiple linear
regression model to describe the relationship between Y and 2
independent variables. The equation of the fitted model is
Y = -5.0 + 2.6*X1 + 2.4*X2
Since the P-value in the ANOVA table is less than 0.05, there is a
statistically significant relationship between the variables at the
95% confidence level.
The R-Squared statistic indicates that the model as fitted
explains 98.5402% of the variability in Y. The adjusted R-squared
statistic, which is more suitable for comparing models with different
numbers of independent variables, is 97.0804%. The standard error of
the estimate shows the standard deviation of the residuals to be
1.03923. This value can be used to construct prediction limits for
new observations by selecting the Reports option from the text menu.
The mean absolute error (MAE) of 0.56 is the average value of the
residuals. The Durbin-Watson (DW) statistic tests the residuals to
determine if there is any significant correlation based on the order
in which they occur in your data file. Since the P-value is greater
than 0.05, there is no indication of serial autocorrelation in the
residuals.
In determining whether the model can be simplified, notice that the
highest P-value on the independent variables is 0.2185, belonging to
X2. Since the P-value is greater or equal to 0.10, that term is not
statistically significant at the 90% or higher confidence level.
Consequently, you should consider removing X2 from the model.
component effect
1.5
2.5
3.5
X1
95.0% confidence intervals for coefficient estimates
----------------------------------------------------------------------------Standard
Parameter
Estimate
Error
Lower Limit
Upper Limit
----------------------------------------------------------------------------CONSTANT
-5.0
14.0007
-65.2402
55.2402
X1
2.6
1.18491
-2.49823
7.69823
X2
2.4
1.35499
-3.43005
8.23005
-----------------------------------------------------------------------------
The StatAdvisor
--------------This table shows 95.0% confidence intervals for the coefficients in
24
Plot of Y
observed
40
36
32
28
24
24
28
32
36
40
predicted
Correlation matrix for coefficient estimates
----------------------------------------------------------------------------CONSTANT
X1
X2
CONSTANT
1.0000
0.9114
-0.9963
X1
0.9114
1.0000
-0.9417
X2
-0.9963
-0.9417
1.0000
-----------------------------------------------------------------------------
The StatAdvisor
--------------This table shows estimated correlations between the coefficients in
the fitted model. These correlations can be used to detect the
presence of serious multicollinearity, i.e., correlation amongst the
predictor variables. In this case, there is 1 correlation with
absolute value greater than 0.5 (not including the constant term).
Residual Plot
1
residual
0.6
0.2
-0.2
-0.6
-1
1
1.5
2.5
3.5
X1
Residual Plot
1
residual
0.6
0.2
-0.2
-0.6
-1
11
11.5
12
12.5
X2
25
13
13.5
14
Residual Plot
1
residual
0.6
0.2
-0.2
-0.6
-1
24
28
32
36
40
predicted Y
Residual Plot
Studentized residual
(X 1.E9)
1
0.6
0.2
-0.2
-0.6
-1
0
row number
Plot of Y with Predicted Values
40
36
32
28
24
1
1.5
2.5
X1
26
3.5