cleanIAT: Data analysis function: Processes and cleans raw IAT data

View source: R/cleanIAT.R

cleanIATR Documentation

Data analysis function: Processes and cleans raw IAT data

Description

Prior to running, please see combineIATfourblocks(). This function processes, cleans, and scores the combined IAT data. In addition, it returns diagnostics (see examples, below). By default, the function implements the D-score algorithm (Greenwald et al., 2003, p 214, center column). Because it assumes users were forced to correct errors, no error penalty is imposed (unless the user requests it; see below). The function can be easily configured to do other scoring procedures as well. The function accepts as an input four vectors of IAT responses (see prac1, crit1, prac2, and crit2, below). It returns a list containing a variety of IAT variables, including matrices of clean latencies and other information (see below). The most important is clean$D, which is the final D scores for the analysis. Users can also extract clean block means for each participant using clean$clean.means.prac1, clean$clean.means.crit1, clean$clean.means.prac2, and clean$clean.means.crit2. Users can extract matrices of clean latencies using clean$clean.latencies.prac1, clean$clean.latencies.crit1, etc. Raw latencies can be requested with clean$raw.latencies.prac1, etc. Users can request to know whether a trial was correct with clean$clean.correct.prac1, etc. and precisely which stimulus was used on a given trial with clean$clean.stim.number.prac1, etc. (Stimuli are numbered based on their order entered within each category and following the sequence "positive, negative, tgtA, tgtB". For example, stimulus 1 is the first positive stimulus). See below for more information on what is returned from this function. The data cleaning function adheres to Greenwald et al. (2003; see also Lane et al., 2005, p. 92 for a simplified table of data cleaning steps). There are four main data cleaning options. First, long responses are usually dealt with by setting timeout.drop=TRUE (enabled by default), which drops individual trials over a given threshold (timeout.ms, which is 10000 ms by default). Next, overly short responses (i.e., button mashing) are dealt with by setting fastprt.drop=TRUE (enabled by default), which drops participants who have too many fast responses (more than a fastprt.percent proportion [default = .10] of responses faster than fastprt.ms [default = 300 ms]). Alternatively, one can remove individual fast trials by setting fasttrial.drop=TRUE (disabled by default), which uses a default threshold of fasttrial.ms=400 ms. (This is seldom used but enables users to use alternative scoring methods [e.g., Greenwald et al., 2003, p 214, right column]). Finally, an error penalty is imposed on incorrect responses in some variants. If the IAT forces participants to correct errors, then no error penalty should be imposed (error.penalty=FALSE, the default setting). However, if participants are not forced to correct errors, one is added. Most common is a 600 ms penalty above the clean block mean (Greenwald et al., 2003), which is done by setting error.penalty.ms=600, sometimes known as the D600 scoring procedure. Greenwald et al. (2003) also suggested one could use two standard deviations instead of 600 ms, which is done by setting error.penalty.ms="2SD". Finally, the function ensures that the data are not corrupted (i.e., JavaScript malfunction on participant's computer when completing the survey) by requiring that only appropriate characters (numbers, commas, "C", "X", and "END) are in the raw data.

Usage

cleanIAT(
  prac1,
  crit1,
  prac2,
  crit2,
  timeout.drop = TRUE,
  timeout.ms = 10000,
  fasttrial.drop = FALSE,
  fasttrial.ms = 400,
  fastprt.drop = TRUE,
  fastprt.percent = 0.1,
  fastprt.ms = 300,
  error.penalty = FALSE,
  error.penalty.ms = 600,
  inclusive.sd = TRUE
)

Arguments

prac1

A vector of one kind of practice responses (e.g., compatible practice), one per participant.

crit1

A vector of that same kind of critical responses (e.g., compatible critical), one per participant.

prac2

A vector of the other kind of practice responses (e.g., incompatible practice), one per participant.

crit2

A vector of that same kind of critical responses (e.g., incompatible critical), one per participant.

timeout.drop

(Required, set TRUE by default). Tells the procedure to drop trials over a certain duration; recommended by Greenwald et al. (2003).

timeout.ms

(Required if timeout.drop=TRUE; set to 10000 by default). Following the Greenwald et al. (2003), individual trials over 10000 ms are dropped (scored as missing). Ignored if timeout.drop=FALSE.

fasttrial.drop

(Required, set FALSE by default). Tells the procedure to drop trials under a certain duration. Not recommended but was validated by Greenwald et al. (2003) as an alternative to dropping fast participants.

fasttrial.ms

(Required if fasttrial.drop=TRUE; set to 400 ms by default). The threshold for fastprt.drop, above. Ignored if fastprt.drop=FALSE.

fastprt.drop

(Required, set TRUE by default). If enabled, follows Greenwald et al. (2003) in which participants who have more than 10 percent of responses (fastprt.percent = .10) faster than 300 ms (fastprt.ms=300) are dropped entirely.

fastprt.percent

(Required if fastprt.drop=TRUE; set to .10 by default). Set the proportion threshold for fastprt.drop, above. Ignored if fastprt.drop=FALSE.

fastprt.ms

(Required if fastprt.drop=TRUE; set to 300 ms by default). Sets the time threshold for for fastprt.drop, above. Ignored if fastprt.drop=FALSE.

error.penalty

(Required, set FALSE by default). Logical value stating whether an error penalty is added. This should be disabled if forced error correction was used in the IAT and enabled otherwise (Greenwald et al., 2003).

error.penalty.ms

(Required if error.penalty=TRUE; set to error.penalty.ms=600 by default). Following the D600 procedure, IAT errors are scored as the correct-trial block mean plus an error penalty of 600 ms. Can be manually set to any desired value. One can also use the 2SD penalty [Greenwald et al., 2003, p 214, right column] by setting error.penalty.ms="2SD". Ignored if error.penalty=FALSE.

inclusive.sd

Unused parameter.

Value

Returns a list containing several important elements. skipped is a vector indicating whether the participant completed the IAT or skipped it. They are dropped from analysis if the IAT was skipped. raw.latencies.prac1 is a matrix of the raw latencies in the first practice block prior to any data cleaning. raw.latencies.crit1 is a matrix of the raw latencies in the first critical block prior to any data cleaning. raw.latencies.prac2 is a matrix of the raw latencies in the second practice block prior to any data cleaning. raw.latencies.crit2 is a matrix of the raw latencies in the second critical block prior to any data cleaning. raw.stim.number.prac1 is a matrix of the raw stimuli ID numbers in the first practice block prior to any data cleaning. raw.stim.number.crit1 is a matrix of the raw stimuli ID numbers in the first critical block prior to any data cleaning. raw.stim.number.prac2 is a matrix of the raw stimuli ID numbers in the second practice block prior to any data cleaning. raw.stim.number.crit2 is a matrix of the raw stimuli ID numbers in the second critical block prior to any data cleaning. raw.correct.prac1 is a matrix stating whether each trial was correct (logical) in the first practice block prior to cleaning. raw.correct.crit1 is a matrix stating whether each trial was correct (logical) in the first critical block prior to cleaning. raw.correct.prac2 is a matrix stating whether each trial was correct (logical) in the second practice block prior to cleaning. raw.correct.crit2 is a matrix stating whether each trial was correct (logical) in the second critical block prior to cleaning. timeout.drop is the logical value stating whether this feature was enabled in the function call (see above). timeout.ms is the timeout threshold specified in the function call (see above), used if timeout.drop is enabled. num.timeout.removed is the grand total number of trials removed because they exceeded the timeout threshold in timeout.ms. timeout.rate is a vector indicating the proportion of responses per participant that were scored as missing due to timeouts. num.timeout.removed.prac1 is the number of trials removed in the first practice block because they exceeded the timeout threshold in timeout.ms. num.timeout.removed.crit1 is the number of trials removed in the first critical block because they exceeded the timeout threshold in timeout.ms. num.timeout.removed.prac2 is the number of trials removed in the second practice block because they exceeded the timeout threshold in timeout.ms. num.timeout.removed.crit2 is the number of trials removed in the second critical block because they exceeded the timeout threshold in timeout.ms. fasttrial.drop is the logical value stating whether this feature was enabled in the function call (see above). fasttrial.ms is the time threshold specified in the function call (see above), used if fasttrial.drop is enabled. num.fasttrial.removed is the grand total number of trials removed because they exceeded the fasttrial threshold in fasttrial.ms. fasttrial.rate is a vector indicating the percentage of responses per participant that were scored as missing due to rapid speeds. num.fasttrial.removed.prac1 is the number of trials removed in the first practice block because they exceeded the fasttrial threshold in fasttrial.ms. num.fasttrial.removed.crit1 is the number of trials removed in the first critical block because they exceeded the fasttrial threshold in fasttrial.ms. num.fasttrial.removed.prac2 is the number of trials removed in the second practice block because they exceeded the fasttrial threshold in fasttrial.ms. num.fasttrial.removed.crit2 is the number of trials removed in the second critical block because they exceeded the fasttrial threshold in fasttrial.ms. fastprt.drop is the logical value as specified by the function call (see above). fastprt.ms is the threshold for as specified in the function call (see above), used if fastprt.drop is enabled. fastprt.percent is the proportion of trials specified in the function call (see above). drop.participant is a logical vector indicating whether the participant's responses have been dropped due to excessive fast responses (if fastprt.drop is enabled). fastprt.count is the number of participants dropped for excessive fast responding (if fastprt.drop is enabled). fastprt.rate is the proportion of participants dropped for excessive fast responding (if fastprt.drop is enabled). error.penalty is a logical value stating whether an error penalty is enabled. error.num.prt is a vector of the number of erroneous trials per participant (after data cleaning is complete). error.rate.prt is a vector of the proportion of erroneous trials per participant (after data cleaning is complete). error.rate is the proportion of the entire set of clean trials which are erroneous trials. error.rate.prac1 is the proportion of the prac1 block set of clean trials which are erroneous trials. error.rate.crit1 is the proportion of the crit1 block set of clean trials which are erroneous trials. error.rate.prac2 is the proportion of the prac2 block set of clean trials which are erroneous trials. error.rate.crit2 is the proportion of the crit2 block set of clean trials which are erroneous trials. clean.latencies.prac1 is a matrix of the clean latencies in the first practice block. clean.latencies.crit1 is a matrix of the clean latencies in the first critical block. clean.latencies.prac2 is a matrix of the clean latencies in the second practice block. clean.latencies.crit2 is a matrix of the clean latencies in the second critical block. clean.stim.number.prac1 is a matrix of the clean stimuli ID numbers in the first practice block. clean.stim.number.crit1 is a matrix of the clean stimuli ID numbers in the first critical block. clean.stim.number.prac2 is a matrix of the clean stimuli ID numbers in the second practice block. clean.stim.number.crit2 is a matrix of the clean stimuli ID numbers in the second critical block. clean.correct.prac1 is a matrix stating whether each trial was correct (logical) in the first practice block. clean.correct.crit1 is a matrix stating whether each trial was correct (logical) in the first critical block. clean.correct.prac2 is a matrix stating whether each trial was correct (logical) in the second practice block. clean.correct.crit2 is a matrix stating whether each trial was correct (logical) in the second critical block. clean.means.prac1 is a vector of clean block mean of latencies in the first practice block, one per participant. clean.means.crit1 is a vector of clean block mean of latencies in the first critical block, one per participant. clean.means.prac2 is a vector of clean block mean of latencies in the second practice block, one per participant. clean.means.crit2 is a vector of clean block mean of latencies in the second critical block, one per participant. diff.prac is a vector (one per person) of the difference between mean latencies compatible and incompatible (practice) blocks. diff.crit is a vector (one per person) of the difference between mean latencies compatible and incompatible (critical) blocks. inclusive.sd.prac is a vector (one per person) of the inclusive SD for the practice trials, per Greenwald et al. (2003). inclusive.sd.crit is a vector (one per person) of the inclusive SD for the critical trials, per Greenwald et al. (2003). grand.sd is a vector (one per person) of the inclusive SD for all combined trials. This is not presently used but may be desired for algorithm development. D.prac is a vector (one per person) of the D scores (i.e., IAT scores) for just the practice trials. D.crit is a vector (one per person) of the D scores (i.e., IAT scores) for just the critical trials. D is a vector (one per person) of the final D scores (i.e., IAT scores).

References

Greenwald, A. G., McGhee, D. E., & Schwartz, J. L. K. (1998). Measuring individual differences in implicit cognition: The Implicit Association Test. Journal of Personality and Social Psychology, 74, 1464–1480. https://doi.org/10.1037/0022-3514.74.6.1464

Greenwald, A. G., Nosek, B. A., & Banaji, M. R. (2003). Understanding and using the Implicit Association Test: I. An improved scoring algorithm. Journal of Personality and Social Psychology, 85, 197–216. https://doi.org/10.1037/0022-3514.85.2.197

Lane, K. A., Banaji, M. R., Nosek, B. A., & Greenwald, A. G. (2007). Understanding and using the Implicit Association Test: IV: What we know (so far) about the method. In B. Wittenbrink & N. Schwarz (Eds.), Implicit measures of attitudes. (pp. 59–102). New York, NY: Guilford Press.

Nosek, B. A., Greenwald, A. G., & Banaji, M. R. (2005). Understanding and using the implicit association test: II. Method variables and construct validity. Personality and Social Psychology Bulletin, 31, 166–180. https://doi.org/10.1177/0146167204271418

Examples

## Not run: 

### CLEAN THE IAT USING THE BUILT IN ERROR PENALTY FOR FORCED-ERROR CORRECTION ###
clean <- cleanIAT(
  dat$compatible.prac, dat$compatible.crit,
  dat$incompatible.prac, dat$incompatible.crit
)

### CLEAN THE IAT USING THE D600 PROCEDURE ###
clean <- cleanIAT(dat$compatible.prac, dat$compatible.crit,
  dat$incompatible.prac, dat$incompatible.crit,
  error.penalty = TRUE, error.penalty.ms = 600
)

### CLEAN THE IAT USING THE D2SD PROCEDURE###
clean <- cleanIAT(dat$compatible.prac, dat$compatible.crit,
  dat$incompatible.prac, dat$incompatible.crit,
  error.penalty = TRUE, error.penalty.ms = "2SD"
)

### CLEAN THE IAT USING THE D2SD PROCEDURE WITH TRIALS UNDER 400 MS DROPPED ###
clean <- cleanIAT(dat$compatible.prac, dat$compatible.crit,
  dat$incompatible.prac, dat$incompatible.crit,
  fastprt.drop = FALSE, fasttrial.drop = TRUE, fasttrial.ms = 400,
  error.penalty = TRUE, error.penalty.ms = "2SD"
)

### EXAMINE CLEAN IAT SCORES
clean$D

### EXAMINE IAT DIAGNOSTICS ###
# TIMEOUT DROP RATE (% of TRIALS) #
clean$timeout.rate

# LOWER TAIL DROP RATE (% of TRIALS) - NOTE: DISABLED BY DEFAULT #
clean$fasttrial.rate

# FAST PARTICIPANT DROP COUNT AND RATE (% of SAMPLE) #
clean$fastprt.count
clean$fastprt.rate

# ERROR RATE #
clean$error.rate

## End(Not run)

iatgen/iatgen documentation built on Oct. 23, 2023, 10:55 a.m.