Skip to content

Commit

Permalink
fix CH 7 values referring to plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakens committed Feb 1, 2024
1 parent bb85873 commit 2dcf67d
Show file tree
Hide file tree
Showing 57 changed files with 87 additions and 82 deletions.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig131-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig132-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig134-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig135-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig136-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig137-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-fig138-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-paradox-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-pdft-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/fig-tdist-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/q1-1.pdf
Binary file not shown.
Binary file modified 01-pvalue_files/figure-pdf/unnamed-chunk-3-1.pdf
Binary file not shown.
Binary file modified 02-errorcontrol_files/figure-pdf/fig-minerror-1.pdf
Binary file not shown.
Binary file modified 02-errorcontrol_files/figure-pdf/justifyalpha1-1.pdf
Binary file not shown.
13 changes: 9 additions & 4 deletions 07-CI.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ In order to maintain the direct relationship between a confidence interval and a

To maintain a direct relationship between an *F*-test and its confidence interval, a 90% CI for effect sizes from an *F*-test should be provided. The reason for this is explained by [Karl Wuensch](https://web.archive.org/web/20140104080701/http://core.ecu.edu/psyc/wuenschk/docs30/CI-Eta2-Alpha.doc). Where Cohen’s *d* can take both positive and negative values, r² or η² are squared, and can therefore only take positive values. This is related to the fact that *F*-tests (as commonly used in ANOVA) are one-sided. If you calculate a 95% CI, you can get situations where the confidence interval includes 0, but the test reveals a statistical difference with a *p* < .05 (for a more mathematical explanation, see @steiger_beyond_2004). This means that a 95% CI around Cohen's *d* in an independent *t*-test equals a 90% CI around η² for exactly the same test performed as an ANOVA. As a final detail, because eta-squared cannot be smaller than zero, the lower bound for the confidence interval cannot be smaller than 0. This means that a confidence interval for an effect that is not statistically different from 0 has to start at 0. You report such a CI as 90% CI [.00; .XX] where the XX is the upper limit of the CI.

Confidence intervals are often used in forest plots that communicate the results from a meta-analysis. In the plot below, we see 4 rows. Each row shows the effect size estimate from one study (in Hedges’ *g*). For example, study 1 yielded an effect size estimate of 0.44, with a confidence interval around the effect size from 0.08 to 0.8. The horizontal black line, similarly to the visualization we played around with before, is the width of the confidence interval. When it does not touch the effect size 0 (indicated by a black vertical dotted line) the effect is statistically significant.

```{r fig-meta, echo=FALSE}
#| fig-cap: "Meta-analysis of 4 studies."
```{r metaexample, echo=FALSE}
set.seed(2238)
Expand All @@ -118,11 +116,18 @@ for (i in 1:nSims) { # for each simulated study
}
result <- metafor::rma(yi, vi, data = metadata, method = "FE")
```

Confidence intervals are often used in forest plots that communicate the results from a meta-analysis. In the plot below, we see 4 rows. Each row shows the effect size estimate from one study (in Hedges’ *g*). For example, study 1 yielded an effect size estimate of 0.53, with a confidence interval around the effect size from 0.12 to 0.94. The horizontal black line, similarly to the visualization we played around with before, is the width of the confidence interval. When it does not touch the effect size 0 (indicated by a black vertical dotted line) the effect is statistically significant.

```{r fig-meta, echo=FALSE}
#| fig-cap: "Meta-analysis of 4 studies."
par(mar=c(4,0,4,0))
par(bg = backgroundcolor)
metafor::forest(result, top = 0)
title("Forest plot for a simulated meta-analysis")
```

We can see, based on the fact that the confidence intervals do not overlap with 0, that studies 1 and 3 were statistically significant. The diamond shape named the FE model (Fixed Effect model) is the meta-analytic effect size. Instead of using a black horizontal line, the upper limit and lower limit of the confidence interval are indicated by the left and right points of the diamond, and the center of the diamond is the meta-analytic effect size estimate. A meta-analysis calculates the effect size by combining and weighing all studies. The confidence interval for a meta-analytic effect size estimate is always narrower than that for a single study, because of the combined sample size of all studies included in the meta-analysis.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified 08-samplesizejustification_files/figure-pdf/fig-plot-1-1.pdf
Binary file not shown.
Binary file modified 08-samplesizejustification_files/figure-pdf/fig-plot-4-1.pdf
Binary file not shown.
Binary file modified 08-samplesizejustification_files/figure-pdf/fig-power-2-1.pdf
Binary file not shown.
Binary file modified 08-samplesizejustification_files/figure-pdf/fig-power-3-1.pdf
Binary file not shown.
Binary file not shown.
Binary file modified 09-equivalencetest_files/figure-pdf/fig-ciequivalence1-1.pdf
Binary file not shown.
Binary file modified 09-equivalencetest_files/figure-pdf/fig-ciequivalence2-1.pdf
Binary file not shown.
Binary file modified 09-equivalencetest_files/figure-pdf/fig-intervaltest-1.pdf
Binary file not shown.
Binary file modified 09-equivalencetest_files/figure-pdf/fig-tdistequivalence-1.pdf
Binary file not shown.
Binary file modified 09-equivalencetest_files/figure-pdf/fig-tmet-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-boundplot1-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-comparison-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-fourspendingfunctions-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-futility1-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-futility2-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-futilityq13-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-powerseq-1.pdf
Binary file not shown.
Binary file modified 10-sequential_files/figure-pdf/fig-powerseq2-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-carterbias-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-funnel1-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-funnel2-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-petpeese-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-petpeeseq4-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-trimfill1-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/fig-twoforestplot-1.pdf
Binary file not shown.
Binary file modified 12-bias_files/figure-pdf/metasimq2-1.pdf
Binary file not shown.
Binary file removed 13-prereg_files/figure-epub/unnamed-chunk-1-1.png
Binary file not shown.
32 changes: 16 additions & 16 deletions docs/03-likelihoods.html

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/04-bayes.html
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,14 @@ <h1 class="title"><span id="sec-bayes" class="quarto-section-identifier"><span c
<div class="webex-check webex-box">
<p><strong>Q1</strong>: The true believer had a prior of Beta(1,0.5). After observing 10 heads out of 20 coin flips, what is the posterior distribution, given that <span class="math inline">\(\alpha\)</span> = <span class="math inline">\(\alpha\)</span> + x and <span class="math inline">\(\beta\)</span> = <span class="math inline">\(\beta\)</span> + n – x?</p>
<div class="cell" data-layout-align="center">
<div id="radio_UXZSKOVDXT" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_UXZSKOVDXT" value=""><span>Beta(10, 10)</span></label><label><input type="radio" autocomplete="off" name="radio_UXZSKOVDXT" value="answer"><span>Beta(11, 10.5)</span></label><label><input type="radio" autocomplete="off" name="radio_UXZSKOVDXT" value=""><span>Beta(10, 20)</span></label><label><input type="radio" autocomplete="off" name="radio_UXZSKOVDXT" value=""><span>Beta(11, 20.5)</span></label>
<div id="radio_URHTQOTHBM" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_URHTQOTHBM" value=""><span>Beta(10, 10)</span></label><label><input type="radio" autocomplete="off" name="radio_URHTQOTHBM" value="answer"><span>Beta(11, 10.5)</span></label><label><input type="radio" autocomplete="off" name="radio_URHTQOTHBM" value=""><span>Beta(10, 20)</span></label><label><input type="radio" autocomplete="off" name="radio_URHTQOTHBM" value=""><span>Beta(11, 20.5)</span></label>
</div>
</div>
<p><strong>Q2</strong>: The extreme skeptic had a prior of Beta(100,100). After observing 50 heads out of 100 coin flips, what is the posterior distribution, given that <span class="math inline">\(\alpha\)</span> = <span class="math inline">\(\alpha\)</span> + x and <span class="math inline">\(\beta\)</span> = <span class="math inline">\(\beta\)</span> + n – x?</p>
<div class="cell" data-layout-align="center">
<div id="radio_DRNKCWBJVT" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_DRNKCWBJVT" value=""><span>Beta(50, 50)</span></label><label><input type="radio" autocomplete="off" name="radio_DRNKCWBJVT" value=""><span>Beta(51, 51)</span></label><label><input type="radio" autocomplete="off" name="radio_DRNKCWBJVT" value="answer"><span>Beta(150, 150)</span></label><label><input type="radio" autocomplete="off" name="radio_DRNKCWBJVT" value=""><span>Beta(11, 20.5)</span></label>
<div id="radio_JWEFQYOELE" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_JWEFQYOELE" value=""><span>Beta(50, 50)</span></label><label><input type="radio" autocomplete="off" name="radio_JWEFQYOELE" value=""><span>Beta(51, 51)</span></label><label><input type="radio" autocomplete="off" name="radio_JWEFQYOELE" value="answer"><span>Beta(150, 150)</span></label><label><input type="radio" autocomplete="off" name="radio_JWEFQYOELE" value=""><span>Beta(11, 20.5)</span></label>
</div>
</div>
<p>Copy the R script below into R. This script requires 5 input parameters (identical to the Bayes Factor calculator website used above). These are the hypothesis you want to examine (e.g., when evaluating whether a coin is fair, <em>p</em> = 0.5), the total number of trials (e.g., 20 flips), the number of successes (e.g., 10 heads), and the <span class="math inline">\(\alpha\)</span> and <span class="math inline">\(\beta\)</span> values for the Beta distribution for the prior (e.g., <span class="math inline">\(\alpha\)</span> = 1 and <span class="math inline">\(\beta\)</span> = 1 for a uniform prior). Run the script. It will calculate the Bayes Factor, and plot the prior (grey), likelihood (dashed blue), and posterior (black).</p>
Expand Down Expand Up @@ -588,14 +588,14 @@ <h1 class="title"><span id="sec-bayes" class="quarto-section-identifier"><span c
<p>We see that for the newborn baby, <em>p</em> = 0.5 has become more probable, but so has <em>p</em> = 0.4.</p>
<p><strong>Q3</strong>: Change the hypothesis in the first line from 0.5 to 0.675, and run the script. If you were testing the idea that this coin returns 67.5% heads, which statement is true?</p>
<div class="cell" data-layout-align="center">
<div id="radio_RHZDRBTNZK" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_RHZDRBTNZK" value=""><span>Your belief in this hypothesis, given the data, would have decreased.</span></label><label><input type="radio" autocomplete="off" name="radio_RHZDRBTNZK" value="answer"><span>Your belief in this hypothesis, given the data, would have stayed the same.</span></label><label><input type="radio" autocomplete="off" name="radio_RHZDRBTNZK" value=""><span>Your belief in this hypothesis, given the data, would have increased.</span></label>
<div id="radio_QQVKJPQYBT" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_QQVKJPQYBT" value=""><span>Your belief in this hypothesis, given the data, would have decreased.</span></label><label><input type="radio" autocomplete="off" name="radio_QQVKJPQYBT" value="answer"><span>Your belief in this hypothesis, given the data, would have stayed the same.</span></label><label><input type="radio" autocomplete="off" name="radio_QQVKJPQYBT" value=""><span>Your belief in this hypothesis, given the data, would have increased.</span></label>
</div>
</div>
<p><strong>Q4</strong>: Change the hypothesis in the first line back to 0.5. Let’s look at the increase in the belief of the hypothesis <em>p</em> = 0.5 for the extreme skeptic after 10 heads out of 20 coin flips. Change the <span class="math inline">\(\alpha\)</span> for the prior in line 4 to 100 and the <span class="math inline">\(\beta\)</span> for the prior in line 5 to 100. Run the script. Compare the figure from R to the increase in belief for the newborn baby. Which statement is true?</p>
<div class="cell" data-layout-align="center">
<div id="radio_FLGBRQSAYK" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_FLGBRQSAYK" value="answer"><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>increased</strong> for the extreme skeptic, but <strong>not</strong> as much as it has for the newborn.</span></label><label><input type="radio" autocomplete="off" name="radio_FLGBRQSAYK" value=""><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>increased</strong> for the extreme skeptic, <strong>exactly as much</strong> as it has for the newborn.</span></label><label><input type="radio" autocomplete="off" name="radio_FLGBRQSAYK" value=""><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>increased</strong> for the extreme skeptic, and <strong>much more</strong> than it has for the newborn.</span></label><label><input type="radio" autocomplete="off" name="radio_FLGBRQSAYK" value=""><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>decreased</strong> for the extreme skeptic.</span></label>
<div id="radio_CMJCCYMCTQ" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_CMJCCYMCTQ" value="answer"><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>increased</strong> for the extreme skeptic, but <strong>not</strong> as much as it has for the newborn.</span></label><label><input type="radio" autocomplete="off" name="radio_CMJCCYMCTQ" value=""><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>increased</strong> for the extreme skeptic, <strong>exactly as much</strong> as it has for the newborn.</span></label><label><input type="radio" autocomplete="off" name="radio_CMJCCYMCTQ" value=""><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>increased</strong> for the extreme skeptic, and <strong>much more</strong> than it has for the newborn.</span></label><label><input type="radio" autocomplete="off" name="radio_CMJCCYMCTQ" value=""><span>The belief in the hypothesis that <em>p</em> = 0.5, given the data, has <strong>decreased</strong> for the extreme skeptic.</span></label>
</div>
</div>
<p>Copy the R script below and run it. The script will plot the mean for the posterior when 10 heads out of 20 coin flips are observed, given a uniform prior (as in <a href="#fig-bayes8">Figure&nbsp;<span>4.6</span></a>). The script will also use the ‘binom’ package to calculate the posterior mean, credible interval, and highest density interval is an alternative to the credible interval.</p>
Expand Down Expand Up @@ -697,8 +697,8 @@ <h1 class="title"><span id="sec-bayes" class="quarto-section-identifier"><span c
<p>The posterior mean is identical to the Frequentist mean, but this is only the case when the mean of the prior equals the mean of the likelihood.</p>
<p><strong>Q5</strong>: Assume the outcome of 20 coin flips had been 18 heads. Change x to 18 in line 2 and run the script. Remember that the mean of the prior Beta(1,1) distribution is <span class="math inline">\(\alpha\)</span> / (<span class="math inline">\(\alpha\)</span> + <span class="math inline">\(\beta\)</span>), or 1/(1+1) = 0.5. The Frequentist mean is simply x/n, or 18/20=0.9. Which statement is true?</p>
<div class="cell" data-layout-align="center">
<div id="radio_OQIMKNEGID" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_OQIMKNEGID" value="answer"><span>The frequentist mean is <strong>higher</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>closer</strong> to the mean of the prior distribution.</span></label><label><input type="radio" autocomplete="off" name="radio_OQIMKNEGID" value=""><span>The frequentist mean is <strong>lower</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>closer</strong> to the mean of the prior distribution.</span></label><label><input type="radio" autocomplete="off" name="radio_OQIMKNEGID" value="answer"><span>The frequentist mean is <strong>higher</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>further from</strong> the mean of the prior distribution.</span></label><label><input type="radio" autocomplete="off" name="radio_OQIMKNEGID" value=""><span>The frequentist mean is <strong>lower</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>further from</strong> the mean of the prior distribution.</span></label>
<div id="radio_RLSFMJWMBU" class="webex-radiogroup">
<label><input type="radio" autocomplete="off" name="radio_RLSFMJWMBU" value="answer"><span>The frequentist mean is <strong>higher</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>closer</strong> to the mean of the prior distribution.</span></label><label><input type="radio" autocomplete="off" name="radio_RLSFMJWMBU" value=""><span>The frequentist mean is <strong>lower</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>closer</strong> to the mean of the prior distribution.</span></label><label><input type="radio" autocomplete="off" name="radio_RLSFMJWMBU" value="answer"><span>The frequentist mean is <strong>higher</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>further from</strong> the mean of the prior distribution.</span></label><label><input type="radio" autocomplete="off" name="radio_RLSFMJWMBU" value=""><span>The frequentist mean is <strong>lower</strong> than the mean of the posterior, because by combining the prior with the data, the mean of the posterior is <strong>further from</strong> the mean of the prior distribution.</span></label>
</div>
</div>
<p><strong>Q6</strong>: What is, today, your best estimate of the probability that the sun will rise tomorrow? Assume you were born with an uniform Beta(1,1) prior. The sun can either rise, or not. Assume you have seen the sun rise every day since you were born, which means there has been a continuous string of successes for every day you have been alive. It is OK to estimate the days you have been alive by just multiplying your age by 365 days. What is your best estimate of the probability that the sun will rise tomorrow?</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/05-questions.html
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ <h1 class="title"><span id="sec-questions" class="quarto-section-identifier"><sp
Cohen, J. (1994). The earth is round (p <span><span class="math inline">\(&lt;\)</span></span> .05). <em>American Psychologist</em>, <em>49</em>(12), 997–1003. <a href="https://doi.org/10.1037/0003-066X.49.12.997">https://doi.org/10.1037/0003-066X.49.12.997</a>
</div>
<div id="ref-colling_registered_2020" class="csl-entry" role="listitem">
Colling, L. J., Szűcs, D., De Marco, D., Cipora, K., Ulrich, R., Nuerk, H.-C., Soltanlou, M., Bryce, D., Chen, S.-C., Schroeder, P. A., Henare, D. T., Chrystall, C. K., Corballis, P. M., Ansari, D., Goffin, C., Sokolowski, H. M., Hancock, P. J. B., Millen, A. E., Langton, S. R. H., … McShane, B. B. (2020). Registered <span>Replication Report</span> on <span>Fischer</span>, <span>Castel</span>, <span>Dodd</span>, and <span>Pratt</span> (2003). <em>Advances in Methods and Practices in Psychological Science</em>, <em>3</em>(2), 143–162. <a href="https://doi.org/10.1177/2515245920903079">https://doi.org/10.1177/2515245920903079</a>
Colling, L. J., Szcs, D., De Marco, D., Cipora, K., Ulrich, R., Nuerk, H.-C., Soltanlou, M., Bryce, D., Chen, S.-C., Schroeder, P. A., Henare, D. T., Chrystall, C. K., Corballis, P. M., Ansari, D., Goffin, C., Sokolowski, H. M., Hancock, P. J. B., Millen, A. E., Langton, S. R. H., … McShane, B. B. (2020). Registered <span>Replication Report</span> on <span>Fischer</span>, <span>Castel</span>, <span>Dodd</span>, and <span>Pratt</span> (2003). <em>Advances in Methods and Practices in Psychological Science</em>, <em>3</em>(2), 143–162. <a href="https://doi.org/10.1177/2515245920903079">https://doi.org/10.1177/2515245920903079</a>
</div>
<div id="ref-de_groot_methodology_1969" class="csl-entry" role="listitem">
de Groot, A. D. (1969). <em>Methodology</em> (Vol. 6). <span>Mouton &amp; Co.</span>
Expand Down
Loading

0 comments on commit 2dcf67d

Please sign in to comment.