Skip to content

Commit d71275f

Browse files
committed
update
1 parent d80443c commit d71275f

18 files changed

+86
-85
lines changed

Categorical-Proportional-Data.qmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ $$
4141
\phi = \sqrt{\frac{\chi^2}{n}}
4242
$$
4343

44-
Where $n$ is the total sample size (i.e., the sum of all the cells). Using the `psych` package in R, we can calculate the the phi coefficient using the `phi` function directly from the contingency table
44+
Where $n$ is the total sample size (i.e., the sum of all the cells). Using the `effectsize` package in R, we can calculate the the phi coefficient using the `phi` function directly from the contingency table:
4545

4646
```{r, echo = TRUE}
4747
# Example contingency table:
@@ -135,7 +135,7 @@ $$
135135
h = \psi_1 - \psi_2
136136
$$
137137

138-
Cohen's $h$ is commonly used for the power analysis of proportion tests. We can calculate the standard error in Cohen's $h$ It is the required effect size measure in the program *G Power* [@faul2009].
138+
Cohen's $h$ is commonly used for the power analysis of proportion tests. In fact, it is the required effect size measure in the program *G Power* [@faul2009]. We can calculate the standard error of Cohen's $h$,
139139

140140
$$
141141
SE_h = \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}

Converting-to-Cohens-d.qmd

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ If a Pearson correlation is calculated between a continuous score and a dichotom
5252

5353
$$
5454
d_p = \frac{r}{\sqrt{1-r^2}} \sqrt{\frac{n_1+n_2-2}{n_1} + \frac{n_1+n_2-2}{n_2}}
55-
$$ Or if sample sizes within each group are unknown (or equal), the equatio simplifies to be approximately,
55+
$$
56+
Or if sample sizes within each group are unknown (or equal), the equation simplifies to be approximately,
5657

5758
$$
5859
d_p \approx \frac{r\sqrt{4}}{\sqrt{1-r^2}}

Defining-Effect-Sizes.qmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Effect sizes quantify the magnitude of effects (i.e., strength of a relationship, size of a difference), which are the outcomes of our empirical research. Effect sizes are by no means a new concept. However, reporting them remained largely optional for many years, and only until recently does it become a community standard: scientists now see reporting effect sizes (in addition to the traditional statistical significance) as a must and journals also start to require such reporting. Notably, in 2001 and 2010, The Publication Manual of the American Psychological Association 5th and 6th editions emphasized that it is "almost always necessary" [@divine2018wilcoxon] to report effect sizes [@association2010, pp. 34; see @fritz2012, which provides a comprehensive summary on history and importance of effect size reporting].
44

5-
Effects sizes can be grouped in broad categories as (1) raw effect sizes, and (2) standardized effect sizes. The raw effect sizes are a summary of the results that are expressed in the same units as the raw data. For example, when kilograms are measured, a raw effect size reports a measure in kilograms. Consider the effect of a diet on a treatment group; a control group receives no diet. The change in weight can be expressed as the mean difference between the groups. This measure is also in kg and so is a raw effect size. Standardized effect sizes expressed on a standardized scale which has no longer any unit but which have a universal interpretation. A z score is an example of a standardized measure. This document is concerned exclusively on standardized effect sizes.
5+
Effects sizes can be grouped in broad categories as (1) raw effect sizes, and (2) standardized effect sizes. The raw effect sizes are a summary of the results that are expressed in the same units as the raw data. For example, when kilograms are measured, a raw effect size reports a measure in kilograms. Consider the effect of a diet on a treatment group; a control group receives no diet. The change in weight can be expressed as the mean difference between the groups. This measure is also in kg and so is a raw effect size. Standardized effect sizes expressed on a standardized scale where units are expressed as standard deviations (i.e., z-scores). Standardized effect sizes tend to be more comparable across studies that use different measures or unit scales.

Regression.qmd

+5-5
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ Which means that if $S_x=S_y$ then $r = b_1$. Furthermore, if the regression coe
117117

118118
## Multi-Level Regression models
119119

120-
We can allow the regression coefficients such as the intercept and slope to vary randomly with respect to some grouping variable. For example, lets say we think that the intercept will vary between the different species of penguins when we look at the relationship between body mass and bill depth. Using the `lme4` package in R, we can construct a model that allows the intercept coefficient to vary between species.
120+
We can allow the regression coefficients such as the intercept and slope to vary randomly with respect to some grouping variable. For example, lets say we think that the intercept will vary between the different species of penguins when we look at the relationship between body mass and bill length. Using the `lme4` package in R, we can construct a model that allows the intercept coefficient to vary between species.
121121

122-
```{r,message=FALSE}
122+
```{r,message=FALSE,warning=FALSE}
123123
library(palmerpenguins)
124124
library(lme4)
125125
@@ -133,7 +133,7 @@ summary(ml_mdl)
133133
Note in the table that we have random effects and fixed effects. The random effects shows the grouping (categorical) variable that the parameter is allowed to vary on and then it shows the parameter that is varying, which in our case is the intercept coefficient. It also includes the variance of the intercept, which is the extent to which the intercept varies between species. For the fixed effect terms, we see the intercept displayed as well as the slope, this shows the **mean** of the intercept across species and, since the slope is equal across species, the slope is just a single value. Let's visualize how this model looks:
134134

135135

136-
```{r,echo=FALSE,message=FALSE}
136+
```{r,echo=FALSE,message=FALSE,warning=FALSE}
137137
138138
fit.c = predict(ml_mdl, re.form = NULL)
139139
@@ -153,7 +153,7 @@ ggplot(data=penguins[!is.na(penguins$species) & !is.na(penguins$flipper_length_m
153153
Notice that in the plot above the slopes are fixed and equal between each species and only the intercepts (i.e., the vertical height of each line) differs. We can also allow the slope to vary if we may choose by editing the formula:
154154

155155

156-
```{r,message=FALSE}
156+
```{r,message=FALSE,warning=FALSE}
157157
library(palmerpenguins)
158158
library(lme4)
159159
@@ -166,7 +166,7 @@ summary(ml_mdl)
166166

167167
Varying the slope will include `flipper_length_mm` in the random effects terms. Also note that the summary returns the correlation between random effect terms, which may be useful to know if there is a strong relationship between the intercept and slope across species. Now we see that the random effects terms now include the slope coefficient corresponding to the `flipper_length_mm` predictor variable. Let's visualize
168168

169-
```{r,echo=FALSE,message=FALSE}
169+
```{r,echo=FALSE,message=FALSE,warning=FALSE}
170170
171171
fit.c = predict(ml_mdl, re.form = NULL)
172172

Standardized-Mean-Differences.qmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Lastly, we will supply example R code so you can apply to your own data.
3030
| $d_{PPC3}$ - Pooled pre-test and post-test standard deviation | Pools the standard deviation between pre-test and post-test in treatment and control condition. Assumes homogeneity of variance between pre/post-test scores *and* treatment and control conditions. Confidence intervals are not easy to compute. | @sec-ppc3|
3131
| **Mean Ratios** | | @sec-rr |
3232
| $lnRR_\text{ind}$ - Response ratio between independent groups | The ratio between the means between two groups. Does not use the standard deviation in the effect size formula. | @sec-rrind |
33-
| $lnRR_\text{dep}$ - Response ratio between dependent groups | The ratio between the means between two groups. Does not use the standard deviation in the effect size formula. | @sec-rrdep |
33+
| $lnRR_\text{dep}$ - Response ratio between dependent groups | The ratio between the means between conditions (i.e., repeated measures). Does not use the standard deviation in the effect size formula. | @sec-rrdep |
3434

3535

3636
## Reporting a t-test with effect size and CI
@@ -47,7 +47,7 @@ $$
4747
d_s = \frac{M-C}{S_1}
4848
$$
4949

50-
A positive $d_s$ value would indicate that the mean of group 1 is larger than the target value, $C$. This formulation assumes that the sample is drawn from a normal distribution. The standardizer (i.e., the denominator) is the sample standard deviation. The corresponding standard error for $d_s$ is [see documentation for @caldwell],
50+
A positive $d_s$ value would indicate that the mean is larger than the target value, $C$. This formulation assumes that the sample is drawn from a normal distribution. The standardizer (i.e., the denominator) is the sample standard deviation. The corresponding standard error for $d_s$ is [see documentation for @caldwell],
5151

5252
$$
5353
SE_{d_s} = \sqrt{\frac{1}{n}+\frac{d_s^2}{2n}}.
@@ -683,7 +683,7 @@ $$
683683
where
684684

685685
$$
686-
S_{p,\text{pre}} = \sqrt{\frac{(n_T-1)S^2_{T,\text{pre}} + (n_C - 1)S^2_{C,\text{post}}}{n_T + n_C - 2}}.
686+
S_{p,\text{pre}} = \sqrt{\frac{(n_T-1)S^2_{T,\text{pre}} + (n_C - 1)S^2_{C,\text{pre}}}{n_T + n_C - 2}}.
687687
$$
688688

689689
The distribution of $d_{PPC2}$ was described by @morris2008 and can be expressed as [adapted from equation 16, @morris2008],
@@ -749,7 +749,7 @@ $$
749749
where,
750750

751751
$$
752-
S_{p,\text{pre-post}} = \sqrt{\frac{(n_T-1)\left(S^2_{T,\text{pre}} + S^2_{T,\text{post}}\right) + (n_C - 1)\left(S^2_{C,\text{pre}} + S^2_{C,\text{post}}\right)}{n_T + n_C - 2}}.
752+
S_{p,\text{pre-post}} = \sqrt{\frac{(n_T-1)\left(S^2_{T,\text{pre}} + S^2_{T,\text{post}}\right) + (n_C - 1)\left(S^2_{C,\text{pre}} + S^2_{C,\text{post}}\right)}{2(n_T + n_C - 2)}}.
753753
$$
754754

755755
The standard error for $d_{PPC2}$ is currently unknown. An option to estimate this standard error is to use a non-parametric or parametric bootstrap by repeatedly sampling the raw data, or if the raw data is not available resample simulated data. We can do this in base R by simulating pre/post data using the `mvrnorm()` function from the `MASS` package [@MASS]:

_book/Categorical-Proportional-Data.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ <h2 data-number="9.1" class="anchored" data-anchor-id="sec-phi"><span class="hea
475475
<p><span class="math display">\[
476476
\phi = \sqrt{\frac{\chi^2}{n}}
477477
\]</span></p>
478-
<p>Where <span class="math inline">\(n\)</span> is the total sample size (i.e., the sum of all the cells). Using the <code>psych</code> package in R, we can calculate the the phi coefficient using the <code>phi</code> function directly from the contingency table</p>
478+
<p>Where <span class="math inline">\(n\)</span> is the total sample size (i.e., the sum of all the cells). Using the <code>effectsize</code> package in R, we can calculate the the phi coefficient using the <code>phi</code> function directly from the contingency table:</p>
479479
<div class="cell">
480480
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Example contingency table:</span></span>
481481
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="co"># 40 17</span></span>
@@ -590,7 +590,7 @@ <h2 data-number="9.3" class="anchored" data-anchor-id="sec-h"><span class="heade
590590
<p><span class="math display">\[
591591
h = \psi_1 - \psi_2
592592
\]</span></p>
593-
<p>Cohen’s <span class="math inline">\(h\)</span> is commonly used for the power analysis of proportion tests. We can calculate the standard error in Cohen’s <span class="math inline">\(h\)</span> It is the required effect size measure in the program <em>G Power</em> <span class="citation" data-cites="faul2009">(<a href="references.html#ref-faul2009" role="doc-biblioref">Faul et al. 2009</a>)</span>.</p>
593+
<p>Cohen’s <span class="math inline">\(h\)</span> is commonly used for the power analysis of proportion tests. In fact, it is the required effect size measure in the program <em>G Power</em> <span class="citation" data-cites="faul2009">(<a href="references.html#ref-faul2009" role="doc-biblioref">Faul et al. 2009</a>)</span>. We can calculate the standard error of Cohen’s <span class="math inline">\(h\)</span>,</p>
594594
<p><span class="math display">\[
595595
SE_h = \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}
596596
\]</span></p>

_book/Converting-to-Cohens-d.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ <h2 data-number="15.3" class="anchored" data-anchor-id="from-pearson-correlation
411411
<p>If a Pearson correlation is calculated between a continuous score and a dichotomous score, this is considered a point-biserial correlation. The point-biserial correlation can be converted into a <span class="math inline">\(d_p\)</span> value using the following formula:</p>
412412
<p><span class="math display">\[
413413
d_p = \frac{r}{\sqrt{1-r^2}} \sqrt{\frac{n_1+n_2-2}{n_1} + \frac{n_1+n_2-2}{n_2}}
414-
\]</span> Or if sample sizes within each group are unknown (or equal), the equatio simplifies to be approximately,</p>
414+
\]</span> Or if sample sizes within each group are unknown (or equal), the equation simplifies to be approximately,</p>
415415
<p><span class="math display">\[
416416
d_p \approx \frac{r\sqrt{4}}{\sqrt{1-r^2}}
417417
\]</span></p>
Loading

_book/Defining-Effect-Sizes.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ <h1 class="title"><span class="chapter-number">1</span>&nbsp; <span class="chapt
332332
</header>
333333

334334
<p>Effect sizes quantify the magnitude of effects (i.e., strength of a relationship, size of a difference), which are the outcomes of our empirical research. Effect sizes are by no means a new concept. However, reporting them remained largely optional for many years, and only until recently does it become a community standard: scientists now see reporting effect sizes (in addition to the traditional statistical significance) as a must and journals also start to require such reporting. Notably, in 2001 and 2010, The Publication Manual of the American Psychological Association 5th and 6th editions emphasized that it is “almost always necessary” <span class="citation" data-cites="divine2018wilcoxon">(<a href="references.html#ref-divine2018wilcoxon" role="doc-biblioref">Divine et al. 2018</a>)</span> to report effect sizes <span class="citation" data-cites="association2010 fritz2012">(<a href="references.html#ref-association2010" role="doc-biblioref">APA 2010, 34</a>; see <a href="references.html#ref-fritz2012" role="doc-biblioref">Fritz, Morris, and Richler 2012</a>, which provides a comprehensive summary on history and importance of effect size reporting)</span>.</p>
335-
<p>Effects sizes can be grouped in broad categories as (1) raw effect sizes, and (2) standardized effect sizes. The raw effect sizes are a summary of the results that are expressed in the same units as the raw data. For example, when kilograms are measured, a raw effect size reports a measure in kilograms. Consider the effect of a diet on a treatment group; a control group receives no diet. The change in weight can be expressed as the mean difference between the groups. This measure is also in kg and so is a raw effect size. Standardized effect sizes expressed on a standardized scale which has no longer any unit but which have a universal interpretation. A z score is an example of a standardized measure. This document is concerned exclusively on standardized effect sizes.</p>
335+
<p>Effects sizes can be grouped in broad categories as (1) raw effect sizes, and (2) standardized effect sizes. The raw effect sizes are a summary of the results that are expressed in the same units as the raw data. For example, when kilograms are measured, a raw effect size reports a measure in kilograms. Consider the effect of a diet on a treatment group; a control group receives no diet. The change in weight can be expressed as the mean difference between the groups. This measure is also in kg and so is a raw effect size. Standardized effect sizes expressed on a standardized scale where units are expressed as standard deviations (i.e., z-scores). Standardized effect sizes tend to be more comparable across studies that use different measures or unit scales.</p>
336336

337337

338338
<div id="refs" class="references csl-bib-body hanging-indent" role="list" style="display: none">
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)