Last active
April 28, 2022 04:35
-
-
Save SirmaXX/5cd769bec6e30fd806f03be18281d728 to your computer and use it in GitHub Desktop.
togonal matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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