writeIATfull | R Documentation |
This is the primary function for building IATs. It has two modes. In automatic mode (set qsf=TRUE
), the function creates a fully functional *.qsf file (Qualtrics survey file) in the user’s working directory, ready to import into Qualtrics. In manual mode (the default option, qsf=FALSE
), it creates four numbered folders which contain HTML and JavaScript code which can be pasted into a template (see tutorial for manual mode at www.iatgen.wordpress.com). In both modes, the user specifies features of the IAT. The user must specify a name for the IAT (IATname
) and the four labels for the targets and categories (posname
, negname
, Aname
, and Bname
). The user must also always specify the type of stimuli for both targets (tgtType="words"
or tgtType="images"
) and categories (catType="words"
or catType="images"
). The user must also specify the stimuli sets for each of the four terms (when images: Aimgs
, Bimgs
, posimgs
, and negimgs
; when words: Awords
, Bwords
, poswords
, and negwords
). Word stimuli are specified by vectors of words (e.g., poswords=c("Gentle", "Enjoy", "Heaven", "Cheer", "Happy", "Love", "Friend")
, whereas images are specified by vectors of image URLs: (e.g., posimgs=c("www.website.com/gentle.jpg", "www.website.com/enjoy.jpg", "www.website.com/Heaven.jpg"
). We recommend users host their own images to avoid issues for participants (see tutorial on www.iatgen.wordpress.com). Beyond the above, there are a number of additional settings. By default, the IAT creates a 250-ms pause between trials (Greenwald et al., 1998), but this can be changed using the pause argument (e.g., pause=500
). By default, the function also produces the original Greenwald et al. (1998) variant in which an error message (a red X) flashes for a pause before automatically starting the next trial (default = 300 ms, can be changed by setting errorpause
to a number other than 300 [e.g., errorpause = 400
]). We recommend using a popular variant of the IAT in which the user must correct errors before proceeding to the next trial, which is accomplished by setting correct.error=TRUE
. Users can also edit the color of the targets using the optional tgtCol
argument (e.g., tgtCol="black"
) which is set to black by default. Users can change the color of attributes using the catCol
argument (e.g., catCol="green"
), and can be set to any CSS color (see www.w3schools.com/colors/colors_names.asp for a list of all compatible colors). The user can set the number of trials by specifying the n argument. Users can enable a note reminding participants about the keypress directions during the IAT by setting note=TRUE
, which is used on some popular IAT websites (e.g., www.projectimplicit.org) and may be useful in online settings where participants cannot directly approach an experimenter with questions.
writeIATfull(
IATname = "IAT",
posname,
negname,
Aname,
Bname,
n = c(20, 20, 20, 40, 40, 20, 40),
catType,
catCol = "green",
poswords,
negwords,
posimgs,
negimgs,
tgtType,
tgtCol = "black",
Awords,
Bwords,
Aimgs,
Bimgs,
swap = "target",
qsf = FALSE,
pause = 250,
errorpause = 300,
correct.error = TRUE,
note = FALSE,
norepeat = FALSE,
startqid = 1
)
IATname |
(Required, set by default). A short string of text that serves to name the IAT. By default, set as 'IAT'. Do not add spaces or special characters. |
posname |
(Required). The name of the positive category as appears to participants. |
negname |
(Required). The name of the negative category as appears to participants. |
Aname |
(Required). The name of Target A as appears to participants. |
Bname |
(Required). The name of Target B as appears to participants. |
n |
(Required, set by default). A numeric vector of length seven, indicating the number of trials in each block. By default, |
catType |
(Required). Can be |
catCol |
(Required, set by default). Sets the color of the category stimuli and on-screen labels. By default, set to |
poswords |
(Required if |
negwords |
(Required if |
posimgs |
(Required if |
negimgs |
(Required if |
tgtType |
(Required). Can be |
tgtCol |
(Required, set by default). Sets the color of the target stimuli and on-screen labels. By default, set to |
Awords |
(Required if |
Bwords |
(Required if |
Aimgs |
(Required if |
Bimgs |
(Required if |
swap |
(Required, set by default). Should be a scalar of either "category" or "target." Determines what swaps sides at Block 5. If |
qsf |
(Required, set by default). Logical value, set to |
pause |
(Required, set by default). Numeric value sets the delay between trials (displaying the fixation cross) in milliseconds. By default, set to 250 (Greenwald et al., 1998) but can be set to any value. |
errorpause |
(Required if |
correct.error |
(Required, set by default). Logical value, set to |
note |
(Required, set by default). Logical value, set to |
norepeat |
(Required, set by default). Logical value, set to |
startqid |
(Required, set by default). Numeric value that impacts how files are named, which is only visible to users in manual mode. Although this does not substantively impact the IAT, it can make building multi-IAT studies easier in manual mode (see tutorial at www.iatgen.wordpress.com). By default, |
Nothing is returned. However, a QSF file (if qsf=T
) or folders (if qsf=F
) are made in the working directory containing both HTML and JavaScript files that are to be pasted into Qualtrics.
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
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
See www.iatgen.wordpress.com for tutorials and files.
## Not run:
### A words-only IAT with recommended settings. IAT examines insects vs. flowers
# and is named "flowins". Recommended settings builds a QSF file automatically
# with forced error correction and a note reminding participants of the instructions.
### Note: the following are specified below for example purposes but are specified
# by default automatically and can be omitted: coloring of stimuli,
# number of trials per block, pause between trials.
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "words",
poswords = c("Gentle", "Enjoy", "Heaven", "Cheer", "Happy", "Love", "Friend"),
negwords = c("Poison", "Evil", "Gloom", "Damage", "Vomit", "Ugly", "Hurt"),
tgtType = "words",
Awords = c("Orchid", "Tulip", "Rose", "Daffodil", "Daisy", "Lilac", "Lily"),
Bwords = c("Wasp", "Flea", "Roach", "Centipede", "Moth", "Bedbug", "Gnat"),
# advanced options with recommended IAT settings
n = c(20, 20, 20, 40, 40, 20, 40),
qsf = T,
note = T,
correct.error = T,
pause = 250,
tgtCol = "black",
catCol = "green"
)
### Same IAT but with the persistent task directions disabled (\code{note=FALSE}),
# forced error correction disabled (\code{correct.error=FALSE}) and a 300 ms pause
# for the error message (\code{errorpause=300}).
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "words",
poswords = c("Gentle", "Enjoy", "Heaven", "Cheer", "Happy", "Love", "Friend"),
negwords = c("Poison", "Evil", "Gloom", "Damage", "Vomit", "Ugly", "Hurt"),
tgtType = "words",
Awords = c("Orchid", "Tulip", "Rose", "Daffodil", "Daisy", "Lilac", "Lily"),
Bwords = c("Wasp", "Flea", "Roach", "Centipede", "Moth", "Bedbug", "Gnat"),
# advanced options
n = c(20, 20, 20, 40, 40, 20, 40),
qsf = T,
note = F,
correct.error = F,
pause = 250,
errorpause = 300,
tgtCol = "black",
catCol = "green"
)
### Same IAT as prior example but with 10 trials for all non-critical blocks
# and 12 trials for all critical blocks.
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "words",
poswords = c("Gentle", "Enjoy", "Heaven", "Cheer", "Happy", "Love", "Friend"),
negwords = c("Poison", "Evil", "Gloom", "Damage", "Vomit", "Ugly", "Hurt"),
tgtType = "words",
Awords = c("Orchid", "Tulip", "Rose", "Daffodil", "Daisy", "Lilac", "Lily"),
Bwords = c("Wasp", "Flea", "Roach", "Centipede", "Moth", "Bedbug", "Gnat"),
# advanced options
n = c(10, 10, 10, 12, 10, 10, 12),
qsf = T,
note = F,
correct.error = F,
pause = 250,
errorpause = 300,
tgtCol = "black",
catCol = "green"
)
### An images-only IAT with recommended settings. Note that image URL vectors
# are specified first to simplify the code.
goodjpg <- c(
"www.website.com/gentle.jpg",
"www.website.com/enjoy.jpg",
"www.website.com/Heaven.jpg",
"www.website.com/Cheer.jpg"
)
badjpg <- c(
"www.website.com/Poison.jpg",
"www.website.com/Evil.jpg.",
"www.website.com/Vomit.jpg",
"www.website.com/Ugly.jpg"
)
Ajpg <- c(
"www.website.com/Orchid.jpg",
"www.website.com/Tulip.jpg",
"www.website.com/Rose.jpg",
"www.website.com/Daisy.jpg"
)
Bjpg <- c(
"www.website.com/Wasp.jpg",
"www.website.com/Flea.jpg",
"www.website.com/Moth.jpg",
"www.website.com/Bedbug.jpg"
)
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "images",
posimgs = goodjpg,
negimgs = badjpg,
tgtType = "images",
Aimgs = Ajpg,
Bimgs = Bjpg,
# advanced options with recommended IAT settings
n = c(20, 20, 20, 40, 40, 20, 40),
qsf = T,
note = T,
correct.error = T,
pause = 250,
tgtCol = "black",
catCol = "green"
)
### Example IAT with images for categories and words for targets, with recommended settings.
goodjpg <- c(
"www.website.com/gentle.jpg",
"www.website.com/enjoy.jpg",
"www.website.com/Heaven.jpg",
"www.website.com/Cheer.jpg"
)
badjpg <- c(
"www.website.com/Poison.jpg",
"www.website.com/Evil.jpg.",
"www.website.com/Vomit.jpg",
"www.website.com/Ugly.jpg"
)
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "images",
posimgs = goodjpg,
negimgs = badjpg,
tgtType = "words",
Awords = c("Orchid", "Tulip", "Rose", "Daffodil", "Daisy", "Lilac", "Lily"),
Bwords = c("Wasp", "Flea", "Roach", "Centipede", "Moth", "Bedbug", "Gnat"),
# advanced options with recommended IAT settings
n = c(20, 20, 20, 40, 40, 20, 40),
qsf = T,
note = T,
correct.error = T,
pause = 250,
tgtCol = "black",
catCol = "green"
)
### Example IAT with images for targets and words for categories, with recommended settings.
Ajpg <- c(
"www.website.com/Orchid.jpg",
"www.website.com/Tulip.jpg",
"www.website.com/Rose.jpg",
"www.website.com/Daisy.jpg"
)
Bjpg <- c(
"www.website.com/Wasp.jpg",
"www.website.com/Flea.jpg",
"www.website.com/Moth.jpg",
"www.website.com/Bedbug.jpg"
)
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "words",
poswords = c("Gentle", "Enjoy", "Heaven", "Cheer", "Happy", "Love", "Friend"),
negwords = c("Poison", "Evil", "Gloom", "Damage", "Vomit", "Ugly", "Hurt"),
tgtType = "images",
Aimgs = Ajpg,
Bimgs = Bjpg,
# advanced options with recommended IAT settings
n = c(20, 20, 20, 40, 40, 20, 40),
qsf = T,
note = T,
correct.error = T,
pause = 250,
tgtCol = "black",
catCol = "green"
)
### EXAMPLE IAT USING 'norepeat=TRUE" TO SUPPRESS REPEAT STIMULI UNTIL ALL STIMULI
# FROM THAT CATEGORY HAVE BEEN SEEN
writeIATfull(
IATname = "flowins",
posname = "Pleasant",
negname = "Unpleasant",
Aname = "Flowers",
Bname = "Insects",
catType = "words",
poswords = c("Gentle", "Enjoy", "Heaven", "Cheer", "Happy", "Love", "Friend"),
negwords = c("Poison", "Evil", "Gloom", "Damage", "Vomit", "Ugly", "Hurt"),
tgtType = "words",
Awords = c("Orchid", "Tulip", "Rose", "Daffodil", "Daisy", "Lilac", "Lily"),
Bwords = c("Wasp", "Flea", "Roach", "Centipede", "Moth", "Bedbug", "Gnat"),
# advanced options
n = c(20, 20, 20, 40, 40, 20, 40),
qsf = T,
note = F,
correct.error = F,
pause = 250,
errorpause = 300,
tgtCol = "black",
catCol = "green",
norepeat = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.