ARM
58 pág.

ARM

Disciplina:Estatística Aplicada7.459 materiais64.570 seguidores
Pré-visualização4 páginas
de 5%, que a
inclusa˜o da varia´vel nu´mero de vezes que a secadora de roupa foi
usada (X2) contribuiu para o aprimoramento do modelo na qual ja´
havia sido incorporado a varia´vel nu´mero de horas de uso do ar
condicionado (X1).

VGC (FEB-UNESP) MRLM 2012 51 / 58

Ana´lise regressa˜o mu´ltipla com R

Diagrama de dispersão

 0 2 4 6 8 10 12 14

0

20

40

60

80
10

0

0.0

0.5

1.0

1.5

2.0

2.5

3.0

x1

x 2

Co
nsu

mo

l

ll

l

ll
l

l
l

l

l

l
l

l

l

l

l

ll

l

l

VGC (FEB-UNESP) MRLM 2012 52 / 58

y
2 4 6 8 10 12

l

l
l

l

l

l

l

l

l

l
l

l

l l

l

l

l

l

l

l

l

20
40

60
80

l

l
l

l

l

l

l

l

l

l
l

l

ll

l

l

l

l

l

l

l

2
4

6
8

10
12

l

l
l

l

l

l

l

l

l

l

l

l
l

l
l

l

l

l

l

l

l

x1

l

l
l

l

l

l

l

l

l

l

l

l
l
l

l

l

l

l

l

l

l

20 40 60 80

l

l l

l

ll

ll l

l

l

l

ll

l l

l

l

l

l

l

l

l l

l

ll

ll l

l

l

l

l l

l l

l

l

l

l

l

0.0 0.5 1.0 1.5 2.0 2.5 3.0

0.0
0.5

1.0
1.5

2.0
2.5

3.0

x2

 Matriz de diagrama de dispesão

VGC (FEB-UNESP) MRLM 2012 53 / 58

Ana´lise regressa˜o mu´ltipla com R

library(scatterplot3d)
attach(dados)
scatterplot3d(x1,x2,y, main=”Diagrama de dispersa˜o”,
zlab=”Consumo”,xlab=expression(x[1]),ylab=expression(x[2]),lwd=3)
pairs(∼ y + x1 + x2,data=dados, main=”Matriz de diagrama de
dispesa˜o”, lwd=3)

VGC (FEB-UNESP) MRLM 2012 54 / 58

fit=lm(y ∼ 1 + x1 + x2,data=dados)
summary(fit)
Call:
lm(formula = y ∼ 1 + x1 + x2, data = dados)

Coefficients Estimate Std. Error t value Pr(>|t|)

(Intercept) 8.1054 2.4809 3.267 0.00428 **

x1 5.4659 0.2808 19.469 1.53e-13 ***

x2 13.2166 0.8562 15.436 7.97e-12 ***

--- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1

Residual standard error: 3.935 on 18 degrees of freedom

Multiple R-squared: 0.9709, Adjusted R-squared: 0.9677

F-statistic: 300.2 on 2 and 18 DF, p-value: 1.498e-14

VGC (FEB-UNESP) MRLM 2012 55 / 58

anova(fit) Analysis of Variance Table

Source Df Sum Sq Mean Sq F value Pr(>F)

x1 1 5609.7 5609.7 362.21 2.264e-13 ***

x2 1 3690.1 3690.1 238.27 7.973e-12 ***

Residuals 18 278.8 15.5

--- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1

VGC (FEB-UNESP) MRLM 2012 56 / 58

Ana´lise Residual

l

l l

l

l

l
l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

−2 −1 0 1 2

−
2

−
1

0
1

Theoretical Quantiles

Sa
mp

le Q
uan

tile
s

l

l l

l

l

l
l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

2 4 6 8 10 12

−
2

−
1

0
1

x1

Re
sid

ua
l pa

dra
niz

ad
o

l

ll

l

l

l
l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

0.0 0.5 1.0 1.5 2.0 2.5 3.0

−
2

−
1

0
1

x2

Re
sid

ua
l pa

dra
niz

ad
o

l

l l

l

l

l
l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

20 40 60 80

−
2

−
1

0
1

Valores preditos

Re
sid

ua
l pa

dra
niz

ad
o

VGC (FEB-UNESP) MRLM 2012 57 / 58

Ana´lise Residual

res=residuals(fit) # residuals

resp = rstandard(fit)#standardresiduals
par(mfrow=c(2,2))

par(mai = c(0.85,0.85,0.30,0.05))

# Margins: inf, left, sup and right

qqnorm(resp,main =)
qqline(resp)
plot(x1,resp, ylab = ”Residualpadranizado”, xlab = expression(x [1]))
abline(h=0, lty=2)

plot(x2,resp, ylab = ”Residualpadranizado”, xlab = expression(x [2]))
abline(h=0,lty=2)

plot(yhat,resp, ylab = ”Residualpadranizado”, xlab = ”Valorespreditos”)
abline(h=0,lty=2)

VGC (FEB-UNESP) MRLM 2012 58 / 58