728x90
공분산은 요인에 의해 결정된다
Cov(X) = LL' + Ψ 이므로(프사이는 대각행렬)
-------------------------------
비유일성의 문제
-------------------------
직교회전과 비직교회전
----------------------------
----------------------
# 필요한 패키지
library(readxl)
library(psych)
# 데이터 불러오기
data <- read_excel("d:/mydata/PCA용.xlsx", sheet = "Sheet1")
# 필요한 변수 선택 및 결측 제거
vars <- c("컨택률", "스윙률", "타구속도", "발사각도")
df <- na.omit(data[vars])
# 표준화
df_scaled <- scale(df)
# 요인 수 결정: 2개 요인 지정
nfactors <- 2
# 요인 분석 - 직교 회전 (varimax)
fa_orth <- fa(df_scaled, nfactors = nfactors, rotate = "varimax", fm = "ml") # fm = maximum likelihood
# 요인 분석 - 비직교 회전 (promax)
fa_oblq <- fa(df_scaled, nfactors = nfactors, rotate = "promax", fm = "ml")
# 결과 출력
cat("\n▶ 요인 분석 결과: 직교 회전 (Varimax)\n")
print(fa_orth)
cat("\n▶ 요인 분석 결과: 비직교 회전 (Promax)\n")
print(fa_oblq)
728x90