visualize\(data\)scores$distribution
visualize PRS score distributions
Description
Creates distribution plots for polygenic risk scores across samples, optionally faceted by phenotypic variables.
Usage
visualize.scores.distribution(
data,
models,
scores.layer = X,
obs = NULL,
split.by = NULL,
group.by = NULL,
label = NULL,
type = c("violin", "density", "histogram", "boxplot"),
show.outliers = TRUE,
show.points = FALSE,
raster = FALSE,
color.by = c("model", "group"),
pattern.args = list(),
geom.args = list(),
raster.args = list(),
facet.args = list(),
...
)
Arguments
data
|
A |
models
|
Unquoted expression selecting which models to include. Can be:
|
scores.layer
|
Unquoted expression; name of the scores layer to access. Defaults to |
obs
|
Optional unquoted expression selecting observations to keep. Resolved via |
split.by
|
Unquoted expression selecting a faceting variable from phenotypes. Can be a simple variable or expression. Creates separate panels for each level. |
group.by
|
Unquoted expression selecting a grouping variable from phenotypes. Creates multiple distributions per model within each panel. When combined with multiple models, use |
label
|
Unquoted expression selecting labels for models from phenotypes or metadata. Passed to |
type
|
Character; type of distribution plot:
|
show.outliers
|
Logical; if |
show.points
|
Logical; if |
raster
|
Logical; if |
color.by
|
Character; when both multiple models and |
pattern.args
|
List; additional arguments passed to ggpattern geoms when patterns are used. Common options: |
geom.args
|
List; additional arguments passed to the main distribution geom (geom_violin, geom_density, geom_histogram, or geom_boxplot). Common options: |
raster.args
|
List; additional arguments passed to |
facet.args
|
List; additional arguments passed to |
…
|
Additional arguments passed to |
Details
For single model: shows one distribution plot. For multiple models: overlays distributions, colored by model.
Value
A
Examples
## Not run:
# Single model distribution
visualize$data$scores$distribution(data, models = 1)
# Multiple models overlaid
visualize$data$scores$distribution(data, models = c(1, 2, 3), type = "density")
# Distribution split by sex
visualize$data$scores$distribution(data, models = 1, split.by = sex)
# Single model grouped by diagnosis
visualize$data$scores$distribution(data, models = 1, group.by = diagnosis, type = "density")
# Multiple models grouped by sex (models colored, groups patterned)
visualize$data$scores$distribution(
data,
models = c(1, 2),
group.by = sex,
color.by = "model"
)
# Multiple models grouped by sex (groups colored, models patterned)
visualize$data$scores$distribution(
data,
models = c(1, 2),
group.by = sex,
color.by = "group"
)
# Multiple models, split by diagnosis
visualize$data$scores$distribution(
data,
models = c(AD_PRS, PD_PRS),
split.by = diagnosis,
type = "density"
)
# Show individual points with rasterization for large datasets
visualize$data$scores$distribution(
data,
models = 1:3,
show.points = TRUE,
raster = TRUE
)
## End(Not run)