ba_plot | R Documentation |
Create a Bland-Altman plot
ba_plot(plotdata, x_var, y_var, x_name, y_name, shape = 16, ...)
plotdata |
dataframe from which to build the plot |
x_var |
character expression to evaluate for the x-axis |
y_var |
character expression to evaluate for the y-axis |
x_name |
axis label for the x-axis |
y_name |
axis label for the y-axis |
shape |
numeric. The point shape to display. |
... |
further arguments passed to |
a Bland-Altman plot
Bland, J. M., & Altman, D. G. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. lancet, 1(8476), 307-310.
ba_analysis
data(ex_data, package = "PAutilities") # Reduce the number of data points (for illustration purposes) by isolating # the 150 largest cases illustration_threshold <- quantile(ex_data$Axis1, probs = 1 - (150 / nrow(ex_data))) ex_data <- ex_data[ex_data$Axis1 > illustration_threshold, ] # Generate the plot my_ba <- ba_plot( ex_data, "(Axis1 + Axis3) / 2", "Axis1 - Axis3", "mean(Axis1, Axis3)", "Axis1 - Axis3" ) my_ba # You can add to the plot as you would a normal ggplot object my_ba + ggplot2::geom_text( x = 2000, y = 9000, label = "A", size = 8, fontface = "bold", colour = "blue" ) # With caution, you can change some automatic options (e.g. color of # regression line) by overwriting in a new layer my_ba + ggplot2::geom_smooth(method = "lm", se = FALSE, colour = "blue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.