analyze.pgs.binary.predictiveness | R Documentation |
This function performs logistic regression to evaluate the predictiveness of polygenic scores for binary or continuous phenotypes. For continuous phenotypes, it converts them to binary based on a specified cutoff threshold. It calculates and returns AUC, Odds Ratios (OR), and p-values for each PGS. Corresponding ROC curves are plotted automatically.
analyze.pgs.binary.predictiveness(
pgs.data,
pgs.columns,
phenotype.columns,
covariate.columns = NULL,
phenotype.type = "binary",
cutoff.threshold = NULL,
output.dir = NULL,
filename.prefix = NULL,
file.extension = "png",
width = 8,
height = 8,
xaxes.cex = 1.5,
yaxes.cex = 1.5,
titles.cex = 1.5
)
pgs.data |
A data frame containing the PGS, phenotype, and covariate columns. |
pgs.columns |
A character vector specifying the names of the PGS columns
in |
phenotype.columns |
A character vector specifying the names of the phenotype columns in |
covariate.columns |
A character vector specifying the names of covariate columns in |
phenotype.type |
A character string specifying the type of phenotype. Must be either 'continuous' or 'binary'. All provided phenotype columns must match this type. |
cutoff.threshold |
A numeric value or a named list specifying the cutoff threshold for converting continuous phenotypes to binary. If a named list, it must contain entries for each continuous phenotype. |
output.dir |
A character string specifying the directory where the ROC plots will be saved. If NULL, no plots are saved. |
filename.prefix |
A character string specifying the prefix for the output filenames. If NULL, defaults to 'ApplyPolygenicScore-Plot'. |
file.extension |
A character string specifying the file extension for the output plots. Default is 'png'. |
width |
Numeric value specifying the width of the output plot in inches. |
height |
Numeric value specifying the height of the output plot in inches. |
xaxes.cex |
Numeric size for all x-axis labels. |
yaxes.cex |
Numeric size for all y-axis labels. |
titles.cex |
Numeric size for all plot titles. |
A list containing a data frame of logistic regression results and a plot object of corresponding ROC curves.
Output Formatting
results.df |
A data frame with columns:
Values for |
roc.plot |
A |
Each phenotype is plotted in a separate panel, with ROC curves for each PGS specified in pgs.columns
.
set.seed(100);
pgs.data <- data.frame(
PGS = rnorm(100, 0, 1),
continuous.phenotype = rnorm(100, 2, 1),
binary.phenotype = sample(c(0, 1), 100, replace = TRUE),
covariate1 = rnorm(100, 0, 1)
);
temp.dir <- tempdir();
# Basic analysis with binary phenotype
analyze.pgs.binary.predictiveness(
pgs.data,
output.dir = temp.dir,
filename.prefix = 'basic-plot',
pgs.columns = 'PGS',
phenotype.columns = 'binary.phenotype',
phenotype.type = 'binary',
covariate.columns = 'covariate1',
width = 6,
height = 6
);
# Analysis with continuous phenotype and cutoff threshold
analyze.pgs.binary.predictiveness(
pgs.data,
output.dir = temp.dir,
filename.prefix = 'continuous-plot',
pgs.columns = 'PGS',
phenotype.columns = 'continuous.phenotype',
phenotype.type = 'continuous',
cutoff.threshold = 1.5, # Convert to binary using this threshold
covariate.columns = NULL,
width = 6,
height = 6
);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.