Creates a QQ-plot of the p-values specified.

plot_pval_QQ(
  dataset,
  P,
  line_color = "black",
  line_size = 1,
  qq_color = "cornflowerblue",
  qq_shape = 20,
  save_plot_path = FALSE,
  plot_filename = "QQ-pvals.png"
)

Arguments

dataset

data imported to R by load_results().

P

column containing p-values to be plotted. State in the format dataset$P_value.

line_color

color of the identity line.

line_size

size of the identity line.

qq_color

color of the points showing the quantiles of the p-values.

qq_shape

shape of the points showing the quantiles of the p-values.

save_plot_path

if FALSE, return the function returns a ggplot object. Else a path of the directory to save the plot to.

plot_filename

name of the file to be saved, including file extension. Must be either .pdf, .png or .jpeg

Value

Either returns a ggplot object or saves the plot to save_plot_path and returns NULL.

Details

Use analysis_association() to obtain p-values for an analysis and import these with load_results().
Assumes p-values are uniformly distributed, and hence uses the uniform distribution for the theoretical quantiles.
vignette("ggplot2-specs", package = "ggplot2") details the usage of aesthetic parameters in ggplot2.