Internet Research Methods in Psychology

Internet Research Methods in Psychology
Seminar - PSYC 593 CF
CRN: 48584
Thur 12:15 - 2:15
Room: 219 A


R. Chris Fraley, PhD
Department of Psychology, Room 409
E-mail, phone, and other information:

Class web page


Jan 17, 2011

Updates will be posted here throughout the semester.

There is one book for this class:

Fraley, R. C. (2004). How to conduct behavioral research over the Internet: A beginner's guide to HTML and CGI/Perl. New York: Guilford.

It is not available at the Univ. bookstore, so you'll need to order a copy on-line. You can obtain copies at or the Guilford Press.

You will also need a web hosting account for this class. I use Netfirms hosting for everything I do and I encourage you to do the same so you can follow along with some of my "step by step" explanations of things. You can see Netfirm's hosting packages via this link. The most basic, paid packages range from $4 to $12 per month.

Technically, you can get "free" hosting via Netfirms. However, as of late 2010, you still need to pay approximately $8 for a domain name itself. I strongly discourage you from following the "cheap" route unless you're strapped for funds. The advantages of having a legit account are numerous and, if your time is worth money, you'll save a lot of it by investing in a paid account. Half of the problems students have had in this class in the past have stemmed from using a "free" account that gets low-priority by the hosting service in terms of CPU time, bandwidth, etc.

Overview of the Course

During the past decade, an increasing number of psychologists have begun to use the Internet as a tool for conducting psychological research. It is easy to understand the appeal of using the Web for research purposes. Just about any study that can be conducted via traditional pencil-and-paper methods can be implemented on-line, but without the hassles of data entry by hand, the scheduling of participants, and paper costs. Moreover, researchers who use computers in their experiments for manipulating visual or narrative stimuli, randomizing trials, or creating customized assessments can easily implement their protocols on-line. Most importantly, although researchers can use the Web simply as an efficient way to collect data from undergraduates in their departmental subject pools, the Web allows us to open our laboratory doors to people from across the world.

My objective in this class is to teach you how to create web programs so that you can use the Internet as a medium for conducting psychological research. We will focus on CGI programming in Perl. CGI programs are designed to run on a web server, and, unlike standard HTML web pages, these programs can be used to create a dynamic, interactive web experience for the user. By using CGI programs, researchers can (a) randomize the presentation order of stimuli, (b) randomly assign subjects to conditions, (c) automatically save response data to a file for data analysis, (d) provide subjects with customized feedback based on their responses, (e) exploit both text and image-based stimuli, (f) measure reaction times, and (e) employ complex branching operations within a project.

Throughout the semester we will work our way through these and other topics, beginning with the basics (e.g., how to create a simple web page using HTML) and progressing through the more complex topics (e.g., how to write CGI/Perl scripts that create customized feedback to subjects). We will also discuss some conceptual and practical issues, such as those concerning ethics, sampling, data security, the quality of Internet data, and how to submit IRB's for web-based research. If time permits, we will devote time to some "hot topics," such as creating Facebook apps.

This class is intended for anyone who currently conducts research in the behavioral sciences. The seminar is designed to be a practical one and, as such, will be of most use to students who actually want to use the Internet to collect data.

The Class Webpage

I will post lecture notes and other materials relevant to the class on the class web page. You should treat the class web page as your primary syllabus. I will be updating it on a regular basis and it will be your responsibility to keep up-to-date on any changes that are made. (I will, however, announce significant changes in the lecture sessions.)

Workload, Grading, and Expectations

We will work through approximately one chapter of the book a week. I will introduce the basic concepts to you in class and walk you through some examples. After that introduction, however, I expect you to read the chapter and work through the examples discussed therein. You probably need to set aside 6 hours a week outside of class for reading and practicing your programming skills.

You will be given mini-projects throughout the semester as a way of keeping you on track and helping you evaluate your strengths and weaknesses. From a grading perspective, one of the nice things about web design is that a program either works or it does not and, more importantly, it is quite clear when the program is working well. As such, these projects will be graded on a pass/fail basis.

Beyond these assignments, you will have one mega-project for the class. Specifically, I will ask you to create a sophisticated web study from the ground up. This study will be one of your choosing and, as such, it should be one that fits naturally into your research program. I realize that some people have more lofty ambitions than others, so I will work with you early in the semester to ensure that your project is manageable (if it originally seems too complex) or more complex (if it originally seemed too simple and unchallenging).

If you do not have some sense of what you would like to do for your final project by the end of the first week, this is not the right class for you. I say this because there is limited space in the class and I want to make sure that those taking it are the ones most likely to benefit from it.

Policy on Missed Tests and Assignments

Homework assignments should be organized on your personal website. You should create a directory called "p5930" and in that folder create a web page called "homework.htm". A link to each homework assignment should be listed there, along with the date in question and links to any perl code that was used. I will start reviewing homework assignments on Thursdays at 9:00 a.m. If you have not completed your assignment by that time, it will be considered late and, depending on what kind of time I have available to me, potentially overlooked. Example:

Student Homework Links

I will list the links to the student homework pages here for easy reference.

Jessie Chin
Jason Fanning
Luis Flores
Jing Jin
Florian Lorenz
Melanie Tannenbaum

Schedule for the Class

I will be constructing my lectures over the course of the semester. As the lectures and plans become more crystallized, I'll post the necessary materials on the class web page. The outline below is a preliminary outline (i.e., one that is subject to change) of what will be covered during the lab sections of the class.

Date Topic Files or links
Jan 20 Introduction: What can be done over the Internet. Creating a web server account. Lecture notes 1 - Internet Possibilites [PowerPoint]

Lecture notes 2 - Setting up a web server via Netfirms [PowerPoint]

Some useful links for EditPlus and Netfirms
EditPlus Great text editor for windows
Netfirms web hosting
Jan 27/Feb 3 How to make a basic HTML web page

Useful links to HTML sources
HTML colors and references
CSS tutorials and references
HTML table tutorial
HTML Tags and attributes
Lecture notes 3 - Creating HTML web pages [PowerPoint]

Details on homework assignment [create a web page]

Feb 10 HTML forms: Collecting research data from participants

From this point forward, PowerPoint lecture files won't be of much good to us. Today we will discuss the use of HTML forms. We will focus on the code for the following form, To view the HTML code, right-click on it and choose the view source option.

We will also begin a rudimentary discussion of CGI. The code for the script we will use can be copied and pasted from here,

Details on homework assignment [create a web page questionnaire with Perl script]

Feb 17 An introduction to CGI scripting: Using Perl to save automatically response data to a file AND Providing customized feedback to research participants
Some new concepts we'll introduce: processing data, foreach loops, writing data to a text tile, reading (and using) data stored in a text file, if/else conditions

Here are some files we'll be using today:

form3.htm [text file version]


form4.htm [text file version]

Details on homework assignment [create a Perl script that processes data] Note: Just do 1-3 given what we covered today.

Feb 24 Using Perl to deliver HTML, connecting multiple web pages, hidden tags, for-next loops and more about arrays

Administer questionnaire items via perl [text file version]

Script that processes's data [text file version]

Do it all (administer items and process data) with 1 script [text file version]

Present items on separate pages - hidden tags [text file version]

The basics of a for loop [text file version]

Using the for loop to access elements of an array [text file version]

Using the for loop with arrays to present questionnaire items [text file version]

March 3 More on multiple pages and Subroutines

Hidden tags and multi-page layouts [text file version]

Basic subtroutine [text file version]

Basic subtroutine with parameters [text file version]

Subtroutine: parameters, indexing, returning values [text file version]

Subtroutine: Additional examples [text file version]


Create a set of subroutines that will automate some processes that are commonly used in Internet based research applications. Also, illustrate the use of these subrounines in a perl script application.

1. A routine that automatically creates the radio buttons for items that require 1 to 7 rating scales.

2. A routine of your own chosing--something that does something useful given your research interests.

Mar 10 Random assignment to conditions and randomizing the order of stimuli

A discussion or foreach [text file version] [text file version]

Randomize a list [text file version]

Randomly select 1 item from a list [text file version]

Toss a coin: Heads or tails? [text file version]

Random assignment to conditions [text file version]

Random assignment to conditions - 2 x 2 design [text file version]

Randomize order in which questions or stimuli appear [text file version]

Randomize question order while presenting questions across multiple pages [text file version]

Randomize both the order of questionnaires/blocks and items/stimuli within a questionnaire/block [text file version]


Create a script that uses randomization in a way that isn't redunant with some of the examples we discussed today. Feel free to be silly if you wish, or to be ultra-utilitarian if you prefer. Whatever you do, be sure to make it clear that you have mastered how to randomize things effectively in Perl. Your homework needs to include a link to the live webpage as well as the text for the Perl script(s).

Mar 17 Project Workshop


A fast food chain has hired you to create a preference survey for some products that they are considering placing on the market. You goal is to create a web-based survey that their customers can choose to complete in exchange for coupon codes.

The survey needs to present five products in a random order for each customer. For each of the five products, the customer needs to rate how much they would enjoy eating the product on a 1 to 7 scale with anchors of your choosing. The customer also needs to indicate how likely (0 to 100 percent) he or she would be to buy the product at various prices (0.50, 1.00, 1.50, 2.00, 2.50 dollars). These five prices need to be randomly set for each product.

In addition, you need to collect some basic demographic information on each customer (i.e., sex, age, state of residence, ethnicity). Finally, at the completion of the survey, you need to assign the participant a 10-character (alphanumeric) coupon code that he or she can use to redeem at a local store in exchange for a free drink. The code needs to be unique for each participant and the same code cannot be used more than once.

The data, of course, will need to be saved to a text file.

Additional details:

- The five products are as follows: Tofu & beef burrito, Fish tacos, the Fourth Meal Burrito, the Burr-it-to-go, and Smokey cheddar face melt.

Bo- nus points for images. Also, please use your creative imagination to elaborate upon the product descriptions (e.g., Burr-it-to-go might be a burrito blended in Burr blender, in a cup with a straw) so that customers have a better sense of what they are evaluating.

-- Each product should be presented on a separate page instead of having all five presented on a common page.

March 31 Graphical displays of data using HTML/CGI tricks and jquery/flot

Individual files for copying and pasting:
Interface for demonstrating bargraphs [text file]

Image files used for the bargraph
[right-click these and save them to your computer. The script calls them from an /images/ directory in www, so, if you transfer them to your server, create an images folder and place them there]

The actual code for creating a simple bargraph [text file]

Basic lecture notes on jQuery and resources
Fraley's jQuery notes [txt file]
Official jQuery site

Flot example page:

Bar Graphs in flot/jQuery [text file]

Scatterplots and line graphs in flot/jQuery [text file]

Intergrating 'live' data from Perl with flot/jquery [text file]


For this assignment I would like for you to create a simple Perl script that does one or more of the following:

1. Provides the user with rich, graphical feedback (i.e., barplots and 1 scatterplot).


2. Provides you (i.e., the researcher) with a special page that can be used to get some quick data analyses. Specifically, a page that shows the means for some variables, uses some barplots, and uses the scatterplot application.

Also, I have one 'challenge' for you to push your creative problem solving skills:

3. Create a feedback page that allows the user (whether that be the subject or YOU--as the administrator of the project) to choose which of two variables to plot against one another.

Example (without code showing):

April 7 Tracking participants over multiple sessions: Usernames, passwords, and menus

Before we get started, go to your Netfirms account and create a new folder within your www directory called 'data'.

The scripts for this week are listed as separate text files, but they all function together. To see them in action, visit this link: Login page example.

Individual files for copying and pasting:
login.htm [right click on page to view source] [text file] [text file] [text file] [text file]


For this assignment I would like for you to create a simple Perl script that does the following:

1. Requires people to create an account and then login to the site.

2. Once logged in, a simple (serious or fun) study is presented. This doesn't need to be anything fancy. It is just filler so the other parts of the project don't feel empty.

3. Has a menu page that reports how many times and when the person has participated in the past. This part will require you to innovate a bit.

Please post your perl code on your homework page as a text file.

April 14 Assessing Response Times

Simple example of measuring response times [text file]

Simple example of measuring response times with data analysis [text file]

Example of measuring response times with random trial orders [text file]

April 21 Final Project Workshop

Final project workshop. Come to class with ideas, flowcharts, scripts, and questions.
April 28 Final Project Workshop

Final project workshop. Come to class with ideas, flowcharts, scripts, and questions.
May 6 Final Project

Final project due.