chapter: 4 相関の効果量
後で加筆。
4.0.1 Pearson’s r
# データ生成
library(mvtnorm)
set.seed(123)
<- matrix(c(100,50,50,100), byrow=TRUE, ncol=2)
sigma <- c(50, 60)
mu <- 100
n <- data.frame(rmvnorm(n=n, mean=mu, sigma=sigma))
dat colnames(dat) <- c("A","B")
# ピアソンの積率相関
library(correlation)
correlation(dat)
## # Correlation Matrix (pearson-method)
##
## Parameter1 | Parameter2 | r | 95% CI | t(98) | p
## -----------------------------------------------------------------
## A | B | 0.36 | [0.18, 0.52] | 3.87 | < .001***
##
## p-value adjustment method: Holm (1979)
## Observations: 100
4.0.2 ベイズ
correlation(dat, bayesian = T)
## # Correlation Matrix (pearson-method)
##
## Parameter1 | Parameter2 | rho | 95% CI | pd | % in ROPE | Prior | BF
## -----------------------------------------------------------------------------------------------
## A | B | 0.34 | [0.18, 0.51] | 100%*** | 0.50% | Beta (3 +- 3) | 162.40***
##
## Observations: 100