Skip to content

Instantly share code, notes, and snippets.

@SirmaXX
Last active April 28, 2022 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SirmaXX/5cd769bec6e30fd806f03be18281d728 to your computer and use it in GitHub Desktop.
Save SirmaXX/5cd769bec6e30fd806f03be18281d728 to your computer and use it in GitHub Desktop.
togonal matrix
#varyans kovaryans matrisi tanımlayalım
Sigma<-matrix(c(19,30,2,12,30,57,5,23,2,5,38,47,12,23,43,68),ncol = 4,byrow = True)
#loading matrix
lodMatrix<-matrix(c(4,1,7,2,-1,6,1,8),ncol = 2,byrow = TRUE)
#loading matrisinin transpozu
TransLodMatrix<-t(lodMatrix)
#matrislerin çarpımı
multiple<-lodMatrix %*% TransLodMatrix
#sigma ile ll' çarpımını çıkarıyoruz
Result=Sigma-multiple
#diagonalını alıyoruz (varyanslar için)
diag(Result)
countvar=0
#hi^2+yi= sigmaii check
loopp<-c(1:4)
for (i in loopp) {
comm<-diag(multiple)[i]
ll<-diag(Result)[i]
ress<-comm+ll
if(Sigma[i,i]==ress){
countvar=countvar+1
}
if(countvar==4){
print("hepsi doğru")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment