Assess bimodality of the distribution of mouse-tracking measures using the bimodality coefficient and Hartigan's dip statistic (see Details). If bimodality should be assessed separately for different conditions, the corresponding variables can be specified under grouping_variables.

mt_check_bimodality(
data,
use = "measures",
use_variables = NULL,
methods = c("BC", "HDS"),
B = 2000,
grouping_variables = NULL,
...
)

## Arguments

data a mousetrap data object created using one of the mt_import functions (see mt_example for details). a character string specifying which data should be used. By default, points to the measures data.frame created using mt_measures. a vector specifying for which mouse-tracking measures bimodality should be assessed. a character string (or vector) specifying which methods should be used for assessing bimodality (see Details). an integer specifying the number of replicates used in the Monte Carlo test (only relevant if "HDS_sim" is included in methods, see Details). a character string (or vector) specifying one or more variables in data[["data"]]. If specified, bimodality will be assessed separately for each level of the variable. If unspecified (the default), bimodality is checked across all trials. additional arguments passed on to mt_reshape (such as subset).

## Value

A list of several data.frames. Each data.frame contains the value returned by the respective method for assessing bimodality (see Details) - separately per condition (specified in the row dimension) and measure (specified in the column dimension).

## Details

Different methods have been suggested for assessing the bimodality of mouse-tracking measure distributions, each of which has advantages and disadvantages (see Freeman & Dale, 2013).

Hehman et al. (2015) focus on two specific methods (bimodality coefficient and Hartigan's dip statistic) which are implemented here.

If methods include BC, the bimodality coefficient is calculated using the bimodality_coefficient function in this package. According to Freeman and Ambady (2010), a distribution is considered bimodal if BC > 0.555.

Note that MouseTracker (Freeman & Ambady, 2010) standardizes variables within each subject before computing the BC. This is also possible here using mt_standardize (see Examples).

If methods include HDS, Hartigan's dip statistic is calculated using the dip.test function of the diptest package. The corresponding p value (computed via linear interpolation) is returned.

If methods include HDS_sim, Hartigan's dip statistic is calculated using the dip.test function with the additional argument simulate.p.values=TRUE. In this case, the p value is computed from a Monte Carlo simulation of a uniform distribution with B (default: 2000) replicates.

## References

Freeman, J. B., & Ambady, N. (2010). MouseTracker: Software for studying real-time mental processing using a computer mouse-tracking method. Behavior Research Methods, 42(1), 226-241.

Freeman, J. B., & Dale, R. (2013). Assessing bimodality to detect the presence of a dual cognitive process. Behavior Research Methods, 45(1), 83-97.

Hehman, E., Stolier, R. M., & Freeman, J. B. (2015). Advanced mouse-tracking analytic techniques for enhancing psychological science. Group Processes & Intergroup Relations, 18(3), 384-401.

## Examples

# Calculate measures
mt_example <- mt_measures(mt_example)

# Assess bimodality for untransformed variables
mt_check_bimodality(mt_example,
use_variables=c("MAD", "AD"))#> $BC #> MAD AD #> 1 0.6239962 0.7714127 #> #>$HDS_p_value
#> 1 0.949304 0.9805709
#>
# Standardize variables per participant
mt_example <- mt_standardize(mt_example,

# Assess bimodality for standardized variables
mt_check_bimodality(mt_example,
use_variables=c("z_MAD", "z_AD"))#> $BC #> z_MAD z_AD #> 1 0.5099593 0.7212444 #> #>$HDS_p_value
#> 1 0.7749003 0.7463675
#>
# Assess bimodality with simulated p values for HDS
mt_check_bimodality(mt_example,
methods=c("BC", "HDS_sim"))#> $BC #> z_MAD z_AD #> 1 0.5099593 0.7212444 #> #>$HDS_simulated_p_value
grouping_variables="Condition")#> $BC #> Condition z_MAD z_AD #> 1 Atypical 0.4056693 0.3430277 #> 2 Typical 0.4842767 0.7781194 #> #>$HDS_p_value