type_1_sdt: Type 1 SDT for a 2AFC design

View source: R/sdt_functions.R

type_1_sdtR Documentation

Type 1 SDT for a 2AFC design

Description

Calculate standard type 1 SDT measures for 2AFC.

Usage

type_1_sdt(
  df,
  stimulus = stimulus,
  response = response,
  counts = total,
  s = 1,
  add_constant = TRUE
)

Arguments

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 sdt_counts.

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.

Details

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.

Author(s)

Matt Craddock, matt@mattcraddock.com

Examples

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)

craddm/metaSDT documentation built on Feb. 10, 2024, 6:57 a.m.