Chapter 29 Covariance and correlation

29.2 Correlation

## [1] 0.7978591
## 
##  Pearson's product-moment correlation
## 
## data:  twin1 and twin2
## t = 2.2924, df = 3, p-value = 0.1057
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.285087  0.986033
## sample estimates:
##       cor 
## 0.7978591

29.3 Generaing simulated datasets

## 
## Attaching package: 'MASS'
## The following object is masked from 'bw.data':
## 
##     genotype
##          [,1]     [,2]
## [1,] 4.288743 3.748418
## [2,] 3.748418 7.687667

## [1] 4.288743
## [1] 7.687667
## [1] 3.748418
## [1] 0.6528084
## [1] 0.6528084
## 
##  Pearson's product-moment correlation
## 
## data:  x and y
## t = 27.224, df = 998, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.6157338 0.6869989
## sample estimates:
##       cor 
## 0.6528084
##            [,1]       [,2]
## [1,]  4.1876497 -0.2733429
## [2,] -0.2733429  7.5800078

## [1] 4.18765
## [1] 7.580008
## [1] -0.2733429
## [1] -0.04851631
## [1] -0.04851631
## 
##  Pearson's product-moment correlation
## 
## data:  w and z
## t = -1.5345, df = 998, p-value = 0.1252
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.11017801  0.01351743
## sample estimates:
##         cor 
## -0.04851631