densityplot()
take a distribution of PGS, a Phenotype and eventual Confounders
return a plot with density of PGS in x by Categories of the Phenotype
densityplot(
df = NULL,
prs_col = "SCORESUM",
phenotype_col = "Phenotype",
scale = TRUE,
threshold = NA
)
return a ggplot object (ggplot2)
a dataframe with individuals on each row, and at least the following columns:
one ID column,
one PGS column, with numerical continuous values following a normal distribution,
one Phenotype column, can be numeric (Continuous Phenotype), character, boolean or factors (Discrete Phenotype)
a character specifying the PGS column name
a character specifying the Phenotype column name
a boolean specifying if scaling of PGS should be done before plotting
a facultative numeric specifying for Continuous Phenotype the Threshold to consider individuals as Cases/Controls as following:
Phenotype > Threshold = Case
Phenotype < Threshold = Control