C code for analyzing confidence ratings data using signal detection
This repository contains the code needed to analyse confidence-ratings recognition memory data (Morey, Pratte, & Rouder, 2008). This code is old; I am putting it here for archival purposes. Much of this code was superseded by the hbmem R package, but this code may be interesting for learning purposes.
The files included are:
File name | Description |
---|---|
sd2.c | C source code for analysis |
sd2.exe | Windows executable for analysis |
cygwin1.dll | Libraries required for the executable to run in Windows |
an2.dat | Example data (simulated data) |
an2.chn | Example chains; the result of the analysis |
analysis.R | R code to analyze the chains that the executable outputs |
chains.pdf | PDF file of the chains from the example data, from the R analysis |
items.pdf | PDF file of item effects from the example data, from the R analysis |
The data files to be analyzed must be in a specific format to work. See the an2.dat file for an example.
Each ROW of the input file is one participant.
- ODD columns are the response (1...K) that the participant made to a particular item.
- EVEN columns indicate whether the item in the column immediately to the left was studied or unstudied (1 or 0, respectively)
Each column represents the same item for each participant. For instance, if the column 1 for participant 1 is their response for "COMPUTER," then column 1 for participant 2 (row 2) contains participant 2's response to "COMPUTER".
Missing values: if there is no data for a participant-by-item combination, make the response for that combination -1 in the data file. Studied or unstudied can be anything.
In the output chains, item 1 correponds to column 1, item 2 to column 2, etc. The same holds for rows/participants.
sd.exe
runs the analysis. The executable must be used with arguments, like this:
sd2.exe 10000 4 10000 2 1 2 1 .2 an2
Arguments:
- MCMC iterations
- Number of response categories (>2)
- Prior variance on
mu_s
andmu_n
population means a
for the IG prior on process variancessigma^2_n
andsigma^2_s
b
for the IG prior on process variancessigma^2_n
andsigma^2_s
e
for the IG prior on random effect variancesf
for the IG prior on random effect variances- Metropolis step standard deviation
- Name of analysis.
- [optional] Data file to analyze. If this is not specified, argument 9 determines the name (e.g.,
[NAME].dat
)
Any questions can be directed to Richard Morey at richarddmorey@gmail.com.