LR
This commit is contained in:
23
PCA/1. pca.r
Normal file
23
PCA/1. pca.r
Normal file
@@ -0,0 +1,23 @@
|
||||
x1=c(26,46,57,36,57,26,58,37,36,56,78,95,88,90,52,56)
|
||||
x2=c(35,74,73,73,62,22,67,34,22,42,65,88,90,85,46,66)
|
||||
x3=c(35,76,38,69,25,25,87,79,36,26,22,36,58,36,25,44)
|
||||
x4=c(45,89,54,55,33,45,67,89,47,36,40,56,68,45,37,56)
|
||||
|
||||
score = cbind(x1, x2, x3, x4)
|
||||
colnames(score) = c("국어", "영어", "수학", "과학")
|
||||
rownames(score) = 1:16
|
||||
head(score)
|
||||
|
||||
result = prcomp(score) #주성분 고유벡터 출력
|
||||
result
|
||||
|
||||
summary(result)
|
||||
|
||||
# Importance of components:
|
||||
# PC1 PC2 PC3 PC4
|
||||
# Standard deviation 30.1227 27.0528 9.07614 6.15239
|
||||
# Proportion of Variance 0.5157 0.4159 0.04682 0.02151
|
||||
# Cumulative Proportion 0.5157 0.9317 0.97849 1.00000
|
||||
|
||||
# PC2까지 누적 기여율 93.17%로 2개의 주성분 결정
|
||||
# (일반적으로 80% 이상 되는 지점의 성분수를 주성분으로 결정함)
|
Reference in New Issue
Block a user