Skip to Main Content

Stata Teaching Tools:  Matrix of squared correlation coefficients

Purpose:  The purpose of this program is to display a matrix of
squared correlation coefficients to help students to learn to interpret
correlations.  

Examples:

use https://stats.idre.ucla.edu/stat/stata/notes3/hsb2, clear

corr read write math science socst
(obs=200)

             |     read    write     math  science    socst
-------------+---------------------------------------------
        read |   1.0000
       write |   0.5968   1.0000
        math |   0.6623   0.6174   1.0000
     science |   0.6302   0.5704   0.6307   1.0000
       socst |   0.6215   0.6048   0.5445   0.4651   1.0000


corrsq

Squared Correlation Coefficients

              read      write       math    science      socst
   read          1
  write  .35614217          1
   math  .43861496  .38124359          1
science  .39709894  .32540366  .39782432          1
  socst   .3862427  .36577484   .2964588   .2163236          1
  
/* user entered correlation matrix */

matrix R = (1,.2,.6.2,1,.4.6,.4,1)

matrix list R

symmetric R[3,3]
    c1  c2  c3
r1   1
r2  .2   1
r3  .6  .4   1

corrsq , matrix(R)

Squared Correlation Coefficients

     c1   c2   c3
r1    1
r2  .04    1
r3  .36  .16    1