This function computes the proportion of correct responses per participant. Proportions can either be separated by condition or collapsed across conditions. You will need to ensure each trial is marked with a unique id to correspond to the answer key.

prop_correct_cued(
  data,
  responses,
  key,
  key.trial,
  id,
  id.trial,
  cutoff = 0,
  flag = FALSE,
  group.by = NULL
)

Arguments

data

a dataframe of the variables you would like to return. Other variables will be included in the scored output and in the participant output if they are a one to one match with the participant id.

responses

a column name in the dataframe that contains the participant answers for each item in quotes (i.e., "column")

key

a vector containing the scoring key or data column name. This column does not have to be included in the original dataframe.

key.trial

a vector containing the trial numbers for each answer. Note: If you input long data (i.e., repeating trial-answer responses), we will take the unique combination of the responses. If a trial number is repeated, you will receive an error. Key and key.trial can also be a separate dataframe, depending on how your output data is formatted.

id

a column name containing participant ID numbers from the original dataframe.

id.trial

a column name containing the trial numbers for the participant data from the original dataframe.

cutoff

a numeric value that determines the criteria for scoring (i.e., 0 = strictest, 5 = is most lenient). The scoring criteria uses a Levenshtein distance measure to match participant responses to the answer key.

flag

a logical argument if you want to flag participant scores that are outliers using z-scores away from the mean score for group

group.by

an optional argument that can be used to group the output by condition columns. These columns should be in the original dataframe and concatenated c() if there are multiple columns

Value

DF_Scored

The dataframe of the original response, answer, scoring, and any other or grouping variables. This dataframe can be used to determine if the cutoff score and scoring matched your answer key as intended. Distance measures are not perfect! Issues and suggestions for improvement are welcome.

DF_Participant

A dataframe of the proportion correct by participant, which also includes optional z-scoring, grouping, and other variables.

DF_Group

A dataframe of the summary scores by any optional grouping variables, along with overall total proportion correct scoring.

Details

Note: other columns included in the dataframe will be found in the final scored dataset. If these other columns are between subjects data, they will also be included in the participant dataset (i.e., there's a one to one match of participant ID and column information).

Examples


#This data contains cued recall test with responses and answers together.
#You can use a separate answer key, but this example will show you an
#embedded answer key. This example also shows how you can use different
#stimuli across participants (i.e., each person sees a randomly selected
#set of trials from a larger set).

data(cued_data)

scored_output <- prop_correct_cued(data = cued_data,
 responses = "response",
 key = "key",
 key.trial = "trial",
 id = "id",
 id.trial = "trial",
 cutoff = 1,
 flag = TRUE,
 group.by = "condition")
#> Warning: The number of trials is not the same for every participant.
#>             We will use the max value of trials to calculate proportion
#>             correct. Check your data if this is not intended.

head(scored_output$DF_Scored)
#>   Trial.ID Sub.ID Responses  key condition Answer Scored
#> 1        1      2      long long         a   long      1
#> 2        1     93      long long         a   long      1
#> 3        1    122      long long         a   long      1
#> 4        1    105           long         a   long      0
#> 5        1     17           long         b   long      0
#> 6        1     61  lengthen long         b   long      0

head(scored_output$DF_Participant)
#>   condition Sub.ID Proportion.Correct Z.Score.Group Z.Score.Participant
#> 1         a      2            0.53750    0.76599878           0.9803657
#> 2         b      3            0.48750    0.83985588           0.5969490
#> 3         a      4            0.25625   -1.16238975          -1.1763533
#> 4         b      5            0.45000    0.50471149           0.3093865
#> 5         a      6            0.43125    0.03749644           0.1656052
#> 6         b      7            0.44375    0.44885409           0.2614594

head(scored_output$DF_Group)
#>   condition      Mean        SD  N
#> 1         a 0.4257812 0.1458472 56
#> 2         b 0.3935268 0.1118921 56