Académique Documents
Professionnel Documents
Culture Documents
delim("clipboard")
> data
Makanan Sandang Perumahan Kesehatan Transportasi Informasi Rekreasi Pendidikan PenyediaanMakanan Perawatan
1 108.18 110.16 103.95 109.52 102.99 99.35 106.10 110.69 107.58 116.13
2 108.85 110.21 104.11 109.99 102.77 99.44 106.26 110.75 107.59 115.75
3 109.26 110.16 104.15 110.41 102.57 99.42 106.38 110.75 107.66 115.38
4 109.02 110.28 104.26 110.44 102.27 99.55 107.13 110.75 107.85 115.87
5 108.83 110.25 104.28 110.42 102.55 99.52 107.41 110.75 107.96 116.87
6 108.48 110.09 104.42 110.77 102.92 99.63 107.34 110.75 107.99 117.59
7 108.87 110.01 104.43 110.98 103.09 99.75 107.23 110.75 108.11 117.33
8 108.89 109.80 104.43 110.73 103.01 99.76 107.41 111.23 108.20 117.74
9 107.79 109.78 104.55 110.87 102.84 99.78 107.84 111.23 108.20 118.50
10 108.04 109.89 104.62 110.91 103.41 99.84 107.76 112.06 108.20 118.95
11 109.21 109.91 104.70 111.38 103.95 99.91 109.16 112.07 108.29 119.77
12 111.81 109.89 104.92 111.40 104.70 99.96 109.12 112.07 108.42 120.00
> data.normal=data
> data.normal
Makanan Sandang Perumahan Kesehatan Transportasi Informasi Rekreasi Pendidikan PenyediaanMakanan Perawatan
1 108.18 110.16 103.95 109.52 102.99 99.35 106.10 110.69 107.58 116.13
2 108.85 110.21 104.11 109.99 102.77 99.44 106.26 110.75 107.59 115.75
3 109.26 110.16 104.15 110.41 102.57 99.42 106.38 110.75 107.66 115.38
4 109.02 110.28 104.26 110.44 102.27 99.55 107.13 110.75 107.85 115.87
5 108.83 110.25 104.28 110.42 102.55 99.52 107.41 110.75 107.96 116.87
6 108.48 110.09 104.42 110.77 102.92 99.63 107.34 110.75 107.99 117.59
7 108.87 110.01 104.43 110.98 103.09 99.75 107.23 110.75 108.11 117.33
8 108.89 109.80 104.43 110.73 103.01 99.76 107.41 111.23 108.20 117.74
9 107.79 109.78 104.55 110.87 102.84 99.78 107.84 111.23 108.20 118.50
10 108.04 109.89 104.62 110.91 103.41 99.84 107.76 112.06 108.20 118.95
11 109.21 109.91 104.70 111.38 103.95 99.91 109.16 112.07 108.29 119.77
12 111.81 109.89 104.92 111.40 104.70 99.96 109.12 112.07 108.42 120.00
> data.pca=prcomp(data.normal,center=F)
> data.pca
PC10
Makanan 0.086890646
Sandang 0.160080529
Perumahan -0.527157136
Kesehatan 0.048262927
Transportasi -0.193656301
Informasi 0.703597050
Rekreasi -0.096633264
Pendidikan 0.009434408
PenyediaanMakanan -0.344287849
Perawatan 0.161516545
> summary(data.pca)
Importance of components:
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10
Standard deviation 357.3 1.37076 0.87287 0.4137 0.2362 0.2002 0.1291 0.06653 0.03142 0.01246
Proportion of Variance 1.0 0.00001 0.00001 0.0000 0.0000 0.0000 0.0000 0.00000 0.00000 0.00000
Cumulative Proportion 1.0 0.99999 1.00000 1.0000 1.0000 1.0000 1.0000 1.00000 1.00000 1.00000
> #standarisasi
> matriks<-as.matrix.data.frame(data)
> matriks
Perawatan
[1,] -0.86668166
[2,] -1.10884271
[3,] -1.34463111
[4,] -1.03237080
[5,] -0.39510487
[6,] 0.06372659
[7,] -0.10196255
[8,] 0.15931648
[9,] 0.64363859
[10,] 0.93040825
[11,] 1.45296631
[12,] 1.59953748
> y<-svd(matriks)
> L<-diag(y$d)
> A<-y$v
> U<-y$u
>L
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 9.306944 0.000000 0.000000 0.000000 0.000000 0.0000000 0.0000000 0.0000000 0.0000000
0.00000000
[2,] 0.000000 3.477013 0.000000 0.000000 0.000000 0.0000000 0.0000000 0.0000000 0.0000000
0.00000000
[3,] 0.000000 0.000000 2.317693 0.000000 0.000000 0.0000000 0.0000000 0.0000000 0.0000000
0.00000000
[4,] 0.000000 0.000000 0.000000 1.738195 0.000000 0.0000000 0.0000000 0.0000000 0.0000000
0.00000000
[5,] 0.000000 0.000000 0.000000 0.000000 1.134115 0.0000000 0.0000000 0.0000000 0.0000000
0.00000000
[6,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.8980631 0.0000000 0.0000000 0.0000000
0.00000000
[7,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.0000000 0.6738211 0.0000000 0.0000000
0.00000000
[8,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.0000000 0.0000000 0.4790547 0.0000000
0.00000000
[9,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.0000000 0.0000000 0.0000000 0.3429302
0.00000000
[10,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.0000000 0.0000000 0.0000000 0.0000000
0.06537941
>A
[,10]
[1,] 0.24178311
[2,] 0.03456460
[3,] -0.36761257
[4,] 0.11880740
[5,] -0.35210681
[6,] 0.22070953
[7,] -0.24524895
[8,] 0.02480215
[9,] -0.23847003
[10,] 0.70765102
>U
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[,10]
[1,] -0.31959623
[2,] 0.49810962
[3,] -0.20367666
[4,] -0.25315372
[5,] 0.12441578
[6,] 0.35220818
[7,] -0.26407674
[8,] 0.44628122
[9,] -0.32060381
[10,] -0.05182464
[11,] 0.11891268
[12,] -0.12699567
> G=U
> H=A%*%L
>H
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
> #Cek besar keragaman yang mampu dijelaskan biplot (baiknya > 70%)
> cek<-eigen(t(matriks)%*%matriks)$values
> dim1<-sum(cek[1])/sum(cek)*100
> dim2<-sum(cek[2])/sum(cek)*100
> dim1+dim2
[1] 89.73531
> var<-H%*%t(H)
> sqrt(diag(var))
[1] 3.316625 3.316625 3.316625 3.316625 3.316625 3.316625 3.316625 3.316625 3.316625 3.316625
> cov2cor(var)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
> model1<-princomp(matriks,cor=T)
> summary(model1)
Importance of components:
Comp.10
> biplot(model1)
> ###Model 2
> model2<-prcomp(matriks,scale=T)
> summary(model2)
Importance of components:
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10
Standard deviation 2.8061 1.0484 0.69881 0.52409 0.34195 0.27078 0.20316 0.14444 0.10340
0.01971
Proportion of Variance 0.7874 0.1099 0.04883 0.02747 0.01169 0.00733 0.00413 0.00209 0.00107
0.00004
Cumulative Proportion 0.7874 0.8973 0.94619 0.97365 0.98535 0.99268 0.99681 0.99889 0.99996
1.00000
> biplot(model2)
>