Saturday, March 6, 2010

Using the PEBL Survey Generator

Version 0.10 of PEBL offers a survey generator, distributed in the Test Battery. It is designed to offer only limited interaction, so that the respondent sees only the survey questions and keys must make responses to continue. And as an experimenter, you can design it simply by editing a .csv file in your favorite spreadsheet or text editor.

There are a lot of web-based options for creating surveys.  PEBL won't run via a web browser, and so if you want to create a web survey, this is not the tool for you.  This will run on a dedicated computer, without internet access.  It is probably most useful for getting demographic information during a laboratory or field study, and this is mainly how I have used it in the past.

It is located in the test battery under the survey/ directory, but you need to tune it to your own situation. Here's how:




Features of the survey generator



The survey generator allows you to specify a sequence of screens which either provide information or request responses. One such screenshot is shown on the right. By editing a .csv file in a spreadsheet, you create the survey. Responses and time taken for each response are saved into a file for later processing; and the file gets saved according to a subject code which is the first response input during the survey.


Baseline survey demo
The baseline survey is set up to run at a resolution of 1024x600.   The layout is fairly flexible, so if you change the hard-coded resolution by editing survey.pbl, it will adapt to fit.  It has a title "PEBL Survey Generator" and a logo file hard-coded into the file survey.pbl. Finally, it uses by default the file questions.csv to specify the survey, and saves output as output/response-X.csv. You may want to change some or all of these parameters. The survey is set up to scale fairly easily to other screen sizes.

To customize the overall look and feel, open the file survey.pbl in a text editor, and look for the following lines:



Screen size:

Screen size is controlled by
gVideoWidth <- 1024  
gVideoHeight <- 600
Change these to a pixel width/height that your screen can handle. You can make the screen larger, but making it smaller may not afford enough space to use some of the survey questions.

Logo:

The logo is controlled by the line:
gLogoFileName <- "images/logo.png" #change to your own logo file. (400x80)

To use a different logo, create a 400x80 image (png, bmp, gif, or jpg) and save it in the survey directory. Then change the file name in the above line.

Title:
The title is specified by:

gSurveyLabel <- "PEBL Survey Generator"

Edit this line to change the name of the survey. To remove the survey text, change it to "".


Input and output files:
Input file is specified by:

dat <- ReadCSV("questions.csv")
 

Change questions.csv to some other csv file you want to use.

Output file is specified by the line:

 

fileout <- FileOpenAppend("output/results-"+gSubNum+".csv")

Note that this creates a file that depends on the variable gSubNum, which saves data for a subject to a file that depends upon their subject code. 
 
Defining the questions
The different types of questions are defined in a .csv file. The first column is a question ID which gets copied to the output file. The second file is typically a text description that appears in the survey. The rest of the columns depend on the question type, and are described in the next section. If you create the CSV file in excel, you sometimes have to be careful that it doesn't append empty lines at the end.  If the survey crashes when you get to the end of the questions, edit the questions.csv file with a text editor, and delete any lines at the end that only have commas



Types of screens
The survey generator offers sevenl different screen types. The third column of the questions.csv file controls which type of survey question is used.













Here is a description of the different question types, and the codes in column C used to specify them:

Type: Instruction
Code: inst
Description: Give a text instruction to user, who clicks 'next' to continue.
Notes: Text in column 2 of csv.





Type: Long answer
Code: long
Description: Probe with a question, allow respondent to type a long answer, which gets verified when complete.
Notes: Text in column 2 of csv.








Type: Short answer
Code: short
Description: Probe with a question, allow respondent to type a short answer and continue by hitting enter.
Notes: Text in column 2 of csv.






Type: Multiple choice
Code: multi
Description: Probe with a question, allow respondent to click on one of a set of answers.
Notes: Text in column 2 of csv. Column 3 contains a number describing how many options. Columns 4-N contains the response labels.








Type: Multiple check
Code: multicheck
Description: Probe with a question, allow respondent to click on any responses that apply.
Notes: Text in column 2 of csv. Column 3 contains a number describing how many options. Columns 4-N contains the response labels.





Type: Likert scale
Code: likert
Description: Probe with a question, allow respondent to click on an anchored scale
Notes: Text in column 2 of csv. Column 3 contains the number of responses.




Type: Image view
Code: image
Description: Show an image and give text. No direct input availabile.
Notes: Text in column 2 of csv. Column 3 contains name of image file.





Data output
The data are saved to a .csv file with the following columns:
subject code, question id, timestamp, response, type, response_time, response2
In these files, you can ignore response in favor of response2.

Tips and Tricks
* Under windows, you do not need to run the pebl launcher to execute a survey. Create a file called run.bat, and edit with a text editor. Put the following in the file:

"c:\Program Files\pebl\bin\pebl.exe" survey.pbl --fullscreen

This will execute the survey fullscreen. Because the subject code gets entered in the experiment, the launcher really isn't necessary.

* To abort an experiment mid-run, hit ctrl-shift-alt-\ simultaneously.
* If you accidentally reuse a subject code, the data will get appended to the data file (not overwritten).
* If the subject uses the 'back' button, response for that question will be recorded twice. You must filter the data to look at just the last response.

Summary
There are many online tools that allow you to easily create surveys. But sometimes you don't have access to the internet or wish to run a survey within a series of other tests. The PEBL survey generator allows you to develop fairly complex surveys with little effort, and you don't need web access to run the survey.

Here is a screencast of what taking the survey looks like:



8 comments:

mikele said...

Thank you for good program. Is it possible to combine picture and Lickert scale in survey?

Shane Mueller said...

In the current survey program, there is no 'picture-likert'. It would not take much effort to create this, and I'll put it on my request list.

TheCanadianExperience said...

With the multiple response checklist, is it possible to have more than 4 responses? I mean, yes you can add more but they don't display nicely. A dynamic/scrolling screen might be nice to accommodate the need for more space.

-Reid @ OHSU

Shane Mueller said...

I know I've adapted the multi-choice to fit 6 (and it probably would go to 7) on a 1440x900 screen. If your screen supports a taller resolution, try setting it in the beginning of the script, which will make a little more room at the bottom.

Unfortunately, complex scrolling widgets are a bit outside the scope of PEBL in the near future.

M-E Bissey said...

Hello, is it possible to limit the time people can use to answer questions in the survey? I imagine that one could add some PEBL commands for that (which I still need to investigate). I was wondering if there was a ready-made solution.

Unknown said...

I have done this with a custom entry box in an experiment I ran last summer; this is not part of the default survey generator though. Email me and I'll see what I can dig up.

M-E Bissey said...

Thank you, I have managed to introduce timeouts substituting the "waitForKeyPressed" commands with "waitForKeyPressedWithTimeout" and fiddling a little with the program... It seems to work for all questions except those with multiple answers. At the moment, it is enough for what we want.
Though if you have a more elegant solution, I'd be happy to see it.

My email: marieedith.bissey@unipmn.it

M-E Bissey said...

Hello again,
you said in response to a July 2010 comment that it should not be hard to allow the combination of images and questions... have you done it?

Thank you for your help