Learn R Programming

drhutools (version 1.0.0)

cdplot: Visualizing the experimental outcome with cumulative distribution functions.

Description

Packed ggplot2 function to compare the empirical cumulative distribution functions (ECDF) between the treatment and control groups in an experiment or quasi-experiment.

Value

A list of ggplot2 objects comparing the ECDFs between the control and treatment groups and identifying at most three largest differences.

Arguments

data

A data.frame including two columns, one recording the outcome and the other recording the assignment. The assignment column must be named as group.

ks_test

A logical option to indicate whether to show the Kolmogorov-Smirnov test result in the bottom-right corner. The default value is FALSE.

point_size

An integer to indicate the size of the points at the largest difference. The default value is 3.

point_color

An character or function to indicate the color of the points at the largest difference. The default value is drhutools::gb_cols("red").

link_color

An character or function to indicate the color of the link at the largest difference. The default value is drhutools::gb_cols("red").

Examples

Run this code

data("PlantGrowth")

plot_plant <- cdplot(PlantGrowth, ks_test = TRUE)
plot_plant

Run the code above in your browser using DataLab