Title: | An Implementation of Common Response Time Trimming Methods |
---|---|
Description: | Provides various commonly-used response time trimming methods, including the recursive / moving-criterion methods reported by Van Selst and Jolicoeur (1994). By passing trimming functions raw data files, the package will return trimmed data ready for inferential testing. |
Authors: | James Grange [cre, aut], Ed Berry [ctb] |
Maintainer: | James Grange <[email protected]> |
License: | GPL-3 |
Version: | 1.1.1.9000 |
Built: | 2024-11-16 04:49:54 UTC |
Source: | https://github.com/jimgrange/trimr |
absoluteRT
takes a data frame of RT data and returns trimmed rt data
that fall between set minimum and maximum limits.
absoluteRT( data, minRT, maxRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, returnType = "mean", digits = 3 )
absoluteRT( data, minRT, maxRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, returnType = "mean", digits = 3 )
data |
A data frame with columns containing: participant identification number ('pptVar'); condition identification, if applicable ('condVar'); response time data ('rtVar'); and accuracy ('accVar'). The RT can be in seconds (e.g., 0.654) or milliseconds (e.g., 654). Typically, "condition" will consist of strings. Accuracy must be coded as 1 for correct and 0 for error responses. |
minRT |
The lower criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). |
maxRT |
The upper criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). |
pptVar |
The quoted name of the column in the data that identifies participants. |
condVar |
The quoted name of the column in the data that includes the conditions. |
rtVar |
The quoted name of the column in the data containing reaction times. |
accVar |
The quoted name of the column in the data containing accuracy, coded as 0 or 1 for incorrect and correct trial, respectively. |
omitErrors |
If set to TRUE, error trials will be removed before conducting trimming procedure. Final data returned will not be influenced by errors in this case. |
returnType |
Request nature of returned data. "raw" returns trial- level data excluding trimmed data; "mean" returns mean response times per participant for each experimental condition identified; "median" returns median response times per participant for each experimental condition identified. |
digits |
How many decimal places to round to after trimming? |
By passing a data frame containing raw response time data, together with trimming criteria, the function will return trimmed data, either in the form of trial-level data or in the form of means/medians for each subject & condition.
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- absoluteRT(data = exampleData, minRT = 150, maxRT = 2500, returnType = "mean")
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- absoluteRT(data = exampleData, minRT = 150, maxRT = 2500, returnType = "mean")
An example data set containing multiple participants' data for a response time study involving two experimental conditions. The data set also includes This is a synthetic data set and has no theoretical basis.
exampleData
exampleData
A data frame with 20518 rows and 4 variables:
participant identification number
the experimental condition (2 in this example)
response time, coded in milliseconds
accuracy of the response; 1 = correct, 0 = error
hybridRecursive
takes a data frame of RT data and returns trimmed rt
data. The returned value is the average returned from the nonRecursive
and the modifiedRecursive procedures as described in van Selst &
Jolicoeur (1994).
hybridRecursive( data, minRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, digits = 3 )
hybridRecursive( data, minRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, digits = 3 )
data |
A data frame with columns containing: participant identification number ('pptVar'); condition identification, if applicable ('condVar'); response time data ('rtVar'); and accuracy ('accVar'). The RT can be in seconds (e.g., 0.654) or milliseconds (e.g., 654). Typically, "condition" will consist of strings. Accuracy must be coded as 1 for correct and 0 for error responses. |
minRT |
The lower criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). All RTs below this value are removed before proceeding with SD trimming. |
pptVar |
The quoted name of the column in the data that identifies participants. |
condVar |
The quoted name of the column in the data that includes the conditions. |
rtVar |
The quoted name of the column in the data containing reaction times. |
accVar |
The quoted name of the column in the data containing accuracy, coded as 0 or 1 for incorrect and correct trial, respectively. |
omitErrors |
If set to TRUE, error trials will be removed before conducting trimming procedure. Final data returned will not be influenced by errors in this case. |
digits |
How many decimal places to round to after trimming? |
Van Selst, M. & Jolicoeur, P. (1994). A solution to the effect of sample size on outlier elimination. Quarterly Journal of Experimental Psychology, 47 (A), 631-650.
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- hybridRecursive(data = exampleData, minRT = 150)
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- hybridRecursive(data = exampleData, minRT = 150)
A data frame containing the SDs used for each sample size as trimming criterion for the nonRecursive function and the modifiedRecursive function
linearInterpolation
linearInterpolation
A data frame with 97 rows and 3 columns:
Sample size of the data set being passed
The standard deviation to use as the criterion for the nonRecursive function
The standard deviation to use as the criterion for the modifiedRecursive function
modifiedRecursive
takes a data frame of RT data and returns trimmed rt
data that fall below a set standard deviation above the each participant's
mean for each condition, with the criterion changing as more trials are
removed, as described in van Selst & Jolicoeur (1994).
modifiedRecursive( data, minRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, returnType = "mean", digits = 3 )
modifiedRecursive( data, minRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, returnType = "mean", digits = 3 )
data |
A data frame with columns containing: participant identification number ('pptVar'); condition identification, if applicable ('condVar'); response time data ('rtVar'); and accuracy ('accVar'). The RT can be in seconds (e.g., 0.654) or milliseconds (e.g., 654). Typically, "condition" will consist of strings. Accuracy must be coded as 1 for correct and 0 for error responses. |
minRT |
The lower criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). All RTs below this value are removed before proceeding with SD trimming. |
pptVar |
The quoted name of the column in the data that identifies participants. |
condVar |
The quoted name of the column in the data that includes the conditions. |
rtVar |
The quoted name of the column in the data containing reaction times. |
accVar |
The quoted name of the column in the data containing accuracy, coded as 0 or 1 for incorrect and correct trial, respectively. |
omitErrors |
If set to TRUE, error trials will be removed before conducting trimming procedure. Final data returned will not be influenced by errors in this case. |
returnType |
Request nature of returned data. "raw" returns trial- level data excluding trimmed data; "mean" returns mean response times per participant for each experimental condition identified; "median" returns median response times per participant for each experimental condition identified. |
digits |
How many decimal places to round to after trimming? |
Van Selst, M. & Jolicoeur, P. (1994). A solution to the effect of sample size on outlier elimination. Quarterly Journal of Experimental Psychology, 47 (A), 631-650.
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- modifiedRecursive(data = exampleData, minRT = 150, returnType = "mean")
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- modifiedRecursive(data = exampleData, minRT = 150, returnType = "mean")
nonRecursive
takes a data frame of RT data and returns trimmed rt
data that fall below a set standard deviation above the each participant's
mean for each condition. The SD used for trimming is proportional to the
number of trials in the data being passed, as described in van Selst &
Jolicoeur (1994).
nonRecursive( data, minRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, returnType = "mean", digits = 3 )
nonRecursive( data, minRT, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", omitErrors = TRUE, returnType = "mean", digits = 3 )
data |
A data frame with columns containing: participant identification number ('pptVar'); condition identification, if applicable ('condVar'); response time data ('rtVar'); and accuracy ('accVar'). The RT can be in seconds (e.g., 0.654) or milliseconds (e.g., 654). Typically, "condition" will consist of strings. Accuracy must be coded as 1 for correct and 0 for error responses. |
minRT |
The lower criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). All RTs below this value are removed before proceeding with SD trimming. |
pptVar |
The quoted name of the column in the data that identifies participants. |
condVar |
The quoted name of the column in the data that includes the conditions. |
rtVar |
The quoted name of the column in the data containing reaction times. |
accVar |
The quoted name of the column in the data containing accuracy, coded as 0 or 1 for incorrect and correct trial, respectively. |
omitErrors |
If set to TRUE, error trials will be removed before conducting trimming procedure. Final data returned will not be influenced by errors in this case. |
returnType |
Request nature of returned data. "raw" returns trial- level data excluding trimmed data; "mean" returns mean response times per participant for each experimental condition identified; "median" returns median response times per participant for each experimental condition identified. |
digits |
How many decimal places to round to after trimming? |
Van Selst, M. & Jolicoeur, P. (1994). A solution to the effect of sample size on outlier elimination. Quarterly Journal of Experimental Psychology, 47 (A), 631-650.
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- nonRecursive(data = exampleData, minRT = 150, returnType = "mean")
# load the example data that ships with trimr data(exampleData) # perform the trimming, returning mean RT trimmedData <- nonRecursive(data = exampleData, minRT = 150, returnType = "mean")
sdTrim
takes a data frame of RT data and returns trimmed rt
data that fall below a set set criterion (based on standard deviations
above a particular mean). The criterion can be based on the mean of the
whole set of data, based on the mean per experimental condition, based on
the mean per participant, or based on the mean of each participant in each
experimental condition.
sdTrim( data, minRT, sd, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", perCondition = TRUE, perParticipant = TRUE, omitErrors = TRUE, returnType = "mean", digits = 3 )
sdTrim( data, minRT, sd, pptVar = "participant", condVar = "condition", rtVar = "rt", accVar = "accuracy", perCondition = TRUE, perParticipant = TRUE, omitErrors = TRUE, returnType = "mean", digits = 3 )
data |
A data frame with columns containing: participant identification number ('pptVar'); condition identification, if applicable ('condVar'); response time data ('rtVar'); and accuracy ('accVar'). The RT can be in seconds (e.g., 0.654) or milliseconds (e.g., 654). Typically, "condition" will consist of strings. Accuracy must be coded as 1 for correct and 0 for error responses. |
minRT |
The lower criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). All RTs below this value are removed before proceeding with SD trimming. |
sd |
The upper criteria for standard deviation cut-off. |
pptVar |
The quoted name of the column in the data that identifies participants. |
condVar |
The quoted name of the column in the data that includes the conditions. |
rtVar |
The quoted name of the column in the data containing reaction times. |
accVar |
The quoted name of the column in the data containing accuracy, coded as 0 or 1 for incorrect and correct trial, respectively. |
perCondition |
Set to TRUE if the user wishes the trimming to occur per condition of the experimental design. |
perParticipant |
Set to TRUE if the user wishes the trimming to occur per participant. |
omitErrors |
If set to TRUE, error trials will be removed before conducting trimming procedure. Final data returned will not be influenced by errors in this case. |
returnType |
Request nature of returned data. "raw" returns trial- level data excluding trimmed data; "mean" returns mean response times per participant for each experimental condition identified; "median" returns median response times per participant for each experimental condition identified. |
digits |
How many decimal places to round to after trimming? |
By passing a data frame containing raw response time data, together with trimming criteria, the function will return trimmed data, either in the form of trial-level data or in the form of means/medians for each subject & condition.
# load the example data that ships with trimr data(exampleData) # perform the trimming with SD trimming per condition, returning mean RT trimmedData <- sdTrim(data = exampleData, minRT = 150, sd = 2.5, perCondition = TRUE, perParticipant = FALSE, returnType = "mean")
# load the example data that ships with trimr data(exampleData) # perform the trimming with SD trimming per condition, returning mean RT trimmedData <- sdTrim(data = exampleData, minRT = 150, sd = 2.5, perCondition = TRUE, perParticipant = FALSE, returnType = "mean")