`effectsize` 套件使用指南
經過第一堂課程,為了各位學員之後在各種場域教授與討論效果量的計算與解讀,提供示範用的R程式碼及說明範例是相當有用的。我們將彙整Ben-Shachar等人(2020)開發的R套件effect size
,與Ellis(2010)Chapter
1,2的內容,以接力協作的方式編輯這份作業。每位學員貢獻一點成果,換取更多人在研究教學上的便利。
編輯流程:
計算效果量
d family ~ difference between groups
Groups compared on dichotomous outcomes
The risk difference in probabilities
The relative risk
The odds ratio
Groups compared on continuous outcomes
- Cohen’s d
比較獨立樣本平均數的效果量Cohen’s d計算公式:
$$Cohen’s \space d = \frac{M_1 - M_2}{SD_{pooled}} $$
R程式碼範例:
## 獨立樣本比較範例
## 範例資料來自`mtcars`
cohens_d(mpg ~ am, data=mtcars)
## Cohen's d | 95% CI
## --------------------------
## -1.48 | [-2.27, -0.67]
##
## - Estimated using pooled SD.
## 輸出效果量及95%信賴區間
Glass’s delta( △ )
Hedges’ g
Probability of superiority
r family ~ measures of association
Correlation indexes
(Two variables are continuous)
- The Pearson product moment correlation coefficient (r)
負責學員 魏志名(嘉義大學)
皮爾森積差相關公式:
$$Pearson’s \space r = \frac {\sum_{i=1}^{n}(X_i-\overline{X})(Y_i-\overline{Y})}{{\sqrt{\sum_{i=1}^{n}(X_i-\overline{X})^2}}{\sqrt{\sum_{i=1}^{n}(Y_i-\overline{Y})^2}}}$$
R程式碼範例:
cor_results <- cor.test(mtcars$mpg, mtcars$disp,conf.level = 0.95)
report::report_effectsize(cor_results)
## very large (r = -0.85, 95% CI [-0.92, -0.71])
## 輸出效果量及95%信賴區間
(Two variables are ordinal)
Spearman’s rho or the rank correlation coefficient (ρ)
Kendall’s tau (τ)
(One continous and one ordinal)
- The point-biserial correlation coefficient (rp**b)
(Contigency table)
The phi coefficient (ϕ)
Pearson’s contingency coefficient (C)
Cram´er’s V (V)
Goodman and Kruskal’s lambda (λ)
Proportion of variance indexes
- The coefficient of determination (r2)
負責學員 蕭富聲(佛光大學)
$$r^2 = \frac{ \sum_{i=1}^{N}(\hat{y_i}-ȳ_i)^2}{ \sum_{i=1}^{N} (y_i-ȳ_i)^2 } $$
## 決定係數比較範例
## 範例資料來自`mtcars`
m1 <- lm(hp ~ disp, data = mtcars)
summary(m1)
## 輸出效果量及95%信賴區間
the (uncorrected) coefficient of multiple determination (R2$)
the coefficient of multiple determination adjusted for sample size and the number of predictor variables (adjR2$)
Cohen’s f (f)
Cohen’s f squared
Epsilon squared (eps2)
the (uncorrected) correlation ratio (η2)
Omega squared (ω2)
The squared canonical correlation coefficient (RC2)
解讀效果量
effectsize
套件收錄統計學者的建議,提供使用者查詢效果量份量的建議。在此彙整解讀效果量的函式與使用方法。
參考資源
Ben-Shachar, M. S., Lüdecke, D., & Makowski, D. (2020). effectsize: Estimation of effect size indices and standardized parameters. Journal of Open Source Software, 5(56), 2815. https://doi.org/10.21105/joss.02815
Ellis, P. D. (2010). The essential guide to effect sizes: Statistical power, meta-analysis, and the interpretation of research results. Cambridge University Press.