<p>So I'm the author of the IAT package in R. It's based on the original scoring algorithm outlined in <a href="http://faculty.washington.edu/agg/pdf/GB&amp;N.JPSP.2003.pdf" rel="nofollow">this publication</a>. 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.</p>

<p>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).</p>

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

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

<pre><code>library(devtools)
install_github("dpmartin42/IAT")
</code></pre>

CC BY-SA 3.0
2015-12-04T16:23:37.763Z
thank you SO MUCH. This makes so much sense. I will try your dplyr version.
Nick Michalak
CC BY-SA 3.0
2015-12-04T16:48:54.193Z
no problem, if you have any other questions feel free to shoot me an email
dmartin
CC BY-SA 3.0
2015-12-02T21:22:58.250Z
2015-12-02T21:22:58.250Z
dmartin
<pre><code>library(IAT)
library(psych)
cleaned_IAT &lt;- 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)
head(cleaned_IAT[,c("IAT1","IAT2","IAT")])
        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
</code></pre>

CC BY-SA 3.0
2015-12-01T16:26:34.857Z
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?
Nick Michalak
CC BY-SA 3.0
2015-12-01T16:23:19.570Z
2015-12-01T16:23:19.570Z
Nick Michalak
<p>Has anyone used cleanIAT (function in <a href="https://cran.r-project.org/web/packages/IAT/IAT.pdf" rel="nofollow">IAT package</a>) 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?</p>

<p>While the manual says:</p>

<blockquote>
  <p>"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."</p>
</blockquote>

<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2015-11-25T03:57:59.593Z
Could you post a reproducible example. E.g., perhaps show us the input and output using the built in dataset.
Jeromy Anglim
CC BY-SA 3.0
2015-11-25T04:07:50.657Z
I guess you could read the authors code either by typing `cleanIAT` or looking at the function on github: https://github.com/dpmartin42/IAT/blob/master/R/cleanIAT.R Or perhaps see whether the author, Dan, would post an answer here: http://dpmartin42.github.io/
Jeromy Anglim
<cognitive-psychology><social-psychology><statistics><software><social-cognition>
cleanIAT function in R IAT package
Nick Michalak
# cleanIAT function in R IAT package

(Asked by: username_0 on 2015-11-16)

Has anyone used cleanIAT (function in [IAT package](https://cran.r-project.org/web/packages/IAT/IAT.pdf)) 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.

**Tags:** cognitive-psychology, social-psychology, statistics, software, social-cognition

> **Comments:**
> **username_1**: Could you post a reproducible example. E.g., perhaps show us the input and output using the built in dataset.  
> **username_1**: I guess you could read the authors code either by typing `cleanIAT` or looking at the function on github: https://github.com/dpmartin42/IAT/blob/master/R/cleanIAT.R Or perhaps see whether the author, Dan, would post an answer here: http://dpmartin42.github.io/  

---

## 2 answers

### Answer by username_2 on 2015-12-02. Score: 1

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")

> **Comments:**
> **username_0**: thank you SO MUCH. This makes so much sense. I will try your dplyr version.  
> **username_2**: no problem, if you have any other questions feel free to shoot me an email  

---

### Answer by username_0 on 2015-12-01. Score: 0

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)
head(cleaned_IAT[,c("IAT1","IAT2","IAT")])
        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

> **Comments:**
> **username_0**: 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?  

---

