textTrainNPlot() plots cross-validated correlation coefficients across different sample-sizes from the object returned by the textTrainN function. If the number of cross-validations exceed one, then error-bars will be included in the plot.
textTrainNPlot(
results_data,
breaks = NULL,
x_unit = "percent",
y_range = NULL,
title = "Cross-validated correlation coefficients across sample sizes",
x_axes_label = "Sample Size (percent)",
y_axes_label = "Correlation Coefficient (r)",
point_color = "#5dc688",
error_bar = "std_err",
bar_color = "#60A1F7",
line_color = "grey",
bar_width = 1,
bar_size = 0.8,
line_size = 0.6,
line_type = "straight",
point_size = 3,
log_transform_x = FALSE
)
(list) One or several objects returned by the function textTrainN as a list (e.g, list(object1, object2)). Also, if several models are provided, then one can add a vector c() with settings (i.e the parameters below) for each model (make sure to add the settings in the order as the models are ordered, if you look to keep the original settings then write "").
(numeric) Vector containing the percents of the total number of data points that is included in each sample (default = NULL, which takes the breaks from the percentages). If several models are provided, then one can add a vector c() with settings for each model (make sure to add the settings in the order as the models are ordered).
(character, "percent" or "quantity") Determines whether the x-axis-values should represent the number of elements in each sample, or the number of percent of the total data they represent (default = "percent").
(numeric) Optional. Determines the y_range. E.g, y_range = c(1,2) sets the y_range from 1 to 2 (default = NULL).
(character) Determine plot title (default = "Cross-validated correlation coefficients across different sample sizes").
(character) Determine x-axis-label (default = "Sample Size (percent)").
(character) Determine y-axis-label (default = "Correlation Coefficient (r)").
(character, (Hex color codes)) Determine point color (default = "#5dc688"). Can set a vector if several results_data are provided.
Default "std_err"; see also "std", NULL. Can set a vector if several results_data are provided.
(character, (Hex color codes)) Determine error-bar color (default = "#60A1F7"). Can set a vector if several results_data are provided.
(character, (Hex color codes)) Determine line color (default = "grey"). Can set a vector if several results_data are provided.
(numeric) Determine bar-width (default = 1). Can set a vector if several results_data are provided.
(numeric) Determine bar-size (default = 1). Can set a vector if several results_data are provided.
(numeric) Determine line-size (default = 1). Can set a vector if several results_data are provided.
(character, either "straight" or "smooth") Determine line-type (default = "straight"). Can set a vector if several results_data are provided.
(numeric) Determine points size (default = 1). Can set a vector if several results_data are provided.
(boolean) Determine wether to log-transform x in case of displaying number of samples (default = FALSE).
A plot with correlation coefficient on y-axis and sample size in quantity or percent on x axis. If number och cross-validations exceed 1, then error bars measuring standard deviations will be plotted.
Example of a plot created by textTrainNPlot.
See textTrainN
.
# Plot cross-validated correlation coefficients across different sample-sizes from the object
# returned by the textTrainN function.
if (FALSE) { # \dontrun{
# Plot the performance of a single model across different sample sizes
plot_object1 <- textTrainNPlot(
train_data = tibble_to_plot,
n_cross_val = 3,
x_unit = "quantity"
)
# Visualize plot
plot_object1
# Plot the performance of several models across different sample sizes.
plot_object2 <- textTrainNPlot(train_data = list(object1, object2, object3),
n_cross_val = c(2,1,1),
line_color = c("","","#0000FF")) # "" gives the default settings.
# Visualize plot
plot_object2
} # }