# cleanIAT function in R IAT package

Has anyone used cleanIAT (function in IAT package) to compute D-scores for their IAT data? Have you noticed any discrepancies between your D-scores and those of colleagues that used another program (e.g., SPSS) to clean the same data? Can anyone describe each column in cleanIAT s output?

While the manual says:

"Outputs a dataframe that must be saved to an object. The variable IAT is the calculated D-Score for each individual. SUBEXCL notes any exclusion criteria, with 0 being inclusion data, 1 for exclusion due to fast response, and 2 for exclusion due to missing blocks. C indicates standard deviation for combined blocks (correct trial only), while A indicates standard deviations for combined blocks (all trials). M (mean), E (percent error), N (number of trials used), and F (percent fast responses), are reported for each block included in the original dataframe."

There are a number of columns that are in the output that aren't explained in the documentation. For example, there are three IAT scores (3 D-scores?). And there are 2 S scores and 2 C scores.

I'd like to start an ongoing discussion about this because the package isn't mentioned at all in forums and "cleanIAT" gives zero results in Google Scholar.

• Could you post a reproducible example. E.g., perhaps show us the input and output using the built in dataset. Nov 25 '15 at 3:57
• I guess you could read the authors code either by typing cleanIAT or looking at the function on github: github.com/dpmartin42/IAT/blob/master/R/cleanIAT.R Or perhaps see whether the author, Dan, would post an answer here: dpmartin42.github.io Nov 25 '15 at 4:07

So I'm the author of the IAT package in R. It's based on the original scoring algorithm outlined in this publication. Because the scoring algorithm is based on a standard 7-block IAT, the score IAT1 corresponds to the D score relative to the difference between blocks 6 and 3, while IAT2 corresponds to the D score relative to blocks 7 and 4. IAT is then simply the mean of IAT1 and IAT2, and represents the overall D-score of the test. In a simple applied example, you might use this variable as the outcome in a simple t-test to see if there is an effect of some treatment group versus a control group.

One thing to keep in mind when using the IATData loaded with the package is that there are order effects due to randomization of whether participants received stereotype congruent sorting first or stereotype incongruent sorting first. Thus, the D score needs to be calculated separately between these two groups, otherwise the D score would be flipped for half of the participants (see the example in ?cleanIAT to see what I mean).

As for discrepancies, I never tested against SPSS code, but it was designed to replicate the SAS macro used by the Nosek lab exactly.

Finally, a faster version using dplyr is available for download off of my github if you're interested:

library(devtools)
install_github("dpmartin42/IAT")

• thank you SO MUCH. This makes so much sense. I will try your dplyr version. Dec 4 '15 at 16:23
• no problem, if you have any other questions feel free to shoot me an email Dec 4 '15 at 16:48
library(IAT)
library(psych)
cleaned_IAT <- cleanIAT(myData = IATData,
blockName = "BLOCK_NAME_S",
trialBlocks = c("BLOCK2", "BLOCK3", "BLOCK5", "BLOCK6"),
sessionID = "SESSION_ID",
trialLatency = "TRIAL_LATENCY",
trialError = "TRIAL_ERROR",
vError = 1, vExtreme = 2, vStd = 1)
IAT1        IAT2        IAT
1  0.8555243  0.95158711  0.9035557
2  0.7539783  0.69624171  0.7251100
3  0.7563726  0.97124441  0.8638085
4  0.4719366 -0.01613619  0.2279002
5  0.3891048  0.88868891  0.6388969
6 -1.0321507 -0.59671619 -0.8144334
describeBy(cleaned_IAT[,c("IAT1","IAT2","IAT")])
vars  n mean   sd median trimmed  mad   min  max range  skew kurtosis   se
IAT1    1 88 0.26 0.57   0.32    0.28 0.64 -1.03 1.28  2.31 -0.39    -0.63 0.06
IAT2    2 88 0.28 0.62   0.29    0.29 0.73 -1.09 1.41  2.50 -0.19    -1.04 0.07
IAT     3 88 0.27 0.54   0.27    0.29 0.67 -0.82 1.22  2.04 -0.19    -0.96 0.06

• So my question then is, do I need to subset this by group (like gender) to make comparisons between those groups, or was the IAT paradigm designed so that negative and positive values reflect bias toward one group or another? Depending on which stimuli were assigned to Blocks 2, 3, 5, and 6? Dec 1 '15 at 16:26