aat_compute {AATtools}  R Documentation 
Compute simple AAT scores
Description
Compute simple AAT scores, with optional outlier exclusion and error trial recoding.
Usage
aat_compute(
ds,
subjvar,
pullvar,
targetvar = NULL,
rtvar,
algorithm = c("aat_doublemeandiff", "aat_doublemediandiff", "aat_dscore",
"aat_dscore_multiblock", "aat_regression", "aat_standardregression",
"aat_doublemeanquotient", "aat_doublemedianquotient", "aat_singlemeandiff",
"aat_singlemediandiff"),
trialdropfunc = c("prune_nothing", "trial_prune_3SD", "trial_prune_3MAD",
"trial_prune_SD_dropcases", "trial_recode_SD", "trial_prune_percent_subject",
"trial_prune_percent_sample", "trial_prune_grubbs"),
errortrialfunc = c("prune_nothing", "error_replace_blockmeanplus",
"error_prune_dropcases"),
...
)
Arguments
ds 
a longformat data.frame 
subjvar 
column name of subject variable 
pullvar 
column name of pull/push indicator variable, must be numeric or logical (where pull is 1 or TRUE) 
targetvar 
column name of target stimulus indicator, must be numeric or logical (where target is 1 or TRUE) 
rtvar 
column name of reaction time variable 
algorithm 
Function (without brackets or quotes) to be used to compute AAT scores. See Algorithms for a list of usable algorithms. 
trialdropfunc 
Function (without brackets or quotes) to be used to exclude outlying trials in each half. The way you handle outliers for the reliability computation should mimic the way you do it in your regular analyses. It is recommended to exclude outlying trials when computing AAT scores using the mean doubledfference scores and regression scoring approaches, but not when using dscores or median doubledifference scores.

errortrialfunc 
Function (without brackets or quotes) to apply to an error trial.

... 
Other arguments, to be passed on to the algorithm or outlier rejection functions (see arguments above) 
Examples
#Compute the correlation between relevantfeature and irrelevantfeature AAT scores
ds<erotica[erotica$correct==1,]
relevant < aat_compute(ds=ds[ds$is_irrelevant==0,],
pullvar="is_pull",targetvar="is_target",
rtvar="RT",subjvar="subject",
trialdropfunc="trial_prune_3SD",
algorithm="aat_doublemediandiff")
irrelevant < aat_compute(ds=ds[ds$is_irrelevant==1,],
pullvar="is_pull",targetvar="is_target",
rtvar="RT",subjvar="subject",
trialdropfunc="trial_prune_3SD",
algorithm="aat_doublemediandiff")
comparison.df < merge(relevant, irrelevant, by = "subject")
cor(comparison.df$ab.x, comparison.df$ab.y)
# 0.1145726