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
);
Run the code above in your browser using DataLab