View source: R/directional_tests.R
get_directional_effect | R Documentation |
The function returns the directional effect (comparing two conditions, under the independent variable, iv) according to the summary function (summary_function). The function accepts a dataset in long format with specific columns: identifier ('idv'), independent and dependent variables (iv and dv, respectively). For each participant, the function calculates the difference score between two conditions. The difference score is calculated by subtracting the result of applying the summary function (summary_function) to the 2nd level if the independent variable, iv, from the 1st level. All levels of the independent variable must be included under each identifier.
get_directional_effect(
data,
idv = "id",
dv = "rt",
iv = "condition",
summary_function = base::mean,
ci_level = 95,
ci_reps = 0
)
data |
The dataset to analyze. |
idv |
The name of the participant identifier column. |
dv |
The dependent variable to apply the summary function (summary_function) to. For multiple dependent variables use a string list with the names of each dependent variable (e.g., c('dv1','dv2')), |
iv |
Labels of an independent variable, indicating the different levels under which the dependent variable ('dv') is expected to differ. |
summary_function |
The summary function to apply to the dependent variables ('dv') under each level of the independent variable ('iv') for each participant ('idv'). This function should map a matrix maintaining the original dataframe columns to a number: matrix -> numeric (e.g. function(mat) mean(mat), which is the default summary function). |
ci_level |
- The confidence level (in percents, e.g. setting the argument to 50 generates a 50 to use when computing the bootstrapped confidence interval on the group-level statistic (see the return value 'ci', and the argument 'ci_reps'). The default value of this argument is 95, that would lead to computing the 95 the group-level statistic. |
ci_reps |
- The number repetitions to use when computing the bootstrapped confidence interval around the group-level statistic. The default value of this argument is zero, which would lead to not computing the confidence interval at all. |
A list including the results of the function
statistic - The average effect across all participants.
effect_per_id - An effect score for each participant.
ci_low (optional) - The lower bound of a confidence interval around the statistic (returned only if the 'ci_reps' argument was set to a value different than 0).
ci_high (optional) - The higher bound of a confidence interval around the statistic (returned only if the 'ci_reps' argument was set to a value different than 0).
[signcon::test_directional_effect()] which uses this function to test the significance of the group-level effect.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.