View source: R/sdt_functions.R
type_1_sdt | R Documentation |
Calculate standard type 1 SDT measures for 2AFC.
type_1_sdt(
df,
stimulus = stimulus,
response = response,
counts = total,
s = 1,
add_constant = TRUE
)
df |
Data frame. See notes. |
stimulus |
Column name for levels of the stimulus. Should be bare, unquoted. Default is 'stimulus' |
response |
Column name for responses. Should be bare, unquoted. Default is 'response'. |
counts |
Column name for totals. Should be bare, unquoted. Defaults to
"total", as this is the column name output by |
s |
Ratio of standard deviations of stimulus types. Defaults to 1 (equal variance). |
add_constant |
Adds a small constant to every cell to account for boundaries - i.e. log-linear correction. Default = TRUE. |
The expected data frame format is one column indicating the stimulus (note
that the first level of this factor will be treated as stimulus A), one
column indicating the response (note - this should be coded with 1 as
response A), and one column indicating the total number of responses of that
type. Thus, there should be one row per combination of stimulus and response.
If your data is in long format (i.e. one row per trial), you can use the
sdt_counts
function first to get the data into the expected format.
The type_1_sdt
function assumes that 1 = responded with first level of
stimulus factor (e.g. 1 = stimulus A), and will calculate d-prime on that
basis. Note that by default it adds a small constant to all cells to avoid
boundary issues.
Matt Craddock, matt@mattcraddock.com
type_1_test <- data.frame(
expand.grid(
stimulus = c("A", "B"),
response = c(1, 2)
),
total = c(30, 10, 8, 32)
)
type_1_sdt(type_1_test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.