# R code to produce the "school subjects" correlation matrix in Problem 4.6, pages 89-90. # The names of the six variables are given on page 89 and 90. There were 220 individuals # in this data set. school.sub.corr <- matrix( c( 1,.44,.41,.29,.33,.25, .44,1,.35,.35,.32,.33, .41,.35,1,.16,.19,.18, .29,.35,.16,1,.59,.47, .33,.32,.19,.59,1,.46, .25,.33,.18,.47,.46,1 ), nrow=6, ncol=6, byrow=T) # R code to produce the "pain" correlation matrix in Problem 4.7, page 90 # The names of the nine variables are given on page 90. There were 123 individuals in # this data set. pain.corr <- matrix( c( 1,-.04,.61,.45,.03,-.29,-.3,.45,.3, -.04,1,-.07,-.12,.49,.43,.3,-.31,-.17, .61,-.07,1,.59,.03,-.13,-.24,.59,.32, .45,-.12,.59,1,-.08,-.21,-.19,.63,.37, .03,.49,.03,-.08,1,.47,.41,-.14,-.24, -.29,.43,-.13,-.21,.47,1,.63,-.13,-.15, -.3,.3,-.24,-.19,.41,.63,1,-.26,-.29, .45,-.31,.59,.63,-.14,-.13,-.26,1,.4, .3,-.17,.32,.37,-.24,-.15,-.29,.4,1 ), nrow=9, ncol=9, byrow=T) # R code to produce the dissimilarity matrix in Table 5.12, page 113 # The names of the individual offenses are given below Table 5.12 on page 113. offenses.diss <- matrix( c( 0,21.1,71.2,36.4,52.1,89.9,53.0,90.1, 21.1,0,54.1,36.4,54.1,75.2,73.0,93.2, 71.2,54.1,0,36.4,52.1,36.4,75.2,71.2, 36.4,36.4,36.4,0,0.7,54.1,52.1,63.4, 52.1,54.1,52.1,0.7,0,53.0,36.4,52.1, 89.9,75.2,36.4,54.1,53.0,0,88.3,36.4, 53.0,73.0,75.2,52.1,36.4,88.3,0,73.0, 90.1,93.2,71.2,63.4,52.1,36.4,73.0,0 ), nrow=8, ncol=8, byrow=T)