hsf_pb | R Documentation |
hsf_pb
returns a percentile bootstrap hierarchical shift function for
one group of participants, tested in two dependent conditions (see
vignette
on github). Full distributions of measurements must be available for each
participant and condition. First, quantiles are computed for the distribution
of measurements from each condition and each participant. Second, the
quantiles are subtracted in each participant. Third, a trimmed mean is
computed across participants for each quantile. Confidence intervals are
computed using the percentile bootstrap. This function focuses on estimation, so
there is no correction for multiple comparisons and no p values. Plot the
shift function using plot_hsf_pb
or plot_hsf_pb_dist
.
hsf_pb( data = df, formula = obs ~ cond + id, qseq = seq(0.1, 0.9, 0.1), tr = 0.2, alpha = 0.05, qtype = 8, todo = c(1, 2), nboot = 1000 )
data |
A data frame in long format. Missing values are not allowed. |
formula |
A formula with format response variable ∼ predictor variable + id, where ~ (tilde) means "is modeled as a function of" and '+ id' indicates the variable containing the participants' id number. |
qseq |
Quantiles to estimate - default = deciles. |
tr |
Percentage of trimming, value between 0 and 1 - default = 0.2 = 20%. Set to zero to get results for the mean. |
alpha |
Alpha level - default 0.05. |
qtype |
Type of quantile estimation algorithm to pass to |
todo |
Order of the groups to compare - default = 1 minus 2. |
nboot |
Number of boostrap samples - default = 1000. |
A list of 8 results:
comparison: names of two conditions being compared.
individual_sf: shift functions for every participant.
group_differences: group quantile differences.
ci: group confidence intervals for quantile differences.
hdi: group highest density intervals for quantile differences.
quantiles: quantiles estimated in each participant and condition.
boot_samples: bootstrap differences for each quantile.
nboot: number of bootstrap samples.
Rousselet, G. A., & Wilcox, R. R. (2019, January 17). Reaction times and other skewed distributions: problems with the mean and the median. https://doi.org/10.31234/osf.io/3y54r
plot_hsf_pb
to plot the results.
plot_hsf_pb_dist
to plot the distributions of bootstrap samples.
set.seed(22) # subset random sample of participants from the French Lexicon Project id <- unique(flp$participant) df <- subset(flp, flp$participant %in% sample(id, 50, replace = FALSE)) out <- hsf_pb(df, rt ~ condition + participant) # use the default parameters plot_hsf_pb(out) # plot results. Shift functions are overall negative, as participants tend to be faster in the Word condition than in the Non-Word condition. out <- hsf_pb(df, rt ~ condition + participant, qseq = c(.25, .5, .75)) # estimate quartiles only out <- hsf_pb(df, rt ~ condition + participant, todo = c(2,1)) # reverse comparison
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.