Translations of this page:
 

Single Factorial Design

This tutorial explains how to implement a simple single factorial questionnaire experiment (split ballot) with SoSci Survey without PHP code. It also explains the basics of randomization. Please read through these instructions first, even if you want to use an experimental design. In further instructions more complex implementations will be explained (Randomization).

Basics

Randomization (without repeated measures) means randomly assigning a participant to an experimental group. Depending on the assigned group, a question, text, image, or video is then varied (the treatment or stimulus).

Note: Even if the goal is “only” that, for example, half of the participants should answer question A and the other half of the participants should answer question B (random selection), or that the groups are presented with different stimuli, conceptually a division into experimental groups A and B occurs.

The assignment of participants to groups (randomization) can be thought of as if each participant were to draw a lot from a large lottery drum. On this lot, first of all, there is a number (code) for the experimental group. Then it's on to the experimental lab – Lab 1 for all with code 1, Lab 2 for all with code 2, and so on.

In the questionnaire it is a bit easier with the notes: Here you only need a question type Random Generator in which you enter which “notes” there are. In addition, it is immediately noted what is hidden behind the code in each case. You can enter here, for example, the name of the group, the stimulus (if it is a short text) or its file name (if it is an image). The random generator is then placed in the questionnaire on a page like a normal question. When the participant comes to the page, he is assigned one of these notes.

During the draw, the random number generator writes the code of the drawn note into the data set. This is needed for the evaluation and possibly for more sophisticated variants of randomization. The next step is to apply the experimental treatment, which in the online survey is usually the presentation of a stimulus. The following explains the experimental variation of images, audio and video. If questions and texts (not just words) need to be randomized, you will need the Randomization with PHP-Code later.

Preparation

Images, videos and audios are basically randomized the same way, only the HTML codes for displaying them look slightly different. This tutorial first describes how to randomize images, and then explains what changes for videos and audio files.

Step 1: Stimuli Upload

If you want to use images, you may first need to save them in a web-ready format with a suitable pixel size. This is explained in more detail under Images in the Questionnaire.

The media files (images, videos, audio files) are uploaded to the survey server under Image and Media Files. More about this under Media files in the questionnaire (audio, video, documents).

Note: Make a note of the file names after uploading, as you will need them in a later step!

Step 2: Random Generator

For the next step you have to create a random generator. A random generator is a question type, which means that you need to create a New Question of the type “random generator”. To do this, create a new section in the List of Questions or open one of the existing sections. In the section you create a New Question. As Type select the “Random Generator”.

Tip: You can simply click the selection field for the Type and enter the name. The question type will already be suggested to you after a few letters.

Now give your question (the random generator) a Description. After saving, the random generator receives an identifier. Using this identifier, you will later also find the associated variable in the data set.

Note: If you have difficulties creating questions, or have never done this before, please read the chapter An Online Questionnaire in 5 Minutes.

To make the random generator display one of the uploaded images directly in the questionnaire, you need to enter the file names of the images in the random generator (3) and enter some HTML code (4) in the random generator so that the image is also displayed.

Step 3: Enter Filenames

In the random generator you have just created, now enter the file names of the images in the Codes (contents): field (see step 1). This could look like this, for example:

giraffe.jpg
car.jpg
books.jpg

Important: Pay precise attention to upper and lower case, also for the file name extension. If the filename is Giraffe.JPG, neither giraffe.JPG or Giraffe.jpg would work!

After saving (button to save), the random generator automatically assigns a numerical code to the images. It will look like this:

1 = giraffe.jpg
2 = car.jpg
3 = books.jpg

Note: If you do not want to show any image at all to an experimental group (control group), enter a tilde (~) in one line. The tilde ensures that the random generator does not display any HTML code (see below) when this note is dragged.

1 = giraffe.jpg
2 = car.jpg
3 = books.jpg
4 = ~

Step 4: HTML-Code

The random generator can now pull one of the filenames – but it doesn't know what you want to do with it yet. In this case, we want to display the image saved under the file name in the questionnaire. Therefore we use a small piece of HTML code.

Enter the following HTML code in Random Generator under Display Contents:

<div>
  <img src="%random%" alt="">
</div>

But maybe you want to make sure that the image is centered (text-align: center), and that there is a little space at the top and bottom (margin: 3em 0) and that oversized images (e.g. also when displayed on mobile devices) are automatically reduced to the page width (max-width: 100%)? Therefore you can use the following refined HTML-Code:

<div style="text-align: center; margin: 3em 0">
  <img src="%random%" style= "max-width: 100%" alt="">
</div>

When the random generator is then displayed in the questionnaire, it replaces the Placeholders %random% with the drawn note.

Step 5: Questionaire

Finally, you need to tell SoSci Survey where you want the image to be displayed in the questionnaire in the first place. To do this, place the random generator in the desired position under Compose Questionnaire (for further reading: Compose the Questionnaire).

For testing, start the questionnaire on the page with the random generator (Start questionnaire from current page).

Tip: If you just reload the questionnaire page in the browser (F5 key), the questionnaire will always show the same image. Under Compose Questionnaire, start a new interview (Start Questionnaire from Current Page) so that a new note is drawn.

Variants: Audio und Video

Videos and audio files can in principle be integrated in the same way as images. But the HTML code in Random Generator looks different. More about this in the tutorial Media files in questionnaire.

Stimulus: Video

Enter the file names of the videos under Codes (Contents) in the random generator, e.g.

slow01.mp4
slow02.mp4
fast01.mp4
fast02.mp4

Under Display contents you then have to enter an HTML code which will embed the corresponding video into the questionnaire. This could look like the following for videos:

<video width="512" height="288" controls controlsList="nodownload" style="max-width: 100%">
  <source src="%random%"  type="video/mp4">
</video>

When it comes to the HTML code for embedding videos, you have numerous design options. For example, you can show/hide certain controls or start the video automatically. You can read more about this in Embedding Videos using HTML5 and in the many documentations on the HTML tag <video>, e.g. w3schools.com: HTML video.

Stimulus: Video-Variants

For videos, there is a possibility to offer different file formats (e.g. mp4, webm and ogg) to the browser. This is also possible when randomizing videos, if you have prepared the corresponding files and uploaded them to the survey project.

Make sure that the front part of the file name is always the same for the different formats of a video, e.g. fast01.mp4, fast01.webm and fast01.ogg. Then enter in the random generator only the front part of the file name as Code (contents):

slow01
slow02
fast01
fast02

In the HTML code, you then add the file extensions after the placeholder %random%.

<video width="512" height="288" controls controlsList="nodownload" style="max-width: 100%">
  <source src="%random%.mp4"  type="video/mp4">
  <source src="%random%.webm"  type="video/webm">
  <source src="%random%.ogg"  type="video/ogg">
</video>

Stimulus: Audio

After uploading the audio files (see Preparation), enter the file names of the audio files in the random generator under Codes (contents). With a tilde (~) you can also prevent the inclusion of the audio file for a control group here.

mozart.mp3
bach.mp3
schubert.mp3
~

Under Display Contents enter HTML code that embeds audio files:

<audio id="audio_with_controls" preload="auto" autoplay controls controlsList="nodownload">
  <source src="%random%" type="audio/mpeg" />
</audio>

Extensive customizations are also possible for audio files, e.g. whether playback should start automatically, whether and how the player should be displayed. You can read more in: Media: Embedding of an mp3 using HTML5.

en/create/randomization-einfaktoriell.txt · Last modified: 20.04.2021 20:28 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki