// //Covariance anaysis command // //This command makes covariance matrix. //Syntax cov [variables]; // //Example //Calurate correlation from covariance. // //Read subject points get school.csv@;
//Get correlation corr x1 x2 y;
//Execute covariance. cov x1 x2 y;
//Save covariance to tempolary file for outlook function as below. get freq@ana; put f_cov; // //Calcurate correlation from covaiance by outlook and line variable '#'. //corr[i][j] = cov[i][j]/{sqrt(cov[i][i])*sqrt(cov[j][j])}; // vector s[3]; s[1]=sqrt(outlook(f_cov,"#",#,"x1")); s[2]=sqrt(outlook(f_cov,"#",#,"x2")); s[3]=sqrt(outlook(f_cov,"#",#,"y")); cr1=x1/(s[#]*s[1]); cr2=x2/(s[#]*s[2]); cr3=y /(s[#]*s[3]);
calcurated correlation are same with correlation by corr command.