hsf | R Documentation |
hsf
returns a 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 and p values are also computed. Correction for multiple comparisons
across quantiles is achieved using Hochberg's 1988 procedure. Plot the shift
function using plot_hsf
.
hsf( 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), null.value = 0, adj_method = "hochberg" )
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. |
null.value |
Null value to compute P values for the quantile differences - default = 0. |
adj_method |
Name of method to adjust for multiple quantile comparisons, passed to |
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.
pvalues: P values for every difference.
adjusted_pvalues: P values adjusted for multiple comparisons.
null_value: null value used to compute P values.
quantiles: quantiles estimated in each participant and condition.
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
Hochberg, Y. (1988). A sharper Bonferroni procedure for multiple tests of significance. Biometrika, 75(4), 800-802.
plot_hsf
to plot the results.
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(df, rt ~ condition + participant) # use the default parameters plot_hsf(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(df, rt ~ condition + participant, qseq = c(.25, .5, .75)) # estimate quartiles only out <- hsf(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.