R/bimodality.R
mt_check_bimodality.Rd
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, ... )
data | a mousetrap data object created using one of the mt_import functions (see mt_example for details). |
---|---|
use | a character string specifying which data should be used. By
default, points to the |
use_variables | a vector specifying for which mouse-tracking measures bimodality should be assessed. |
methods | a character string (or vector) specifying which methods should be used for assessing bimodality (see Details). |
B | an integer specifying the number of replicates used in the Monte Carlo test (only relevant if "HDS_sim" is included in methods, see Details). |
grouping_variables | a character string (or vector) specifying one or
more variables in |
... | additional arguments passed on to mt_reshape (such as
|
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).
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.
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.
bimodality_coefficient for more information about the bimodality coefficient.
dip.test for more information about Hartigan's dip test.
# 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 #> MAD AD #> 1 0.949304 0.9805709 #># Standardize variables per participant mt_example <- mt_standardize(mt_example, use_variables=c("MAD", "AD"), within="subject_nr") # 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 #> z_MAD z_AD #> 1 0.7749003 0.7463675 #># Assess bimodality with simulated p values for HDS mt_check_bimodality(mt_example, use_variables=c("z_MAD", "z_AD"), methods=c("BC", "HDS_sim"))#> $BC #> z_MAD z_AD #> 1 0.5099593 0.7212444 #> #> $HDS_simulated_p_value #> z_MAD z_AD #> 1 0.7775 0.752 #># Assess bimodality per condition mt_check_bimodality(mt_example, use_variables=c("z_MAD", "z_AD"), grouping_variables="Condition")#> $BC #> Condition z_MAD z_AD #> 1 Atypical 0.4056693 0.3430277 #> 2 Typical 0.4842767 0.7781194 #> #> $HDS_p_value #> Condition z_MAD z_AD #> 1 Atypical 0.3458943 0.4716631 #> 2 Typical 0.9831558 0.9923261 #>