This function computes the proportion of correct responses per participant. Proportions can either be separated by condition or collapsed across conditions.

prop_correct_free(
  data,
  responses,
  key,
  id,
  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.

id

a column name containing participant ID numbers 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


data(wide_data)
data(answer_key_free)

DF_long <- arrange_data(data = wide_data,
 responses = "Response",
 sep = ",",
 id = "Sub.ID")

scored_output <- prop_correct_free(data = DF_long,
 responses = "response",
 key = answer_key_free$Answer_Key,
 id = "Sub.ID",
 cutoff = 1,
 flag = TRUE,
 group.by = "Disease.Condition")

head(scored_output$DF_Scored)
#>   Responses Sub.ID position Disease.Condition   Answer Scored
#> 1   bacpack      3        1           healthy backpack      1
#> 2    basket      1        1           healthy   basket      1
#> 3       bed      2        2           healthy      bed      1
#> 4       bed      4        6              sick      bed      1
#> 5       bed      5        1              sick      bed      1
#> 6       bed      6        1              sick      bed      1

head(scored_output$DF_Participant)
#>   Disease.Condition Sub.ID Proportion.Correct Z.Score.Group Z.Score.Participant
#> 1           healthy      1          0.3928571     0.5773503           1.0819232
#> 2           healthy      2          0.1428571    -1.1547005          -1.3096965
#> 3           healthy      3          0.3928571     0.5773503           1.0819232
#> 4              sick      4          0.3214286     1.1547005           0.3986033
#> 5              sick      5          0.2142857    -0.5773503          -0.6263766
#> 6              sick      6          0.2142857    -0.5773503          -0.6263766

head(scored_output$DF_Group)
#>   Disease.Condition      Mean         SD N
#> 1           healthy 0.3095238 0.14433757 3
#> 2              sick 0.2500000 0.06185896 3