Análisis de Regresión y Correlación con MINITAB - Tecnun
Análisis de Regresión y Correlación con MINITAB - Tecnun
Análisis de Regresión y Correlación con MINITAB - Tecnun
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Análisis</strong> <strong>de</strong> <strong>Regresión</strong> y <strong>Correlación</strong><br />
<strong>con</strong> <strong>MINITAB</strong><br />
Primeras <strong>de</strong>finiciones y <strong>con</strong>ceptos <strong>de</strong> la<br />
regresión<br />
El análisis <strong>de</strong> la regresión es una técnica estadística que se utiliza<br />
para estudiar la relación entre variables o factores cuantitativos<br />
referidos a un mismo grupo <strong>de</strong> unida<strong>de</strong>s observadas.<br />
Se trata <strong>de</strong> comprobar estadísticamente si tal relación es posible,<br />
y <strong>de</strong> serlo, expresarlo matemáticamente mediante una ecuación.<br />
Su uso más frecuente es el <strong>de</strong> la predicción <strong>de</strong> resultados <strong>de</strong> una<br />
<strong>de</strong> ellas para valores fijos <strong>de</strong> las otras.
Primeras <strong>de</strong>finiciones y <strong>con</strong>ceptos <strong>de</strong> la<br />
regresión<br />
Cuando se cree que algunas <strong>de</strong> las variables pue<strong>de</strong>n causar ( o al<br />
menos explicar) los cambios observados en otra, a éstas se les llama<br />
variables explicativas (X’s)<br />
La que mi<strong>de</strong> el resultado <strong>de</strong>l estudio se le llama variable respuesta<br />
(Y)<br />
Se intentará establecer una ecuación <strong>de</strong> la forma Y=g(x)<br />
Metodología <strong>de</strong> un análisis <strong>de</strong> regresión<br />
1. Representar los datos en un gráfico<br />
2. I<strong>de</strong>ntificar su aspecto y sus <strong>de</strong>sviaciones<br />
3. Descripciones numéricas que informen sobre los datos y su<br />
posible relación<br />
4. Descripción matemática resumida <strong>de</strong>l aspecto general <strong>de</strong>l<br />
problema
1. Representación <strong>de</strong> los datos<br />
La manera <strong>de</strong> mostrar gráficamente los datos observados en un<br />
gráfico es a través <strong>de</strong> un diagrama <strong>de</strong> dispersión.<br />
Y, la respuesta se marca en el eje vertical; la X, variable<br />
explicativa, en el eje horizontal. Cada observación, es un punto<br />
<strong>de</strong>l gráfico<br />
2. I<strong>de</strong>ntificación <strong>de</strong>l aspecto <strong>de</strong>l diagrama<br />
<strong>de</strong> dispersión<br />
El aspecto general <strong>de</strong>l gráfico viene dado por la dirección,<br />
forma y fuerza <strong>de</strong>l mismo:<br />
Dirección: positiva o negativa<br />
Forma: disposición <strong>de</strong> los puntos (rectilínea o curvilínea)<br />
Fuerza: cuanta más amorfa sea la disposición <strong>de</strong> los puntos<br />
en el gráfico, menor su relación
2. I<strong>de</strong>ntificación <strong>de</strong>l aspecto <strong>de</strong>l diagrama<br />
<strong>de</strong> dispersión<br />
Es interesante en esta primera i<strong>de</strong>ntificación <strong>de</strong>l aspecto<br />
<strong>de</strong>l gráfico, i<strong>de</strong>ntificar observaciones atípicas (aquellas que<br />
se distinguen <strong>de</strong>l aspecto general <strong>de</strong>l gráfico)<br />
El diagrama <strong>de</strong> dispersión sólo muestra el aspecto general<br />
<strong>de</strong> la relación entre las dos variables.<br />
En situaciones no muy evi<strong>de</strong>ntes, un simple cambio <strong>de</strong><br />
escala pue<strong>de</strong> hacernos cambiar la forma <strong>de</strong> pensar.<br />
2. I<strong>de</strong>ntificación <strong>de</strong>l aspecto <strong>de</strong>l diagrama<br />
<strong>de</strong> dispersión<br />
Tiempo<br />
450<br />
400<br />
350<br />
300<br />
30<br />
32<br />
Scatterplot of Tiempo vs Edad<br />
34<br />
36<br />
38 40<br />
Edad<br />
42<br />
44<br />
46<br />
48
3. Descripciones numéricas<br />
Se necesita una medida numérica que complemente al gráfico y<br />
que, in<strong>de</strong>pendientemente <strong>de</strong> las dimensiones <strong>de</strong> los valores <strong>de</strong> las<br />
variables, nos informe sobre la fuerza <strong>de</strong> la relación existente.<br />
Una medida es el Coeficiente <strong>de</strong> correlación<br />
Características <strong>de</strong>l coeficiente <strong>de</strong> correlación<br />
<strong>de</strong> Pearson<br />
r utiliza valores estandarizados, luego no le influyen las unida<strong>de</strong>s:<br />
tomaría el mismo valor aunque se cambiara <strong>de</strong> unidad <strong>de</strong> medida.<br />
r se ve afectada por las observaciones atípicas<br />
Una r positiva (negativa)indica una relación positiva (negativa)<br />
entre las variables.<br />
Valores <strong>de</strong> r cercanos al 0 indican una relación lineal muy débil.<br />
La fuerza <strong>de</strong> la relación lineal aumenta a medida que r se aleja <strong>de</strong>l<br />
0 y se acerca al +1 o al –1.
95<br />
90<br />
85<br />
80<br />
75<br />
Ejemplos reales<br />
150<br />
Situación 1 Situación 2 Situación 3<br />
160<br />
170<br />
Temperatura<br />
180<br />
95<br />
90<br />
85<br />
80<br />
75<br />
150 160 170 180<br />
Temperatura<br />
95<br />
90<br />
85<br />
80<br />
75<br />
150 160 170 180<br />
Temperatura<br />
r = 0,983 r = 0,887 r = 0,230<br />
p-value: 0,000 p-value: 0,000 p-value: 0,108<br />
Un valor <strong>de</strong> r distinto <strong>de</strong> 0 no implica relación lineal<br />
Es necesario que sea “significativamente distinto <strong>de</strong> cero”<br />
Coeficiente <strong>de</strong> correlación: Precaución<br />
El coeficiente <strong>de</strong> correlación <strong>de</strong> Pearson sólo mi<strong>de</strong> relación LINEAL<br />
200<br />
100<br />
0<br />
0 10 20 30<br />
r = 0,5 pero ...<br />
Relación casi perfecta,<br />
aunque no lineal.
4. Descripción matemática <strong>de</strong> la forma <strong>de</strong>l<br />
gráfico<br />
Si la correlación entre las dos variables indica una relación fuerte,<br />
sería muy interesante po<strong>de</strong>r “resumir” el gráfico en forma <strong>de</strong> una<br />
ecuación matemática.<br />
En el caso <strong>de</strong> una forma lineal, a la recta que ajusta la nube <strong>de</strong><br />
puntos se le llama recta <strong>de</strong> regresión.<br />
Esta recta se calcula teniendo en cuenta dos cosas:<br />
Puesto que <strong>de</strong>scribe un cambio en la respuesta a medida que<br />
cambia la otra variable, se necesita tener presente esta<br />
distinción a la hora <strong>de</strong> calcularla.<br />
Puesto que ninguna recta pue<strong>de</strong> pasar exactamente por todos<br />
los puntos, se necesita una manera <strong>de</strong> <strong>con</strong>struirla que asegure<br />
su paso tan cerca <strong>de</strong> todos los puntos como sea posible.<br />
4. Descripción matemática <strong>de</strong> la forma <strong>de</strong>l<br />
gráfico<br />
Tiempo<br />
450<br />
400<br />
350<br />
300<br />
250<br />
30<br />
32<br />
34<br />
Fitted Line Plot<br />
Tiempo = - 1550 + 95,80 Edad<br />
- 1,193 Edad**2<br />
36<br />
38 40<br />
Edad<br />
42<br />
44<br />
46<br />
48<br />
S 38,3533<br />
R-Sq 37,1%<br />
R-Sq(adj) 35,0%
Mo<strong>de</strong>lo <strong>de</strong> regresión simple<br />
Mo<strong>de</strong>lo teórico para la población:<br />
y = β0 + β1x + ε<br />
ε ~N (0, σ)<br />
Y<br />
yˆ = b0<br />
+ b1x<br />
Recta ajustada:<br />
(a partir <strong>de</strong> una muestra)<br />
r ⋅s<br />
yˆ = y +<br />
s<br />
x<br />
y<br />
( x − x)<br />
Mo<strong>de</strong>lo <strong>de</strong> regresión simple<br />
distancia entre lo real y lo que se predice<br />
x i<br />
yˆ i<br />
predicción <strong>de</strong> la recta<br />
y i observado<br />
La pendiente <strong>de</strong> la recta , b1 , representa la tasa <strong>de</strong> cambio, es<br />
<strong>de</strong>cir, la cantidad en que cambia yˆ cuando x aumenta en una<br />
unidad.<br />
y<br />
b 0<br />
1<br />
b 1<br />
yˆ = b0<br />
+ b1x<br />
x<br />
r ⋅ s<br />
b1<br />
=<br />
s<br />
x<br />
y<br />
X
Mo<strong>de</strong>lo <strong>de</strong> regresión simple<br />
r 2 , representa la fracción <strong>de</strong> la variación <strong>de</strong> Y que se explica<br />
por la regresión <strong>de</strong> Y sobre X y sirve <strong>de</strong> medida <strong>de</strong> bondad<br />
<strong>de</strong> la regresión para explicar la respuesta.<br />
La parte <strong>de</strong> la variable Y que no es explicada por el mo<strong>de</strong>lo<br />
se llama residual.<br />
Una vez dibujada la recta <strong>de</strong> regresión, existe un valor<br />
residual para cada dato: e = y − yˆ<br />
Mo<strong>de</strong>lo <strong>de</strong> regresión simple<br />
e = y − yˆ<br />
i<br />
i<br />
e i<br />
i
<strong>Análisis</strong> <strong>de</strong> los residuos<br />
La disposición <strong>de</strong> los residuos sirve para comprobar si la<br />
recta sirve para ajustar los datos<br />
Dibujando sus valores en el eje <strong>de</strong> or<strong>de</strong>nadas frente a las<br />
predicciones <strong>de</strong>ben presentar una forma uniforme ,<br />
centrada en el valor 0, a lo largo <strong>de</strong> toda la recta, sin que<br />
aparezca ningun valor extraño<br />
Inferencia para la regresión lineal<br />
Rendi2<br />
95<br />
85<br />
75<br />
Regression Plot<br />
Rendi2 = 10,2163 + 0,447563 Temperatura<br />
S = 2,01711 R-Sq = 78,6 % R-Sq(adj) = 78,2 %<br />
150 160 170 180<br />
Temperatura<br />
Intervalo para las predicciones<br />
Intervalo para la recta<br />
Regression<br />
95% CI<br />
95% PI
<strong>Regresión</strong> no lineal<br />
La relación entre x e y no tiene porqué ser lineal.<br />
Los softwares informáticos ajustan los datos a curvas no lineales<br />
(exponenciales, parabólicas, etc.) y calculan el valor <strong>de</strong> r 2 para<br />
medir la fuerza <strong>de</strong> esa relación.<br />
Tiempo<br />
450<br />
400<br />
350<br />
300<br />
250<br />
30<br />
<strong>Regresión</strong> múltiple<br />
32<br />
34<br />
Fitted Line Plot<br />
Tiempo = - 1550 + 95,80 Edad<br />
- 1,193 Edad**2<br />
36<br />
38 40<br />
Edad<br />
42<br />
44<br />
46<br />
48<br />
S 38,3533<br />
R-Sq 37,1%<br />
R-Sq(adj) 35,0%<br />
La regresión múltiple expresa el valor <strong>de</strong> la variable <strong>de</strong>pendiente<br />
Y, como función <strong>de</strong> las variables in<strong>de</strong>pendientes X 1 , X 2 , ...,X k<br />
La más simple es la regresión lineal y el mo<strong>de</strong>lo al que se<br />
<strong>de</strong>bieran ajustar los datos es:<br />
Y =<br />
α + β X + β X + ... + + β X + ε<br />
i<br />
1<br />
1i<br />
2<br />
2i<br />
k<br />
ki<br />
i
<strong>Regresión</strong> múltiple<br />
Comprobar si el rendimiento <strong>de</strong> un proceso químico <strong>de</strong>pen<strong>de</strong>,<br />
a<strong>de</strong>más <strong>de</strong> la temperatura <strong>de</strong> la presión a la que se realiza.<br />
<strong>Regresión</strong> múltiple lineal: Interpretación <strong>de</strong><br />
resultados<br />
Regression Analysis: Rendi versus<br />
Presion; Temperatura<br />
The regression equation is<br />
Rendi = 48,9 + 1,84 Presion + 0,208 Temperatura<br />
Predictor Coef SE Coef T P<br />
Constant 48,941 2,709 18,07 0,000<br />
Presion 1,8437 0,4699 3,92 0,001<br />
Temperat 0,20807 0,01562 13,32 0,000<br />
S = 0,7947 R-Sq = 90,8% R-Sq(adj) = 89,9%<br />
Desviación tipo <strong>de</strong> los residuos<br />
yˆ ± 2s<br />
Media <strong>de</strong> calidad <strong>de</strong>l ajuste<br />
Pruebas <strong>de</strong> significación<br />
para los coeficientes
<strong>Regresión</strong> múltiple lineal: Interpretación <strong>de</strong><br />
resultados<br />
Coeficiente <strong>de</strong> correlación múltiple<br />
R<br />
2<br />
= r<br />
2<br />
∑( yi<br />
− yˆ i )<br />
= 1−<br />
( y − y )<br />
∑<br />
El r 2 proporciona, al igual que en el caso simple, una<br />
medida <strong>de</strong> la fuerza <strong>de</strong> la relación entre Y y sus<br />
predicciones, a partir <strong>de</strong>l mo<strong>de</strong>lo <strong>de</strong> regresión propuesto<br />
(plano <strong>de</strong> regresión)<br />
Se pue<strong>de</strong>n <strong>de</strong>finir también, coeficientes <strong>de</strong> correlación<br />
parciales, r YXi , mi<strong>de</strong>n la relación entre Y y X i eliminando los<br />
efectos <strong>de</strong>l resto <strong>de</strong> X j<br />
<strong>Regresión</strong> múltiple lineal: Inferencias<br />
Al igual que en el caso simple, pue<strong>de</strong>n calcularse intervalos <strong>de</strong><br />
<strong>con</strong>fianza para los coeficientes <strong>de</strong>l plano<br />
i<br />
También al igual que en el caso simple, será necesaria la<br />
comprobación <strong>de</strong> la a<strong>de</strong>cuidad <strong>de</strong>l mo<strong>de</strong>lo <strong>con</strong> el análisis y<br />
estudio <strong>de</strong> sus residuos: éstos <strong>de</strong>ben <strong>de</strong> ser normales, centrados<br />
en 0 y <strong>con</strong> variabilidad <strong>con</strong>stante.<br />
i<br />
2<br />
2
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Deducir una ecuación que relacione el tiempo marcado por una<br />
atleta (en minutos) en una carrera <strong>de</strong> triatlón <strong>con</strong> los siguientes<br />
posibles factores:<br />
Edad <strong>de</strong>l <strong>de</strong>portista<br />
Peso <strong>de</strong>l <strong>de</strong>portista<br />
Experiencia en la práctica <strong>de</strong>l triatlón, en años<br />
Kilómetros en carrera en entrenamientos<br />
Kilómetros en bicicleta en entrenamientos<br />
Kilómetros nadadndo en entrenamientos<br />
Consumo <strong>de</strong> oxígeno corriendo<br />
Consumo <strong>de</strong> oxígeno en bicicleta<br />
Cosumo <strong>de</strong> oxígeno nadando<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong>
Tiempo<br />
Tiempo<br />
450<br />
400<br />
350<br />
300<br />
450<br />
400<br />
350<br />
300<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Para la <strong>Regresión</strong> Simple: Stat/Regression/Fitted Line Plot<br />
30<br />
250<br />
30<br />
32<br />
32<br />
34<br />
34<br />
Fitted Line Plot<br />
Tiempo = 205,2 + 3,585 Edad<br />
36<br />
36<br />
38 40<br />
Edad<br />
38 40<br />
Edad<br />
42<br />
42<br />
44<br />
Fitted Line Plot<br />
Tiempo = - 1550 + 95,80 Edad<br />
- 1,193 Edad**2<br />
44<br />
46<br />
46<br />
48<br />
48<br />
S 44,7224<br />
R-Sq 13,0%<br />
R-Sq(adj) 11,7%<br />
S 38,3533<br />
R-Sq 37,1%<br />
R-Sq(adj) 35,0%<br />
Percent<br />
Frequency<br />
Percent<br />
Frequency<br />
Residual Plots for Tiempo<br />
Normal Probability Plot of the Residuals Residuals Versus the Fitted Values<br />
99,9<br />
99<br />
90<br />
50<br />
10<br />
1<br />
0,1<br />
16<br />
12<br />
8<br />
4<br />
0<br />
-80<br />
-100<br />
-40<br />
0<br />
Residual<br />
0 40<br />
Residual<br />
100<br />
80<br />
Residual<br />
Residual<br />
100<br />
50<br />
0<br />
-50<br />
-100<br />
100<br />
50<br />
0<br />
-50<br />
320<br />
340 360<br />
Fitted Value<br />
Histogram of the Residuals Residuals Versus the Or<strong>de</strong>r of the Data<br />
99,9<br />
99<br />
90<br />
50<br />
10<br />
1<br />
0,1<br />
-100 -50 0 50<br />
Residual<br />
16<br />
12<br />
8<br />
4<br />
Residual Plots for Tiempo<br />
100<br />
0<br />
-40 -20 0 20 40 60 80 100<br />
Residual<br />
Residual<br />
Residual<br />
380<br />
-100<br />
1 5 10 15 20 25 30 35 40 45 50 55 60 65<br />
Observation Or<strong>de</strong>r<br />
Normal Probability Plot of the Residuals Residuals Versus the Fitted Values<br />
100<br />
50<br />
0<br />
-50<br />
100<br />
50<br />
0<br />
280<br />
300 320 340<br />
Fitted Value<br />
Histogram of the Residuals Residuals Versus the Or<strong>de</strong>r of the Data<br />
360<br />
-50<br />
1 5 10 15 20 25 30 35 40 45 50 55 60 65<br />
Observation Or<strong>de</strong>r
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Lo más habitual en la práctica es querer establecer una relación<br />
entre una variable respuesta (Y) y varias explicativas (X’s)<br />
Para la <strong>Regresión</strong> Múltiple, existen varias opciones:<br />
Stat/Regression/Regression<br />
Stat/Regression/Best Subsets<br />
Stat/Regression/Stepwise<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Ejemplo <strong>con</strong> la opción Stat/Regression/Regression<br />
Regression Analysis: Tiempo versus Edad; Peso; ...<br />
The regression equation is<br />
Tiempo = 486 + 3,41 Edad + 0,347 Peso - 21,4 Experiencia + 0,702 EnCarrera<br />
- 0,173 EnBici - 1,37 EnNatacion - 3,36 COCarrera - 1,38 COBici<br />
+ 0,893 CONatacion<br />
Predictor Coef SE Coef T P<br />
Constant 486,3 114,5 4,25 0,000<br />
Edad 3,410 1,091 3,13 0,003<br />
Peso 0,3470 0,7862 0,44 0,661<br />
Experien -21,424 3,697 -5,80 0,000<br />
EnCarrer 0,7025 0,2771 2,54 0,014<br />
EnBici -0,17251 0,06920 -2,49 0,016<br />
EnNataci -1,3727 0,9566 -1,43 0,157<br />
COCarrer -3,3550 0,8338 -4,02 0,000<br />
COBici -1,3845 0,9098 -1,52 0,134<br />
CONataci 0,8934 0,9217 0,97 0,337<br />
S = 22,70 R-Sq = 80,4% R-Sq(adj) = 77,2%<br />
Analysis of Variance<br />
Source DF SS MS F P<br />
Regression 9 116566 12952 25,14 0,000<br />
Residual Error 55 28339 515<br />
Total 64 144905<br />
Unusual Observations<br />
Obs Edad Tiempo Fit SE Fit Residual St Resid<br />
19 36,0 408,00 359,05 10,03 48,95 2,40R<br />
32 37,0 407,00 364,39 10,96 42,61 2,14R<br />
36 37,0 325,00 367,72 8,39 -42,72 -2,03R<br />
R <strong>de</strong>notes an observation with a large standardized residual<br />
Bondad <strong>de</strong>l ajuste<br />
¡¡Cuidado!!<br />
Linealidad significativa
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Realizar un análisis <strong>de</strong> regresión multivariante tiene el siguiente<br />
in<strong>con</strong>veniente: si dos variables X están muy relacionadas entre sí<br />
y aportan mucho a la hora <strong>de</strong> <strong>con</strong>ocer Y, una <strong>de</strong> ellas tendrá un pvalor<br />
gran<strong>de</strong> y la otra no. Pero, <strong>de</strong> eliminar una ¿cuál<br />
eliminaríamos? Una la <strong>con</strong>ozco, pero no sé <strong>con</strong> cual está<br />
correlacionada....<br />
Posibilida<strong>de</strong>s:<br />
Representar gráficamente las relaciones: Gráfico matriz<br />
Calcular los coeficientes <strong>de</strong> correlación entre las variables<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong>
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Matrix Plot of Tiempo; Edad; Peso; Experiencia; EnCarrera; EnBici; ...<br />
Tiempo<br />
32 40 4860<br />
70 80 0,0 2,5 5,0 30 60 90 150 300 4500<br />
10 20 50 60 70 50 60 70 40 50 60<br />
Edad<br />
Peso<br />
Experiencia<br />
EnCarrera<br />
EnBici<br />
EnNatación<br />
CoCarrera<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
CoBici<br />
CoNatación<br />
420<br />
360<br />
300<br />
48<br />
40<br />
32<br />
80<br />
70<br />
60<br />
5,0<br />
2,5<br />
0,0<br />
90<br />
60<br />
30<br />
450<br />
300<br />
150<br />
20<br />
10<br />
0<br />
70<br />
60<br />
50<br />
70<br />
60<br />
50
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Correlations: Tiempo; Edad; Peso; Experiencia; EnCarrera; EnBici; EnNatación; Co<br />
Tiempo Edad Peso Experien EnCarrer EnBici EnNataci CoCarrer CoBici<br />
Edad 0,361<br />
Peso 0,249 0,342<br />
Experien -0,436 0,414 0,254<br />
EnCarrer -0,469 -0,288 -0,090 0,349<br />
EnBici -0,492 -0,356 -0,091 0,137 0,792<br />
EnNataci -0,430 -0,419 0,132 -0,005 0,479 0,691<br />
CoCarrer -0,695 -0,306 -0,506 0,183 0,255 0,147 0,160<br />
CoBici -0,647 -0,441 -0,474 0,146 0,376 0,323 0,090 0,695<br />
CoNataci -0,596 -0,635 -0,340 0,134 0,478 0,415 0,380 0,548 0,652<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Cuando existen muchas variables X que pue<strong>de</strong>n influir en la<br />
respuesta Y, estas opciones pue<strong>de</strong>n resultar complicadas <strong>de</strong><br />
interpretar.<br />
¿Cómo resuelve este problema <strong>MINITAB</strong>?<br />
Stepwise:crea un mo<strong>de</strong>lo paso a paso, eligiendo primero la variable X<br />
que mejor explica la Y, añadiendo <strong>de</strong>spués una a una, otras X que<br />
junto <strong>con</strong> las anteriores aporten información. Para, cuando no<br />
encuentra ninguna más <strong>de</strong> las que quedan fuera que añada<br />
información<br />
Best Subsets: Crea sub<strong>con</strong>juntos <strong>de</strong> n variables X que mejor explican<br />
Y
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Step 1 2 3 4 5<br />
Constant 687,9 709,7 704,1 532,8 516,1<br />
CoCarrer -5,68 -5,20 -4,82 -3,96 -4,09<br />
T-Value -7,67 -8,24 -8,37 -6,81 -7,45<br />
P-Value 0,000 0,000 0,000 0,000 0,000<br />
EnBici -0,203 -0,187 -0,128 -0,242<br />
T-Value -5,15 -5,24 -3,51 -4,69<br />
P-Value 0,000 0,000 0,001 0,000<br />
Experien -10,7 -16,9 -20,8<br />
T-Value -3,94 -5,56 -6,61<br />
P-Value 0,000 0,000 0,000<br />
Edad 3,03 3,53<br />
T-Value 3,56 4,32<br />
P-Value 0,001 0,000<br />
EnCarrer 0,80<br />
T-Value 2,96<br />
P-Value 0,004<br />
S 34,5 29,1 26,2 24,0 22,6<br />
R-Sq 48,31 63,82 71,15 76,17 79,25<br />
R-Sq(adj) 47,49 62,65 69,73 74,59 77,50<br />
C-p 84,4 42,8 24,1 12,0 5,3
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Response is Tiempo<br />
E E E C C<br />
x n n o o<br />
p C E N C C N<br />
e a n a a o a<br />
E P r r B t r B t<br />
d e i r i a r i a<br />
a s e e c c e c c<br />
Vars R-Sq R-Sq(adj) C-p S d o n r i i r i i<br />
1 48,3 47,5 84,4 34,482 X<br />
1 41,8 40,9 102,6 36,578 X<br />
2 63,8 62,6 42,8 29,081 X X<br />
2 58,8 57,4 57,0 31,050 X X<br />
3 71,3 69,9 23,8 26,117 X X X<br />
3 71,2 69,7 24,1 26,177 X X X<br />
4 76,2 74,6 12,0 23,987 X X X X<br />
4 75,1 73,5 14,9 24,500 X X X X<br />
5 79,3 77,5 5,3 22,573 X X X X X<br />
5 76,9 75,0 11,9 23,801 X X X X X<br />
6 79,5 77,4 6,7 22,631 X X X X X X<br />
6 79,5 77,3 6,8 22,651 X X X X X X<br />
7 80,1 77,6 7,0 22,506 X X X X X X X<br />
7 79,7 77,2 8,1 22,721 X X X X X X X<br />
8 80,4 77,6 8,2 22,535 X X X X X X X X<br />
8 80,1 77,3 8,9 22,687 X X X X X X X X<br />
9 80,4 77,2 10,0 22,699 X X X X X X X X X
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
<strong>Regresión</strong>-Stepwise: crea un mo<strong>de</strong>lo paso a paso, eligiendo<br />
primero la variable X que mejor explica la Y, añadiendo <strong>de</strong>spués<br />
una a una, otras X que junto <strong>con</strong> las anteriores aporten<br />
información. Para cuando no encuentra ninguna más, <strong>de</strong> las que<br />
quedan fuera que añada información<br />
In<strong>con</strong>veniente:<br />
el mo<strong>de</strong>lo es muy <strong>de</strong>pendiente <strong>de</strong> la primera elegida (la que más<br />
información aporta por si sola, pero pue<strong>de</strong> no ser la mejor para<br />
trabajar <strong>con</strong> ella)<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
<strong>Regresión</strong> Best Subsets: Crea sub<strong>con</strong>juntos <strong>de</strong> n variables X que<br />
mejor explican Y<br />
In<strong>con</strong>venientes:<br />
No dice cual es la mejor opción, luego hay que <strong>de</strong>cidirse.<br />
Su lista se basa en el valor R2 , luego habrá que comprobar si las variables<br />
<strong>de</strong>l mo<strong>de</strong>lo son significativas
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Si elegimos el mo<strong>de</strong>lo <strong>con</strong> 5 variables (R 2 =77,5%) y hacemos<br />
regresión multivariante:<br />
The regression equation is<br />
Tiempo = 516 + 3,53 Edad - 20,8 Experiencia + 0,796 EnCarrera - 0,242 EnBici<br />
- 4,09 CoCarrera<br />
Predictor Coef SE Coef T P<br />
Constant 516,10 54,51 9,47 0,000<br />
Edad 3,5335 0,8188 4,32 0,000<br />
Experien -20,752 3,141 -6,61 0,000<br />
EnCarrer 0,7958 0,2689 2,96 0,004<br />
EnBici -0,24185 0,05154 -4,69 0,000<br />
CoCarrer -4,0886 0,5490 -7,45 0,000<br />
S = 22,57 R-Sq = 79,3% R-Sq(adj) = 77,5%<br />
Analysis of Variance<br />
Source DF SS MS F P<br />
Regression 5 114844 22969 45,08 0,000<br />
Residual Error 59 30062 510<br />
Total 64 144905<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
¿Qué pasaría <strong>con</strong> el <strong>de</strong> 6 variables añadiendo “Ennatación”?<br />
The regression equation is<br />
Tiempo = 521 + 3,39 Edad - 20,6 Experiencia + 0,758 EnCarrera - 0,215 EnBici<br />
- 4,07 CoCarrera - 0,582 EnNatación<br />
Predictor Coef SE Coef T P<br />
Constant 520,92 55,06 9,46 0,000<br />
Edad 3,3875 0,8434 4,02 0,000<br />
Experien -20,612 3,157 -6,53 0,000<br />
EnCarrer 0,7583 0,2742 2,77 0,008<br />
EnBici -0,21535 0,06217 -3,46 0,001<br />
CoCarrer -4,0746 0,5512 -7,39 0,000<br />
EnNataci -0,5823 0,7581 -0,77 0,446<br />
S = 22,65 R-Sq = 79,5% R-Sq(adj) = 77,3%
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
¿Y qué pasaría <strong>con</strong> el <strong>de</strong> 4 variables quitando “Encarrera”?<br />
The regression equation is<br />
Tiempo = 533 + 3,03 Edad - 16,9 Experiencia - 0,128 EnBici - 3,96<br />
CoCarrera<br />
Predictor Coef SE Coef T P<br />
Constant 532,77 57,62 9,25 0,000<br />
Edad 3,0256 0,8508 3,56 0,001<br />
Experien -16,867 3,033 -5,56 0,000<br />
EnBici -0,12825 0,03655 -3,51 0,001<br />
CoCarrer -3,9574 0,5815 -6,81 0,000<br />
S = 23,99 R-Sq = 76,2% R-Sq(adj) = 74,6%<br />
Analysis of Variance<br />
Source DF SS MS F P<br />
Regression 4 110381 27595 47,96 0,000<br />
Residual Error 60 34524 575<br />
Total 64 144905<br />
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Antes <strong>de</strong> dar por válido el estudio y <strong>con</strong> las opciones elegidas se<br />
<strong>de</strong>berán analizar los residuos:
Ejemplo práctico <strong>con</strong> <strong>MINITAB</strong><br />
Percent<br />
Frequency<br />
Residual Plots for Tiempo<br />
Normal Probability Plot of the Residuals Residuals Versus the Fitted Values<br />
99,9<br />
99<br />
90<br />
50<br />
10<br />
1<br />
0,1<br />
-80<br />
12<br />
9<br />
6<br />
3<br />
0<br />
-40<br />
-40<br />
0<br />
Residual<br />
-20 0<br />
Residual<br />
20<br />
40<br />
40<br />
60<br />
80<br />
Residual<br />
Residual<br />
50<br />
25<br />
0<br />
-25<br />
-50<br />
50<br />
25<br />
0<br />
-25<br />
-50<br />
250<br />
300<br />
350 400<br />
Fitted Value<br />
Histogram of the Residuals Residuals Versus the Or<strong>de</strong>r of the Data<br />
450<br />
1 5 10 15 20 25 30 35 40 45 50 55 60<br />
Observation Or<strong>de</strong>r<br />
65