14305144018
Matematika E 2014
> akahfi2<-read.table("E:\\aregresi\\akahfi2.txt",header=T)
> akahfi2
x y
1 7 5
2 10 6
3 11 10
4 8 15
5 20 17
6 9 12
7 15 13
8 5 18
> cor.test(~x+y,data=akahfi2)
Pearson's product-moment correlation
data: x and y
t = 0.5952, df = 6, p-value = 0.5735
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.5620748 0.8065872
sample estimates:
cor
0.2361205
> lm(y~x,data=akahfi2)
Call:
lm(formula = y ~ x, data = akahfi2)
Coefficients:
(Intercept)
x
9.5058
0.2347
> akahfi2.lm=lm(y~x,data=akahfi2)
> summary(akahfi2.lm)
Call:
lm(formula = y ~ x, data = akahfi2)
Residuals:
Min
1Q Median
3Q
Max
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.5058
x
0.2347
Dari nilai p-value 0.5735 yang lebih besar dari nilai alpha
maka H0 diterima. Artinya model regresi tidak layak.
Uji signifikansi parameter
D
> residuals(akahfi2.lm)
1
2
3
4
5
6
7
8
-6.14903475 -5.85328185 -2.08803089 3.61621622 2.79922780 0.38146718
-0.02702703 7.32046332
> residu1=residuals(akahfi2.lm)
> shapiro.test(residu1)