get_sign_consistency: Get Sign Consistency

View source: R/non_directional_tests.R

get_sign_consistencyR Documentation

Get Sign Consistency

Description

The function returns the average probability of a consistent difference score sign (comparing two conditions) for a random split of each participant's data. 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 estimated probability that for a random splitting of the data, the summary function (summary_function) returns two values with the same sign when applied to the two halves. Then, the average sign consistency probability across participants is calculated and returned. All levels of the independent variable must be included under each identifier.

Usage

get_sign_consistency(
  data,
  idv = "id",
  dv = "rt",
  iv = "condition",
  nSplits = 500,
  summary_function = base::mean,
  max_invalid_reps = 10^3
)

Arguments

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.

nSplits

The number of splits to use when estimating sign consistency probability.

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). The function should return NA if the summary statistic cannot be computed for the input given. In such case another split of the data will be sampled and used.

max_invalid_reps

- The maximal number repetitions in which invalid consistency was computed before returning NA result.

Value

A list including the results of the function

  • statistic - The average sign consistency across all participants.

  • consistency_per_id - Sign consistency estimate for each participant.

See Also

[signcon::test_sign_consistency()] which uses this function to test the significance of the group-level sign consistency.


mufcItay/weaknull documentation built on Jan. 29, 2025, 7:28 p.m.