'
}
Optional Exercise - multiple images
...................................
Copy the ``factorial`` experiment to make a new experiment. Modify ``experiment.js`` to show two images in the
full-factorial design -- in other words, your list of factors will have two lists of images in it. When you add
these to the node above, it will look something like this:
.. code:: javascript
var two_images = {
type: 'html-keyboard-response',
stimulus: function() {
return (
'Well done!
and in the CSS file, something like this: .. code:: css .positivefeedback { color: green; } In experiments it's often more expedient to put this directly into the HTML. You can do this using the ``style`` attribute: .. code:: htmlWell done!
.. important:: CSS uses the American spelling for "color". If you write "colour" it will be ignored! Optional Exercise -- Stroop, list approach .......................................... The `Stroop effectred
In an *incongruent* trial, the name of a colour is printed in a different colour: .. raw:: htmlblue
The Stroop effect means that, on average, participants take longer to name the colour of the text in an incongruent trial than a congruent one. You could (as above) write another full-factorial experiment to implement a Stroop test. If you did this with four colours (for example) then a quarter of the trials would be congruent and three-quarters would be incongruent: ====== ====== =========== Colour Text Condition ====== ====== =========== red red congruent red green incongruent red blue incongruent red yellow incongruent green red congruent green green incongruent green blue incongruent green yellow incongruent etc. etc. etc. ====== ====== =========== In a real experiment you'd want to statistically compare the congruent and incongruent conditions -- and for this it would be better to have half of each. The most straightforward way to do this would be to write a list yourself, with half congruent and half incongruent trials: .. code:: javascript var stroop_variables = [ { colour: "blue", text: "blue", condition: "congruent" }, { colour: "red", text: "blue", condition: "incongruent" }, .... ]; You can use this the same way you use the output from the ``factorial`` function. Define a fixation node and a Stroop test node, using one of the approaches above, either: * Use ``jsPsych.timelineVariable`` where you need the ``colour`` and ``text`` values. * Use a loop to accumulate a list of nodes. ``condition`` can go in to the ``data`` field of the node, so you will see "congruent" and "incongruent" in the results. Once you've got this working, see if you can use ``jsPsych.randomization.repeat`` to show the trials in a random order. Solution ........ Here is an :ref:`example solution