Description Usage Arguments Value Examples
tsAB
is for time series containing a mixture of two trial types, as
would arise from a within-individual A/B experiment (for example, responses
over time to images that are either happy or sad). It is typically used on
data grouped by individual time series, created by
group_by
. The output will have one row per time series.
1 |
data |
A data frame of at least two columns: one indicating the trial
|
type |
Name of the column in |
value |
Name of the column in |
pos_thresh |
a |
neg_thresh |
a |
An object of the same class as data
reducing each time series
to the following summary metrics. Note "A" and "B" will be replaced by the
labels given by the type
column.
Total number of trials detected of type A. Useful as a validity check.
Total number of trials detected of type B. Useful as a validity check.
Number of trials of type A with missing data.
Number of trials of type B with missing data.
Mean of all non-neutral trials of type A.
Mean of all non-neutral trials of type B.
Standard deviation of all non-neutral trials of type A.
Standard deviation of all non-neutral trials of type B.
Count of positive type-A trials above threshold set
by pos_thresh
.
Count of positive type-B trials above threshold set
by pos_thresh
.
Count of negative type-A trials below threshold set
by neg_thresh
.
Count of negative type-B trials below threshold set
by neg_thresh
.
Count of neutral type-A trials between thresholds
set by neg_thresh
and pos_thresh
.
Count of neutral type-B trials between thresholds
set by neg_thresh
and pos_thresh
.
Mean of all non-neutral trials of type A that follow another trial of type A.
Mean of all non-neutral trials of type B that follow another trial of type B.
Mean of all non-neutral trials of type A that immediately follow a trial of type B.
Mean of all non-neutral trials of type B that immediately follow a trial of type A.
Mean difference of all non-neutral trials of type A from an immediately preceding trial of type B.
Mean difference of all non-neutral trials of type B from an immediately preceding trial of type A.
Mean linear slope over consecutive trials of type A.
Mean linear slope over consecutive trials of type B.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Create example data frame containing 10 time series of 100 reaction times
# from a dot-probe experiment with trial types (`valence`) of "happy" vs.
# "sad".
data <- data.frame(id = rep(1:10, each = 100),
trial = rep(1:100, 10),
valence = rep(sample(c("happy", "sad"), 1000,
replace = TRUE)),
rt = sample(100:1000, 1000, replace = TRUE),
congru = sample(c(TRUE,FALSE), 1000, replace = TRUE))
# Compute a trial-level bias score for each individual (`group_by(id)`) using
# reaction time (`rt`) and logical vectors indicating whether or not the dot
# probe was congruent with the target stimulus (`congru`).
data <- data %>% group_by(id) %>% mutate(tlbs = get_tlbs(rt, congru)) %>%
ungroup()
# Obtain A/B summary features for each individual time series
ts_summary <- data %>%
group_by(id) %>%
tsAB(type = "valence", value = "tlbs")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.