Function to plot model-free summary statistics of behavioural data. Users can plot mean absolute error, resultant vector length, and precision of the behavioural data.
plot_summary_statistic(
data,
statistic = "precision",
unit = "degrees",
id_var = "id",
response_var = "response",
target_var = "target",
set_size_var = NULL,
condition_var = NULL,
return_data = FALSE,
palette = "Dark2"
)
If return_data
is set to FALSE
(which it is by default),
the function returns a ggplot2 object visualising the summary statistic
averaged across participants (if applicable) per set-size (if applicable)
and condition (if applicable).
If return_data
is set to TRUE
, the function returns a
list with two components:
plot:
The ggplot2 object.
data:
A data frame with the data used to generate the plot.
A data frame with columns containing: participant identifier ('id_var'); the participants' response per trial ('response_var'); the target value ('target_var'); and, if applicable, the set size of each response ('set_size_var'), and the condition of each response ('condition_var').
The summary statistic to plot. This can be set to "mean_absolute_error", "resultant_vector_length", or "precision".
The unit of measurement in the data frame: "degrees" (measurement is in degrees, from 0 to 360); "degrees_180 (measurement is in degrees, but limited to 0 to 180); or "radians" (measurement is in radians, from pi to 2 * pi, but could also be already in -pi to pi).
The column name coding for participant id. If the data is from a single participant (i.e., there is no id column) set to "NULL".
The column name coding for the participants' responses.
The column name coding for the target value.
The column name (if applicable) coding for the set size of each response.
The column name (if applicable) coding for the condition of each response.
A boolean (TRUE or FALSE) indicating whether the data for the plot should be returned.
A character stating the preferred colour palette to use. To see all available palettes, type ?scale_colour_brewer into the console.
plot_summary_statistic(bays2009_full,
unit = "radians",
statistic = "precision",
set_size_var = "set_size",
condition_var = "duration")
Run the code above in your browser using DataLab