Chapter 5 Basics of _magpie

5.1 Basic concepts and architecture

The basic concepts and architecture of _magpie is covered in the _magpie quick start guide.

5.2 A first example

We will reimplement an online version of a questionaire study reported by Hoekstra et al. in a paper from 2014 that appeared in the Psychonomic Bulletin & Review under the title “Robust misinterpretation of confidence intervals.” (Hoekstra et al. 2014). The questionaire was a single paper page that looked like this:

The questionare used by Hoekstra et al (2014).

The questionare used by Hoekstra et al (2014).

5.2.1 Getting started

  • clone the “departure point” repository using
  • rename the folder to a more fitting name and move to it

  • download the required _magpie packages

  • open the file 04_trials.js and replace the previous object trial_info with the following:
  • now, try out the experiment by opening the file index.html in the browser

5.2.2 Adding more content

We now need to add the statements to be judged from the original paper, reproduced below:

  • “The probability that the true mean is greater than 0 is at least 95%.”,

  • “The probability that the true mean equals 0 is smaller than 5%.”,

  • “The “null hypothesis” that the true mean equals 0 is likely to be incorrect.",

  • “There is a 95 % probability that the true mean lies between 0.1 and 0.4.”,

  • “We can be 95 % confident that the true mean lies between 0.1 and 0.4.”,

  • “If we were to repeat the experiment over and over, then 95 % of the time the true mean falls between 0.1 and 0.4.”

The problem is: where / how should we add these statements with the simple template that we are using? Ideally they should appear between the question and the repsonse buttons. Ideally, the statements should be highlighted, e.g., in bold. Can you think of a creative solution? (Hint: you can include HTML code in the strings given to fields like question etc.) The solution is in this footnote.2

Finally, also add an item number to each trial, i.e., consecutively number each question by inserting, for example item: 1 for the first question, item: 2 for the second, etc.

5.2.3 Adding another view

The original paper also asked participants to rate their own statistical expertise on a scale from 1 (“no stats course taken”) to 10 (“teaching statistics at a university”). Let’s also add such a view before the questions about “confidence intervals” (because when not being able to answer the questions, participants might downgrade their self-assessed statistics expertise). We will use the template view for rating scales, which gives us a rating scale from 1 to 7, but that’s enough for our purposes here.

  • open the file 05_views.js

  • look at the documentation of the rating scale view and copy-paste the following code (at the end of the file):

  • open the file 06_main.js and add the view in the right place in the view sequence, i.e., change it to:

5.2.5 Finishing the job

Though the basic functionality is there, the experiment is not polished yet. Add an appropriate welcoming message instructions, and a begin view between the expertise rating and the yes/no questions. A complete example of this experiment can also be found here.


Hoekstra, Rink, Richard D. Morey, Jeffrey N. Rouder, and Eric-Jan Wagenmakers. 2014. “Robust Misinterpretation of Confidence Intervals.” Psychonomic Bulletin & Review 21 (5): 1157–64.

  1. You can write it like this: question: "Is the following statement a valid conclusion to draw from Prof. Bumbledorf's result, given the definition of a 'confidence interval'? <br><br> <strong>The probability that the true mean is greater than 0 is at least 95%.</strong>"