Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
2
Indexable
Never
influence <- influence.measures(mrl.stepforward2)
obsinfluentes<- which(apply(influence$is.inf, 1, any))
dados_treino_sem <- dados_treino[-c(obsinfluentes),]
y_treino2_sem <- y_treino2[-c(obsinfluentes)]

mrl.comp2_sem <-lm(y_treino2_sem ~ .,data=dados_treino_sem)
mrl.base_sem <-lm(y_treino2_sem~1,
              data=dados_treino_sem)

mrl.stepforward_sem <- step(mrl.base_sem,
                        scope = list(upper = formula(mrl.comp2_sem), 
                                     lower = formula(mrl.base_sem)),
                        direction = "forward", trace="FALSE")

summary(mrl.stepforward_sem)
anova(mrl.stepforward_sem,mrl.comp2_sem)
extractAIC(mrl.stepforward_sem)
formula(mrl.stepforward_sem)

mrl.int2_sem <- lm(y_treino2_sem ~ (Shock.Type + Sex + Diastolic.Pressure + Systolic.Pressure + 
                              Age + Body.Surface.Area)^2, 
               data = dados_treino_sem)

mrl.stepforward2_sem <- step(mrl.stepforward_sem,
                         scope = list(upper = formula(mrl.int2_sem), 
                                      lower = formula(mrl.stepforward_sem)),
                         direction = "forward", trace="T")
summary(mrl.stepforward2_sem)
extractAIC(mrl.stepforward2_sem)
anova(mrl.stepforward2_sem, mrl.int2_sem)
formula(mrl.stepforward2_sem)