Beruflich Dokumente
Kultur Dokumente
Sumrio
Introduo
Objetivos
Material e Mtodo
Resultados
Concluso
Referncia
Introduo
Objetivos
Material e Mtodo
Resultados
require(MASS)
dados = read.table("Ex11_08.txt", header = T, dec=".")
attach(dados)
mod1 = lm(y ~ 1)
mod2 = lm(y ~ x1 + x2 + x3 + x4 + x5 + x6)
- Seleo Progressiva;
- Eliminao Regressiva;
- Regresso por Etapas.
Seleo Progressiva
2 Passo: Utilizar o comando aps a escolha do mtodo.
stepAIC(mod1, scope = list(upper = mod2, lower = mod1), scale = 0, direction =
"forward", trace = 1, test = "F", k = 2, step = 1000)
Start: AIC=12.62
y~1
Df
Sum of Sq
RSS
AIC
+ x3
1
15.8546
17.366 2.2920
+ x4
1
10.3230
22.898 7.5457
+ x5
1
3.7232
29.498 12.3577
+ x1
1
3.4672
29.754 12.5219
<none>
33.221 12.6162
+ x2
1
2.0711
31.150 13.3931
+ x6
1
2.0447
31.176 13.4092
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Francisco Gerson Mendes de Souza Filho
F Value
15.5200
7.6640
2.1457
1.9810
Pr(F)
0.001057 **
0.013151 *
0.161216
0.177305
1.1303
1.1150
0.302578
0.305783
Seleo Progressiva
Step: AIC=2.29
y ~ x3
Df
1
1
1
Sum of Sq
5.6588
3.1330
2.1065
RSS
11.708
14.233
15.260
17.366
16.460
17.022
AIC
-3.1996
0.5121
1.8351
2.2920
3.2732
3.9117
F Value
7.7333
3.5218
2.2087
+ x4
+ x5
+ x2
<none>
+ x1
1
0.9067
0.8814
+ x6
1
0.3441
0.3235
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Pr(F)
0.01336 *
0.07893 .
0.15667
0.36178
0.57743
Seleo Progressiva
Step: AIC=-3.2
y ~ x3 + x4
<none>
+ x1
+ x5
+ x2
+ x6
Df
Sum of Sq
1
1
1
1
0.83169
0.78869
0.16432
0.07325
RSS
11.708
10.876
10.919
11.543
11.634
AIC
-3.1996
-2.5996
-2.5247
-1.4681
-1.3188
F Value
Pr(F)
1.14704
1.08346
0.21352
0.09444
0.3011
0.3144
0.6507
0.7628
Call:
lm(formula = y ~ x3 + x4)
Coefficients:
(Intercept)
x3
4.6563
0.5113
x4
-0.1242
Voltar
Avanar
Eliminao Regressiva
2 Passo: Utilizar o comando aps a escolha do mtodo.
stepAIC(mod2, scope = list(upper = mod2, lower = mod1), scale = 0, direction =
"backward", trace = 1, test = "F", k = 2, step = 1000)
Start: AIC=1.01
y ~ x1 + x2 + x3 + x4 + x5 + x6
Df
1
1
1
1
- x2
- x5
- x6
- x1
<none>
- x4
1
- x3
1
Sum of Sq
0.0012
0.7179
0.7837
0.9572
3.6197
10.0483
RSS
9.5936
10.3103
10.3761
10.5496
9.5924
13.2121
19.6407
AIC
-0.9835
0.3854
0.5063
0.8213
1.0141
5.0972
12.6302
F Value
0.0015
0.8980
0.9804
1.1974
Pr(F)
0.96959
0.36200
0.34164
0.29532
4.5282
12.5703
0.05475 .
0.00403 **
Eliminao Regressiva
Step: AIC=-0.98
y ~ x1 + x3 + x4 + x5 + x6
Df
1
1
1
Sum of Sq
0.7947
0.8453
0.9583
RSS
10.3883
10.4389
10.5519
9.5936
13.7415
19.7059
AIC
-1.4713
-1.3790
-1.1745
-0.9835
3.8437
10.6931
F Value
1.0769
1.1455
1.2985
- x6
- x5
- x1
<none>
- x4
1
4.1479
5.6207
- x3
1
10.1123
13.7028
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Pr(F)
0.318311
0.303971
0.275045
0.033886 *
0.002661 **
Eliminao Regressiva
Step: AIC=-1.47
y ~ x1 + x3 + x4 + x5
Df
1
1
- x5
- x1
<none>
- x4
1
- x3
1
Sum of Sq
0.4877
0.5307
3.5040
9.6728
RSS
10.876
10.919
10.388
13.892
20.061
AIC
-2.5996
-2.5247
-1.4713
2.0511
9.0325
F Value
0.6573
0.7152
Pr(F)
0.431090
0.411939
4.7223
13.0356
0.047430 *
0.002839 **
Eliminao Regressiva
Step: AIC=-2.6
y ~ x1 + x3 + x4
Df
1
Sum of Sq
0.8317
RSS
11.708
10.876
16.460
20.194
AIC
-3.1996
-2.5996
3.2732
7.1579
F Value
1.147
- x1
<none>
- x4
1
5.5837
7.701
- x3
1
9.3178
12.851
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Pr(F)
0.301100
0.014154 *
0.002709 **
Eliminao Regressiva
Step: AIC=-3.2
y ~ x3 + x4
Df
<none>
- x4
1
- x3
1
Sum of Sq
5.6588
11.1904
RSS
11.708
17.366
22.898
AIC
F Value
-3.1996
2.2920 7.7333
7.5457 15.2929
Pr(F)
0.013357 *
0.001246 **
x4
-0.1242
Voltar
Avanar
Sum of Sq
15.8546
10.3230
3.7232
3.4672
2.0711
2.0447
RSS
17.366
22.898
29.498
29.754
33.221
31.150
31.176
AIC
2.2920
7.5457
12.3577
12.5219
12.6162
13.3931
13.4092
F Value
15.5200
7.6640
2.1457
1.9810
Pr(F)
0.001057 **
0.013151 *
0.161216
0.177305
1.1303
1.1150
0.302578
0.305783
Df
1
1
1
Sum of Sq
5.6588
3.1330
2.1065
RSS
11.708
14.234
15.260
17.366
16.460
17.022
33.221
AIC
-3.1996
0.5121
1.8351
2.2920
3.2732
3.9117
12.6162
F Value
7.7333
3.5218
2.2087
+ x4
+ x5
+ x2
<none>
+ x1
1
0.9067
0.8814
+ x6
1
0.3441
0.3235
- x3
1
15.8546
15.5200
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Pr(F)
0.013357 *
0.078927 .
0.156675
0.361784
0.577429
0.001057 **
Sum of Sq
0.8317
0.7887
0.1643
0.0732
5.6588
11.1904
RSS
11.708
10.876
10.919
11.543
11.634
17.366
22.898
AIC
-3.1996
-2.5996
-2.5247
-1.4681
-1.3188
2.2920
7.5457
F Value
Pr(F)
1.1470
1.0835
0.2135
0.0944
7.7333
15.2929
0.301100
0.314412
0.650651
0.762835
0.013357 *
0.001246 **
x4
-0.1242
Voltar
Avanar
Sum Sq
15.8546
Mean Sq
15.8546
F value
21.6671
Pr(>F)
0.0002643
5.6588
16
5.6588
11.7077
7.7333
0.7317
0.0133574 *
Modelo proposto: y ~ x3 + x4
Contra-modelo: y ~ x3 + x4 + x1
1
2
Res.Df
16
15
RSS
11.708
10.876
Df
Sum of Sq
Pr(>F)
0.83169
1.147
0.3011
Modelo proposto: y ~ x3 + x4
Contra-modelo: y ~ x3 + x4 + x1 + x2
1
2
Res.Df
16
14
RSS
11.708
10.757
Df
Sum of Sq
0.951
0.6189 0.5527
Pr(>F)
Modelo proposto: y ~ x3 + x4
Contra-modelo: y ~ x3 + x4 + x1 + x2 + x5
1
2
Res.Df
16
13
RSS
11.708
10.376
Df
Sum of Sq
Pr(>F)
1.3316
0.5561
0.6532
Modelo proposto: y ~ x3 + x4
Contra-modelo: y ~ x3 + x4 + x1 + x2 + x5 + x6
1
2
Res.Df
16
12
RSS
Df
11.7077
9.5924 4
Sum of Sq
Pr(>F)
2.1153
0.6616 0.6304
Modelo proposto: y ~ x3
Contra-modelo: y ~ x3 + x4
1
2
Res.Df
17
16
RSS
17.366
11.708
Df
Sum of Sq
Pr(>F)
5.6588
7.7333
0.01336 *
Modelo proposto: y ~ x4
Contra-modelo: y ~ x3 + x4
1
2
Res.Df
17
16
RSS
Df
22.898
11.708 1
Sum of Sq
Pr(>F)
11.190
15.293
0.001246 **
Concluso
De acordo com o que foi proposto nos objetivos e com base nos
resultados obtidos, fica bem claro que o comando stepAIC um timo
recurso para seleo de variveis para um modelo a ser proposto, no
importando qual o mtodo a ser utilizado, j que o resultado final ser o
mesmo.
Referncias
OBRIGADO!