Takes the dataframe produced by the interval functions and plots the p-values/s-values, consonance (confidence) levels, and the interval estimates to produce a p-value/s-value function using ggplot2 graphics.

ggcurve(data, type = "c", measure = "default", levels = 0.95,
  nullvalue = FALSE, position = "pyramid", title = "Interval Function",
  subtitle = "The function displays intervals at every level.",
  xaxis = expression(Theta ~ "Range of Values"),
  yaxis = expression(paste(italic(p), "-value")), color = "#000000",
  fill = "#239a98")

Arguments

data

The dataframe produced by one of the interval functions in which the intervals are stored.

type

Choose whether to plot a "consonance" function, a "surprisal" function or "likelihood". The default option is set to "c". The type must be set in quotes, for example ggcurve (type = "s") or ggcurve(type = "c"). Other options include "pd" for the consonance distribution function, and "cd" for the consonance density function, "l1" for relative likelihood, "l2" for log-likelihood, "l3" for likelihood and "d" for deviance function.

measure

Indicates whether the object has a log transformation or is normal/default. The default setting is "default". If the measure is set to "ratio", it will take logarithmically transformed values and convert them back to normal values in the dataframe. This is typically a setting used for binary outcomes and their measures such as risk ratios, hazard ratios, and odds ratios.

levels

Indicates which interval levels should be plotted on the function. By default it is set to 0.95 to plot the 95% interval on the consonance function, but more levels can be plotted by using the c() function for example, levels = c(0.50, 0.75, 0.95).

nullvalue

Indicates whether the null value for the measure should be plotted. By default, it is set to FALSE, meaning it will not be plotted as a vertical line. Changing this to TRUE, will plot a vertical line at 0 when the measure is set to " default" and a vertical line at 1 when the measure is set to "ratio". For example, ggcurve(type = "c", data = df, measure = "ratio", nullvalue = "present"). This feature is not yet available for surprisal functions.

position

Determines the orientation of the P-value (consonance) function. By default, it is set to "pyramid", meaning the p-value function will stand right side up, like a pyramid. However, it can also be inverted via the option "inverted". This will also change the sequence of the y-axes to match the orientation.This can be set as such, ggcurve(type = "c", data = df, position = "inverted").

title

A custom title for the graph. By default, it is set to "Consonance Function". In order to set a title, it must be in quotes. For example, ggcurve(type = "c", data = x, title = "Custom Title").

subtitle

A custom subtitle for the graph. By default, it is set to "The function contains consonance/confidence intervals at every level and the P-values." In order to set a subtitle, it must be in quotes. For example, ggcurve(type = "c", data = x, subtitle = "Custom Subtitle").

xaxis

A custom x-axis title for the graph. By default, it is set to "Range of Values. In order to set a x-axis title, it must be in quotes. For example, ggcurve(type = "c", data = x, xaxis = "Hazard Ratio").

yaxis

A custom y-axis title for the graph. By default, it is set to "Consonance Level". In order to set a y-axis title, it must be in quotes. For example, ggcurve(type = "c", data = x, yxis = "Confidence Level").

color

Item that allows the user to choose the color of the points and the ribbons in the graph. By default, it is set to color = "#555555". The inputs must be in quotes. For example, ggcurve(type = "c", data = x, color = "#333333").

fill

Item that allows the user to choose the color of the ribbons in the graph. By default, it is set to fill = "#239a98". The inputs must be in quotes. For example, ggcurve(type = "c", data = x, fill = "#333333").

Value

A plot with intervals at every consonance level graphed with their corresponding p-values and compatibility levels.

References

Birnbaum, A. (1961), “A unified theory of estimation, I,” The Annals of Mathematical Statistics, 32, 112–135.

Chow, Z. R., and Greenland, S. (2019), “Semantic and Cognitive Tools to Aid Statistical Inference: Replace Confidence and Significance by Compatibility and Surprise,” arXiv:1909.08579.

Fraser, D. A. S. (2017), “p-Values: The Insight to Modern Statistical Inference,” Annual Review of Statistics and Its Application, 4, 1–14.

Fraser, D. A. S. (2019), “The P-value function and statistical inference,” The American Statistician, 73, 135–147.

Hjort, N. L., and Schweder, T. (2018), “Confidence distributions and related themes,” Journal of Statistical Planning and Inference, 195, 1–13.

Infanger, D., and Schmidt‐Trucksäss, A. (2019), “P value functions: An underused method to present research results and to promote quantitative reasoning,” Statistics in Medicine.

Poole, C. (1987a), “Beyond the confidence interval,” American Journal of Public Health, 77, 195–199.

Poole, C. (1987b), “Confidence intervals exclude nothing.,” American Journal of Public Health, 77, 492–493.

Rothman, K. J., Greenland, S., and Lash, T. L. (2008a), Modern Epidemiology, Lippincott Williams & Wilkins.

Rothman, K. J., Greenland, S., and Lash, T. L. (2008b), “Precision and statistics in epidemiologic studies,” in Modern Epidemiology, eds. K. J. Rothman, S. Greenland, and T. L. Lash, Lippincott Williams & Wilkins, pp. 148–167.

Schweder, T., and Hjort, N. L. (2002), “Confidence and Likelihood*,” Scandinavian Journal of Statistics, 29, 309–332.

Schweder, T., and Hjort, N. L. (2016), Confidence, Likelihood, Probability: Statistical Inference with Confidence Distributions, Cambridge University Press.

Sullivan, K. M., and Foster, D. A. (1990), “Use of the confidence interval function,” Epidemiology, 1, 39–42.

Xie, M., and Singh, K. (2013), “Confidence Distribution, the Frequentist Distribution Estimator of a Parameter: A Review,” International Statistical Review, 81, 3–39.

See also

Examples

# Simulate random data library(concurve) GroupA <- rnorm(500) GroupB <- rnorm(500) RandomData <- data.frame(GroupA, GroupB) intervalsdf <- curve_mean(GroupA, GroupB, data = RandomData, method = "default") ggcurve(type = "c", intervalsdf[[1]], nullvalue = TRUE)