aggregate_responses: Creates the aggregated data object needed by other functions.

Description Usage Arguments Value Examples

View source: R/aggregate_responses.R

Description

aggregate_responses aggregates combined or binary responses and stores them in a list together with additional variables and the stimulus variable. The resulting object is required by plot_sdt_fit and make_stan_data functions.

Usage

1
2
3
4
5
6
7
aggregate_responses(
  data,
  stimulus = NULL,
  response,
  variables = NULL,
  K = NULL
)

Arguments

data

a data frame containing stimulus and response variables. If SDT parameters are regressed on additional variables then these variables have to be present as well.

stimulus

a name of the stimulus variable in the provided data frame. The stimulus variable can be of any type but it must contain only two kinds of values.

response

a name of the response variable in the provided data frame. This can be a binary classification response or a combined response (see combined_response).

variables

an optional vector of names of additional variables (such as a variable encoding group membership) that must by preserved in the resulting aggregated data object.

Value

a list with three components:

data

The data frame containing all the variables listed in the variables argument excluding the stimulus and response variables.

stimulus

The stimulus variable representing the stimulus class as either 1 or 2.

counts

The response counts matrix with K columns where K is the number of possible (combined or binary) responses.

Examples

1
2
3
4
5
data(gabor)
gabor$resp = combined_response(gabor$stim, gabor$rating, gabor$acc)
## See how the lower (higher) combined response values are more common
## for the 1 (2) stimulus class
aggregate_responses(gabor, 'stim', 'resp')

boryspaulewicz/bhsdtr documentation built on March 8, 2020, 8:24 a.m.