rciplot {rciplot} | R Documentation |
rciplot
Description
Create a scatterplot of your sample in which the x-axis maps to the pre-scores, the y-axis maps to the post-scores and several graphical elements (lines, colors) allow you to gain a quick overview about reliable changes in these scores. An example of this kind of plot is Figure 2 of Jacobson & Truax (1991). Jacobson-Truax classification (represented in point colors) is always based on 'recovery_cutoff', not on any other plotted horizontal line (e.g. mid of means).
Usage
rciplot(
data,
pre = NULL,
post = NULL,
group = NULL,
reliability = NULL,
reliable_change_alpha = 0.05,
recovery_cutoff = NULL,
classification_method = "recovery cutoff",
show_classification_counts = TRUE,
show_classification_percentages = TRUE,
higher_is_better = TRUE,
pre_jitter = 0,
post_jitter = 0,
opacity = 0.5,
size_points = 1,
size_lines = 0.3,
draw_meanmid_line = FALSE,
draw_2sd_functional_line = FALSE,
draw_2sd_dysfunctional_line = FALSE,
mean_functional = NULL,
mean_dysfunctional = NULL,
sd_functional = 1,
sd_dysfunctional = 1
)
Arguments
data |
Dataframe containing all relevant data |
pre |
Name of the column in 'data' containing pre values |
post |
Name of the column in 'data' containing post values |
group |
Name of column by which cases are to be grouped (controls shape of scatter plot points) |
reliability |
Reliability of the used test / instrument |
reliable_change_alpha |
Probability of alpha error for the calculation of the critical distance which is the minimum pre-post difference to be regarded statistically significant |
recovery_cutoff |
Test score below which individuals are considered healthy / recovered |
classification_method |
What cutoff value is to be used to classify individuals into healthy / unhealthy individuals? Possible values: "recovery cutoff" = the so-named function parameter, "mid of means" = the exact numeric mid between the two function parameters mean_functional and mean_dysfunctional, "2 sd dysfunctional" = everybody with a score higher than 2 SD above the dysfunctional group mean is healthy "2 sd functional" = everybody with a score higher than 2 SD below the functional group mean is healthy |
show_classification_counts |
If TRUE, show number of cases for each classification (e.g. reliable improvement, no reliable change, ...) in legend |
show_classification_percentages |
Expanding on 'show_classification_counts'.If TRUE, show the respective percentage of the whole sample each classification makes up. |
higher_is_better |
TRUE if higher values indicate a remission / healthy individual. FALSE if higher values indicate worse health. |
pre_jitter |
Jitter factor to apply to pre values |
post_jitter |
Jitter factor to apply to post values |
opacity |
Alpha value of scatter plot points |
size_points |
Size of scatter plot points. |
size_lines |
Size (thickness) of lines in plot. |
draw_meanmid_line |
Draw a horizontal line indicating the middle between the population means for a functional (healthy) population and a dysfunctional (diseased) population, described as criterion *c* in Jacobson & Truax (1991). |
draw_2sd_functional_line |
Draw a horizontal line indicating a cutoff at a 2 SD distance from 'mean_functional', described as criterion *b* in Jacobson & Truax (1991). |
draw_2sd_dysfunctional_line |
Draw a horizontal line indicating a cutoff at a 2 SD distance from 'mean_dysfunctional', described as criterion *a* in Jacobson & Truax (1991). |
mean_functional |
Required if 'draw_meanmid_line = T' or 'draw_2sd_[dys]functional_line = T'. Mean test score of the functional population. |
mean_dysfunctional |
Required if 'draw_meanmid_line = T' or 'draw_2sd_[dys]functional_line'. Mean test score of the dysfunctional population. |
sd_functional |
Optional for 'draw_meanmid_line = T'. Standard deviation of the functional population. |
sd_dysfunctional |
Optional for 'draw_meanmid_line = T'. Standard deviation of the dysfunctional population. |
Value
A list containing:
higher_is_better |
Exactly the input parameter higher_is_better
|
reliable_change | Pre-Post differences larger than this difference are regarded reliable |
plot | ggplot2 scatter plot analogous to Figure 2 of Jacobson & Truax (1991) |
categorization |
List containing categorization of all samples given in data .
Thus, has as many items as data has rows.
|
Examples
# Using example data from `sample_data.rda` to recreate Figure 2 of
# Jacobson & Truax (1991):
rciplot(
data = sample_data,
pre = 'pre_data',
post = 'post_data',
reliability = 0.88,
recovery_cutoff = 104,
opacity = 1
)