Learn R Programming

wqspt (version 1.0.2)

wqspt_plot: Plotting method for wqspt object

Description

Generates plots to help visualize and summarize WQS permutation test results.

Usage

wqspt_plot(
  wqsptresults,
  FixedPalette = FALSE,
  InclKey = FALSE,
  AltMixName = NULL,
  AltOutcomeName = NULL,
  ViridisPalette = "D",
  StripTextSize = 14,
  AxisTextSize.Y = 12,
  AxisTextSize.X = 12,
  LegendTextSize = 14,
  LegendWidthIn = 0.4,
  LegendHeightIn = 0.4,
  PvalLabelSize = 5,
  HeatMapTextSize = 5
)

Value

Returns a list with 4 objects.

FullPlot

Two plots stacked vertically: (1) A forest plot of the beta WQS coefficient with the naive confidence intervals as well as the permutation test p-value and (2) a heatmap of the WQS weights for each mixture component.

CoefPlot

Forest plot of the beta WQS coefficient with the naive confidence intervals as well as the permutation test p-value.

WtPlot

A heatmap of the WQS weights for each mixture component.

WtLegend

A legend for the weights in the WtPlot heatmap, saved as a TableGrob object.

Arguments

wqsptresults

An object of class wqs_pt.

FixedPalette

If TRUE, the heatmap color key for the mixture weights has categorical cutoffs with the following categories: <0.1, 0.1 - <0.2, 0.2 - <0.3, and >= 0.3. If false, the heatmap color key is continuous and dependent on the weight values.

InclKey

If TRUE, a horizontal heatmap legend is included at the bottom of the full plot.

AltMixName

Defaults to NULL. If not NULL, these are alternative names for the mixture components to be displayed on the heatmap y axis.

AltOutcomeName

Defaults to NULL. If not NULL, this is an alternative name for the outcome to be displayed on the heatmap x axis.

ViridisPalette

Color palette to be used for the viridisLite package-based coloring of the heatmap, with possible values from 'A' to 'E'. Defaults to 'D'.

StripTextSize

Text size for the plot strip labels. Defaults to 14.

AxisTextSize.Y

Text size for the y axis text. Defaults to 12.

AxisTextSize.X

Text size for the x axis text. Defaults to 12.

LegendTextSize

Text size for the legend text. Defaults to 14.

LegendWidthIn

Width of the horizontal bottom legend in inches. Defaults to 0.4.

LegendHeightIn

Height of the horizontal bottom legend in inches. Defaults to 0.4.

PvalLabelSize

The geom_text size for the permutation test p-value label. Defaults to 5.

HeatMapTextSize

The geom_text size for the mixture weight heatmap labels. Defaults to 5.

Examples

Run this code
# \donttest{
library(gWQS)

# mixture names
PCBs <- names(wqs_data)[1:10] #10 of the original 34 for a quick example

#quick example WQSPT model
perm_test_res <- wqs_full_perm(formula = yLBX ~ wqs, data = wqs_data, 
                                mix_name = PCBs, q = 10, b_main = 4, 
                                b_perm = 4, b1_pos = TRUE, b_constr = FALSE, 
                                niter = 3, seed = 16, 
                                plan_strategy = "multicore", 
                                stop_if_nonsig = FALSE)

#plot with continuous heatmap for mixture weights, omitting the heatmap 
# legend on the plot
wqsptplot <- wqspt_plot(perm_test_res)

#plot the full plot with the WQS coefficient forest plot above & the mixture 
# weight heatmap below
wqsptplot$FullPlot

#plot with binned heatmap for mixture weights
wqsptplot <- wqspt_plot(perm_test_res, InclKey = TRUE, LegendWidthIn = 0.8, 
FixedPalette = TRUE)

#plot the full plot with the WQS coefficient forest plot above & the mixture 
# weight heatmap below
wqsptplot$FullPlot
# }


Run the code above in your browser using DataLab