06. Sample experiment: Priming Design

Menu

Loading wiki pages...

View
Wiki Version:
<p><strong>NOTE: this page assumes you are familiar with notions covered in <a href="https://osf.io/t72h6/wiki/04.%20Sample%20trial:%20Picture%20selection%20%26%20Audio%20playback/" rel="nofollow">this page</a> and <a href="https://osf.io/t72h6/wiki/05.%20Sample%20trial:%20Rating%20scale%20%26%20Input%20box/" rel="nofollow">this page</a>.</strong></p> <p><em>Next: <a href="https://osf.io/t72h6/wiki/07.%20How%20to%20use%20a%20spreadsheet/" rel="nofollow">How to use a spreadsheet</a></em></p> <p>@<a href="Sections" rel="nofollow">toc</a></p> <h3>Setup</h3> <p>Create a new experiment on Ibex. Click on Update from git repo and enter the following URL: <code><a href="https://github.com/PennController/Sample-Experiment-Priming-Design-beta0.4.git" rel="nofollow">https://github.com/PennController/Sample-Experiment-Priming-Design-beta0.4.git</a></code>, then click on the Sync button. You should see a confirmation message appear below the button, reading Success: N file modified. If you don't see the message, try clicking again. If it still does not work, reload your Ibex page and try again.</p> <p><em>Warning</em>: whenever you click on Sync, the file example_data gets erased and reverts back to the code in the Basics section below.</p> <h3>Basics</h3> <p>OK, so now we know how to build simple trials. But the design of a full experiment usually consists of more than one screen where to click a button or type a word. Let us consider a priming design: we want our participants to report how warm they perceive a color after picking between two color patches.</p> <p>To start with, what we want is simply create one trial of each type. The code below combines and adapts some code from the <em><a href="https://osf.io/t72h6/wiki/06.%20Sample%20trial:%20Rating%20scale/" rel="nofollow">Picture selection</a></em> page and from the page <em><a href="https://osf.io/t72h6/wiki/07.%20Sample%20trial:%20Text%20input/" rel="nofollow">Rating scale</a></em> page.</p> <p>Note: In order to have the PennController functions available, keep working on one of the experiments you created, but copy and paste the code below to replace the full content of <em>example_data.js</em>. (Creating a new experiment without importing the PennController files from Github will not work!)</p> <pre class="highlight"><code class="language-js">var shuffleSequence = seq(&quot;trial&quot;); PennController.ResetPrefix(null); PennController.AddHost(&quot;<a href="http://files.lab.florianschwarz.net/ibexfiles/PennController/SampleTrials/" rel="nofollow">http://files.lab.florianschwarz.net/ibexfiles/PennController/SampleTrials/</a>&quot;); var items = [ // Picture selection trial [&quot;trial&quot;, &quot;PennController&quot;, PennController( defaultImage .settings.size(200, 200) , newText(&quot;test sentence&quot;, &quot;Which patch is greener?&quot;) .print() , newCanvas(&quot;patches&quot;, 500, 200) .settings.add( 0, 0, newImage(&quot;color1&quot;, &quot;green1.png&quot;) ) // Embedded image creation .settings.add( 300, 0, newImage(&quot;color2&quot;, &quot;green2.png&quot;) ) // Embedded image creation .print() , newSelector(&quot;patch&quot;) .settings.add( getImage(&quot;color1&quot;) , getImage(&quot;color2&quot;) ) .wait() )] , // Rating trial [&quot;trial&quot;, &quot;PennController&quot;, PennController( newText(&quot;green&quot;, &quot;To me the color green is...&quot;) , newScale(&quot;judgment&quot;, &quot;cold&quot;, &quot;cool&quot;, &quot;lukewarm&quot;, &quot;warm&quot;, &quot;hot&quot;) .settings.labels(&quot;top&quot;) .settings.before( getText(&quot;green&quot;) ) .settings.size(&quot;auto&quot;) // Use max width for each cell (here, lukewarm's cell's width) .print() .wait() )] ];</code></pre> <h3>More trials</h3> <p>This is nice, but our priming design won't be much informative if we have but one trial of each type. Let's add a second pair of trials: we simply duplicate what we already have, append it to the end and bring minimal changes.</p> <pre class="highlight"><code class="language-js">var shuffleSequence = seq(&quot;trial&quot;); PennController.ResetPrefix(null); PennController.AddHost(&quot;<a href="http://files.lab.florianschwarz.net/ibexfiles/PennController/SampleTrials/" rel="nofollow">http://files.lab.florianschwarz.net/ibexfiles/PennController/SampleTrials/</a>&quot;); var items = [ // Picture selection trial (GREEN) [&quot;trial&quot;, &quot;PennController&quot;, PennController( defaultImage .settings.size(200, 200) , newText(&quot;test sentence&quot;, &quot;Which patch is greener?&quot;) .print() , newCanvas(&quot;patches&quot;, 500, 200) .settings.add( 0, 0, newImage(&quot;color1&quot;, &quot;green1.png&quot;) ) .settings.add( 300, 0, newImage(&quot;color2&quot;, &quot;green2.png&quot;) ) .print() , newSelector(&quot;patch&quot;) .settings.add( getImage(&quot;color1&quot;) , getImage(&quot;color2&quot;) ) .wait() )] , // Rating trial (GREEN) [&quot;trial&quot;, &quot;PennController&quot;, PennController( newText(&quot;green&quot;, &quot;To me the color green is...&quot;) , newScale(&quot;judgment&quot;, &quot;cold&quot;, &quot;cool&quot;, &quot;lukewarm&quot;, &quot;warm&quot;, &quot;hot&quot;) .settings.labels(&quot;top&quot;) .settings.before( getText(&quot;green&quot;) ) .settings.size(&quot;auto&quot;) .print() .wait() )] , // Picture selection trial (PURPLE) [&quot;trial&quot;, &quot;PennController&quot;, PennController( defaultImage .settings.size(200, 200) , newText(&quot;test sentence&quot;, &quot;Which patch is purpler?&quot;) .print() , newCanvas(&quot;patches&quot;, 500, 200) .settings.add( 0, 0, newImage(&quot;color1&quot;, &quot;purple1.png&quot;) ) .settings.add( 300, 0, newImage(&quot;color2&quot;, &quot;purple2.png&quot;) ) .print() , newSelector(&quot;patch&quot;) .settings.add( getImage(&quot;color1&quot;) , getImage(&quot;color2&quot;) ) .wait() )] , // Rating trial (PURPLE) [&quot;trial&quot;, &quot;PennController&quot;, PennController( newText(&quot;green&quot;, &quot;To me the color purple is...&quot;) , newScale(&quot;judgment&quot;, &quot;cold&quot;, &quot;cool&quot;, &quot;lukewarm&quot;, &quot;warm&quot;, &quot;hot&quot;) .settings.labels(&quot;top&quot;) .settings.before( getText(&quot;green&quot;) ) .settings.size(&quot;auto&quot;) .print() .wait() )] ];</code></pre> <h3>Trial order</h3> <p>Good, but what if we want to ask our participants to do both picture selection trials first and both rating trials at the end? We could re-order our trials in our <code>items</code> variable, but there is a much simpler way of doing it. We just need to use different <strong>labels</strong> for each trial type, and refer to them in our <code>shuffleSequence</code> variable, like this (note that the order of definition in the <code>items</code> variable is still the same as above):</p> <pre class="highlight"><code class="language-js">// First run all the trials labeled 'picture,' then run all the trials labled 'rating' var shuffleSequence = seq(&quot;picture&quot;, &quot;rating&quot;); PennController.ResetPrefix(null); PennController.AddHost(&quot;<a href="http://files.lab.florianschwarz.net/ibexfiles/PennController/SampleTrials/" rel="nofollow">http://files.lab.florianschwarz.net/ibexfiles/PennController/SampleTrials/</a>&quot;); var items = [ // Picture selection trial (GREEN) [&quot;picture&quot;, &quot;PennController&quot;, PennController( defaultImage .settings.size(200, 200) , newText(&quot;test sentence&quot;, &quot;Which patch is greener?&quot;) .print() , newCanvas(&quot;patches&quot;, 500, 200) .settings.add( 0, 0, newImage(&quot;color1&quot;, &quot;green1.png&quot;) ) .settings.add( 300, 0, newImage(&quot;color2&quot;, &quot;green2.png&quot;) ) .print() , newSelector(&quot;patch&quot;) .settings.add( getImage(&quot;color1&quot;) , getImage(&quot;color2&quot;) ) .wait() )] , // Rating trial (GREEN) [&quot;rating&quot;, &quot;PennController&quot;, PennController( newText(&quot;green&quot;, &quot;To me the color green is...&quot;) , newScale(&quot;judgment&quot;, &quot;cold&quot;, &quot;cool&quot;, &quot;lukewarm&quot;, &quot;warm&quot;, &quot;hot&quot;) .settings.labels(&quot;top&quot;) .settings.before( getText(&quot;green&quot;) ) .settings.size(&quot;auto&quot;) .print() .wait() )] , // Picture selection trial (PURPLE) [&quot;picture&quot;, &quot;PennController&quot;, PennController( defaultImage .settings.size(200, 200) , newText(&quot;test sentence&quot;, &quot;Which patch is purpler?&quot;) .print() , newCanvas(&quot;patches&quot;, 500, 200) .settings.add( 0, 0, newImage(&quot;color1&quot;, &quot;purple1.png&quot;) ) .settings.add( 300, 0, newImage(&quot;color2&quot;, &quot;purple2.png&quot;) ) .print() , newSelector(&quot;patch&quot;) .settings.add( getImage(&quot;color1&quot;) , getImage(&quot;color2&quot;) ) .wait() )] , // Rating trial (PURPLE) [&quot;rating&quot;, &quot;PennController&quot;, PennController( newText(&quot;green&quot;, &quot;To me the color purple is...&quot;) , newScale(&quot;judgment&quot;, &quot;cold&quot;, &quot;cool&quot;, &quot;lukewarm&quot;, &quot;warm&quot;, &quot;hot&quot;) .settings.labels(&quot;top&quot;) .settings.before( getText(&quot;green&quot;) ) .settings.size(&quot;auto&quot;) .print() .wait() )] ];</code></pre> <p>Now that we have conveniently labeled our trial types, we can even use the <code>randomize</code> function to present the trials within each type-sequence in a random order:</p> <pre class="highlight"><code class="language-js">// randomize runs all the labeled trials in a random order var shuffleSequence = seq(randomize(&quot;picture&quot;), randomize(&quot;rating&quot;));</code></pre> <p>(The rest of the code is not reported here for brevity, as nothing else needs to be modified)</p> <h3>Next</h3> <p>Our script is getting a little long, and we only have 4 trials so far. Yet, in order to get anything of interest with our priming design, we probably want more trials than that, maybe 10 of each.</p> <p>At this point, it is smart to start <strong><a href="https://osf.io/t72h6/wiki/07.%20How%20to%20use%20a%20spreadsheet/" rel="nofollow">using a spreadsheet to design our experiments</a></strong>, which will provide the values for the variable elements in each trial: the dialogue lines for the rating trials, and the sentence for the input trials.</p>
OSF does not support the use of Internet Explorer. For optimal performance, please switch to another browser.
Accept
This website relies on cookies to help provide a better user experience. By clicking Accept or continuing to use the site, you agree. For more information, see our Privacy Policy and information on cookie use.
Accept
×

Start managing your projects on the OSF today.

Free and easy to use, the Open Science Framework supports the entire research lifecycle: planning, execution, reporting, archiving, and discovery.