Assignment 7

Submit Assignment


Due Sunday by 5pm                              Points 200                               Submitting a file upload

File Types m, png, jpg, bmp, tiff, jpeg, and gif                                        Available after Jan 1, 2019 at 12am


Creating an Auditory or Visual Discrimination Experiment


Grading:

TBA


The assignment is to write a Matlab program that collects data in a discrimination experiment, calculates signal detection indices for user performance, and writes a file containing the data for each participant tested. There are two general directions for this assignment. You can choose from the following options:

 Create an auditory discrimination task where the user discriminates between tones of different frequencies. You can read in Ch. 5 about the sound functions offered by Matlab. The “signal” consists of four tones randomly sampled from a normal distribution with a mean of 1100 Hz and a standard deviation of 100 Hz. The “standard” (also called “noise” trials) consists of four tones randomly sampled from a normal distribution with a mean of 1000 Hz and a standard deviation of 10 Hz. Listeners are presented four 50-ms tones separated by 50-ms silent gaps and are asked to decide whether the tones were sampled from the signal distribution or from the standard distribution[1]. Here are some examples of sounds associated with signal: example 1, example 2example 3, example 4. Here are some examples of sounds associated with the standard trials: example 1, example 2, example 3, example 4. Here is an example of what the output of the program can look like (there is also audio in this clip):


●  Or… create a visual discrimination task where the user discriminates between two types of visually presented stimuli. You can read in Ch. 6 about the process of creating and visualizing images. You can decide what type of discrimination task to implement. For example, the task can involve discrimination of Gabor patches of different angles/frequencies, detection of faces or other objects in noise or detecting if two images are the same or different. You can use any type of stimulus that you find interesting. There needs to be a distinction though between a noise trial and a signal trial. That usually implies some asymmetry in the task, where the signal trial involves detecting the presence of some feature or relationship and the noise trial involves detecting the absence of some feature or relationship. For example, the task could be detecting if the image contains a face (signal) or not (noise). Here is example output where the task is to determine whether the two 3D objects can be mentally rotated into alignment (i.e., detecting a ''signal'' is detecting that the two objects are the same 3D object). The images for the code came from this paper (https://openpsychologydata.metajnl.com/articles/10.5334/jopd.ai/) .


REQUIREMENTS

●  The program should first ask for the id of the user.

●  The program should ask for the number of trials n in the discrimination task. The number n should be an even number.

●  The program should randomly allocate n/2 signal events and n/2 noise events to the n trials

●  The randomization should be the same for each user id. In other words, if we restart the program with the same user id, we should get the same sequence of trials (i.e., make sure you are setting the random seed)

●  On each trial, a signal or noise event should be presented (sound or image) and the user has to respond with a signal or noise decision using letters or numbers as responses. You do not have to implement a graphical user interface for the task. Simply use the command window to present feedback and receive user input from the keyboard. [If you are working on the auditory experiment and you are running out of time, don't spend too much time trying to get the details of the sounds exactly right. We will deduct points for sound stimuli that are coded incorrectly, but it is more important that you program the overall structure of the experiment correctly].

●  The user should receive feedback after each trial (correct or incorrect)

●  After n trials are completed, calculate the following

1. The probability of a hit (i.e. probability that a user reports a signal when the stimulus was sampled from the signal distribution)

2. The probability of a false alarm (i.e., probability that a user reports a signal when the stimulus was sampled from the noise/standard distribution).

3. Sensitivity (d’) and the bias (beta) index from Signal Detection Theory as described on p. 183 (Ch. 7) . There is a problem calculating d’ when the observed hit or false alarm rates equal 0 or 1. There are several elegant solutions to this problem (including Bayesian analysis) but we will not pursue those here. One ad-hoc solution you can use is to replace the empirical hit or false alarm rates of 0 or 1 with fixed values of 0.01 and .99 respectively.

●  Show these performance numbers on the command line (the video clips above didn't show the prob of hit and false alarm but please do include those)

●  The data should be saved to a .mat Matlab file. The filename should be constructed in such a way that it is unique. The filename should have the user id in the file. You should save all the data that is need to reconstruct what happened in the discrimination task including all individual decisions. Also save the signal detection indices calculated at the end of the task.


GRADING

This assignment is worth 200 points. Feel free to ask the instructor and TA for feedback on preliminary versions of your program, especially when you get stuck on some aspect of the assignment. This feedback is provided only in class.


TEAM WORK

You can work on this assignment individually or as part of a team (maximum four students). Sign up for a group in Canvas (I think you have to do this even if working individually). The work from a team (1 to 4 students in size) is assigned a grade which is then assigned to all members of the team. We will check the code for overlap with code created by other students as well as code found on the internet. Submit your own code.


[Note 1] When tones are turned on or off abruptly, a click is often heard. The perception of this click can be minimized by gradually ramping the stimulus on to full intensity or off to zero intensity. Modify the waveform by adding linear ramps that are 10-ms in duration to the beginning and end of the tone. Alternatively, you can use the function "smooth" with a span of around 10 to smooth out the intensities.