Creates a scatterplot of true effect sizes against estimated effect sizes.

plot_estimates_vs_true(
  dataset,
  BETA,
  P,
  bonferroni,
  true_effect,
  save_plot_path = FALSE,
  plot_filename = "beta_comparison.png"
)

Arguments

dataset

data imported to R by load_results().

BETA

column containing the estimated effect sizes from the analysis. State in the format dataset$BETA.

P

column containing the p-values from the analysis. State in the format dataset$P.

bonferroni

the column containing significance at bonferroni correction. State in the format dataset$bonferroni.

true_effect

the column containing the true effect sizes. State in the format dataset$true_effect. Note: standard called 'beta' if loaded by load_results().

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

In the plot an identity line is included, which helps visualise how well the estimations compare to the true effect sizes.
Only SNPs with a p-value smaller than 0.05 are included in the plot.
The plot requires the user to run an analysis with analysis_association(), load the results and merge with beta.txt using load_results() and augment results with augment_results().