Introductory Lab Introduction The purpose of this lab exercise is to

advertisement
Introductory Lab
Introduction
The purpose of this lab exercise is to familiarize you with the computers and procedures we’ll use in this
course. We will conduct a simple magnitude estimation experiment, using it to measure a phenomenon
known as the “Horizontal-Vertical Illusion”. Then we’ll use Excel to calculate the means and standard
errors of the data, and graph the results.
Magnitude estimation is perhaps the simplest of perceptual experiments. The observer is presented with
a stimulus (e.g. a line, a tone, a light) and is asked to provide a number that corresponds to the
stimulus’s magnitude (its length, its loudness, its brightness). The method has the advantage that it is
very direct.
There are a number of variations on the basic magnitude estimation procedure. At the start of this
experiment, you will be shown a horizontal line whose magnitude is defined to be 100. Your task is to
judge the length of other lines relative to this standard. So if the line looks half as long as the standard
you should call it 50, if it looks twice as long you should call it 200, and so forth.
We will go through the material in this handout in lab section, but the steps below will serve as a
reminder.
Setting Up
Open the common folder “0044”. You can access it by double-clicking on the 0044 icon on the
computer desktop. You will see the MagnitudeEst folder where the experimental code is kept. The
0044 folder is accessible by all the class members but you cannot make changes to the files there. You
will need to make a copy of the MagnitudeEst folder and move it to your local disk (e.g., put it on your
desktop, or make a folder to put it in). To do this, right-click on the MagnitudeEst folder in the Dist
folder, select Copy. Then right-click on the desktop and select Paste. This will place a copy of the
folder on the desktop.
In this experiment, you can alter the experimental parameters by opening the HorizVertExp.m file
which is in the MagnitudeEst folder.
Running the experiment
1) The experiment is run from inside the MATLAB application. The first step is to launch MATLAB.
Do this by double-clicking the MATLAB icon on the desktop. If MATLAB is already running you may
proceed to step 2. It is not necessary to quit MATLAB and re-launch.
2) To enable the experiment to be run, MATLAB must be able to find the correct folders. This is done
by setting the path. You change the directory in the MATLAB command window. Click on the tab
marked “Current Directory” in the middle of the left half of the window. It will likely default to the
Desktop, but you can use the “…” button to browse for the Magnitudeest directory, or use the buttons
nearby to change directories.
3) In the Current Directory window, double-click on HorizVertExp.m. This will come up in a separate
window which will contain a bunch of text. The text is the program for running the experiment, but you
will not need or be expected to understand it as part of this experiment. You can change program
parameters as will be discussed in the lecture.
4) You can run the experiment in two ways:
•
Click ‘Run’ under the ‘Debug’ menu in the MATLAB M-File editor.
Psychology 0044
Intro Lab
Page 2
OR
•
Type HorizVertExp directly into the MATLAB command window and press enter.
5) The script will begin by blanking the screen and showing you standard line. A message will
announce that the standard line should be considered to have length 100. After you have studied the
standard line and are ready to begin, hit any key to begin the experiment. Note that the mouse cursor is
not visible at this stage, so you cannot click on the OK button to proceed. The cursor has been hidden
so that it will not interfere with the experiment.
6) The script will present you with a series of trials. On each trial, a horizontal or vertical line will
appear briefly. After the line is presented you may enter your magnitude estimate (however, don’t type
too soon or your entry will not be accepted). You may use the delete key if you make a mistake. Once
you have entered the desired number, press return to start the next trial. Again, the mouse cursor is not
visible.
7) When you have completed all of the trials, the Windows screen will return to normal. Your data has
been placed on the clipboard, ready to be saved into Excel.
8) In the response box you have three options
•
If for some reason, you want to quit the experiment in the middle, enter the value q as your estimate.
This will cause the program to exit and you may start again.
•
If you enter s in the response box, you will see the standard length again.
•
If you enter r in the response box, the program will reshow the previous trial. You may use this
option if you failed to see the stimulus for one reason or another.
Saving your data into Excel
1) Immediately after running the experiment, you will want to save your data into an Excel document.
The first step is to launch Excel. Do this from the Start Menu. When Excel is launched, it creates a new
document which will appear in a window. If Excel is already running, you do not need to quit from it.
Rather, select the New item from the File menu to create a new document.
2) Select the upper left cell in the Excel document by clicking the mouse in it. Select the Paste item
from the Edit menu. Your data will appear in the document.
3) Use the Save item from the File menu to save your data to the disk. The most common mistake at
this point is to save your data into the wrong folder. To avoid this, navigate through the various folders
using the dialog box before you save the file (see the “Windows Frequently Asked Questions” handout
for more details). Give the file a name you will recognize later. A good name might be
HorizVertData.XXX.1 where XXX are your initials. If you collect a second data set you can call it
HorizVertData.XXX.2 or some such. File names such as Foobar or Joe are not useful, since they
convey no information about their contents.
4) You may notice that your data appear in scientific notation. Sometimes this is useful and sometimes
not. You may change the appearance of the data. First select all of your numbers by selecting cell A2,
holding the mouse down, and dragging all the way over to cell H15. This will highlight all of the
numbers. Then use the Number... item of the Format menu. You will be presented with a dialog box
that gives you many numerical format options. Choose the one you like—try selecting “General”.
5) Some sample data are shown below.
Psychology 0044
Intro Lab
Page 3
Understanding your data
The data show up as an array of numbers in Excel. The first column of the data provides the lengths (in
arbitrary units called pixels) of the lines you were presented with. The next two columns tell you what
the orientation of the lines were: 0 for horizontal lines, 90 for vertical. The “Arrow Length” and “Arrow
Angle” columns are not important for this experiment. When Arrow Angle is 0, it means you saw only
straight lines with no arrow-heads. The next two columns contain your magnitude estimates. The
design of the experiment is that there are 7 lengths, and each length is presented 4 times horizontally and
4 times vertically, for a total of 56 judgments. Therefore there are 4 columns with your judgments.
Each column has 14 rows, corresponding to the 7 vertical stimulus lengths plus the 7 horizontal stimulus
lengths.
You can probably get some sense of your data just by staring at the numbers. For example, if you read
down a column, you would expect the numbers to grow larger, since you would expect longer lengths to
lead to larger estimates. By comparing the estimates of, say, a single horizontal line, you can get some
sense of the reliability of your estimates.
But staring at numbers is difficult. Graphs are much more helpful. But what to graph? One possibility
is the means of your estimates for horizontal and vertical lines. Another is the standard errors of these
means. It is very easy to compute these numbers in Excel. We will then use Excel to plot these
numbers.
Computing the means and standard errors in Excel
1) Select the top cell in the empty column I. Enter a label for that column, say Average. Type return to
accept your entry. Notice that the text you type appears both in the cell and in Excel’s command bar.
You can use the mouse to move the cursor in the command bar text if you like. Select the top cell in the
empty column J. Enter a label for that column, say SEM.
2) Now you are ready to compute the mean length for each stimulus length. Select the second cell in
column I (cell I2), just below the label Average. Enter the following text into the cell:
“=AVERAGE(E2:H2)”. (Do type the equals, don’t type the period or the quotation marks.) Then press
return. Notice that a number appears in this cell. When you start a cell entry with an equals sign, it
Psychology 0044
Intro Lab
Page 4
means you are entering a formula. What the formula you just entered says is set the value of the cell
equal to the average of the numbers in the range E2 to H2. These numbers are your magnitude
estimates for the length of the horizontal bar of length 70. Notice that the formula itself (rather than the
number) appears in Excel’s command bar. The distinction between the number displayed in a cell and
the formula is important. You can always check what is really in a cell by looking at the command bar.
3) Once you have entered your formula for cell I2, you could repeat the steps in 2 for the rest of the cells
in column I. But there is a simpler way. Click on cell I2. Then, while holding the mouse down, drag
the mouse down the column to as far as cell I15. Then let up the mouse. Cells I2 through I15 (I2:I15)
will be highlighted. Now select the Fill-Down item from the Edit menu. This fills your formula down.
The fill down operation is very clever, because the formula is updated for each row. Click on cell I3
and look at the formula. Notice the numbers averaged are I3:H3, not I2:H2 as you typed in your
original formula. By using the Fill Down command you have computed a whole bunch of means at
once.
4) You may compute the standard error of the mean in an analogous fashion. The appropriate formula,
to go into cell J2, is “=STDEV(E2:H2)/SQRT(4)”. We will discuss the standard error later in the
course. For now you may just enter it and then fill down.
5) Save your spreadsheet. You may simply use the Save command from the File menu.
Graphing using Excel
The next and final move is to graph your data. Be sure to have your “Graphing in Excel” handout handy
for details on how to set up the graph.
1) In your Excel spreadsheet, you probably noticed that the means for the horizontal estimates and the
means for the vertical estimates appear in one big column. You’ll want to put the horizontal means and
vertical means in separate columns. To do this: in Excel, select cells I2 through I8 and choose the
Copy item. These are the horizontal means. Somewhere else in the worksheet (or in an new worksheet)
copy the selected items to a new position where the data from different line lengths can be arranged in
columns. Do this by selecting a cell to copy to and select Paste Special… from the Edit menu and
click on the Values button (so that you copy the numbers rather than the formulae). Now transfer the
vertical means by selecting cells I9 through I15, copying in Excel, and pasting next to the cells for the
horizontal means.
2) Repeat the process in step 3 for your horizontal and vertical standard errors.
3) Label your columns by typing text into a cell that is directly above the first item of each column.
4) Now make a line graph of your data. Put the stimulus lengths on the x axis, and the horizontal and
vertical magnitude estimates on the y axis (see the Graphing Style handout).
5) At this stage, the plot will be pretty ugly. Now is a good time to get some practice changing things
like plot symbol, axis scale, axis labels, fonts, etc. Play around and try to make a nice plot.
6) Finally, add your error bars.
10) You may save your graph using the Save item under the File menu. What name will you give it?
You may also print it using the Print item.
Psychology 0044
Intro Lab
Page 5
11) A sample graph is below.
Magnitude Estimate
140
120
Observer DHB
Horizontal
100
Vertical
80
60
60
80
100
120
140
Stimulus Length (pixels)
Your assignment
Your assignment is to go through the exercise above and produce a graph of your data. You and your
lab partner should each collect data separately and make a separate graph. You may, however, work on
both graphs together. Hand in the graph of your data along with a very short paragraph describing any
observations you would like to make about your data. Are your estimates veridical? Are your estimates
for horizontal lines the same as for vertical lines? How do you feel about the magnitude estimation
procedure?
The basic procedures you go through in this exercise will be used again and again in the course. The
purpose of today’s lab is to make sure you are comfortable with running a MATLAB experiment,
getting the data into Excel, analyzing it, and graphing it. Next week you will do a more complete
magnitude estimation experiment and use the data you collect to write your first lab report.
Download