View source: R/plot_TransHDM.R
| plot.TransHDM | R Documentation |
S3 plot method for objects of class "TransHDM". Produces a bar chart
of the overall effects (indirect, direct, total, proportion mediated),
individual mediator effects, or p-values.
## S3 method for class 'TransHDM'
plot(
x,
type = c("overall", "mediator", "pvalue", "alpha_beta"),
fill = "white",
color = "black",
linewidth = 0.5,
size.text = 3,
show.values = TRUE,
digits = 3,
base_size = 12,
label = c("significant", "all", "none"),
...
)
x |
An object of class |
type |
Character string specifying the type of plot:
|
fill |
Bar fill color. Default is |
color |
Bar border color. Default is |
linewidth |
Bar border line width. Default is |
size.text |
Numeric; size of value labels on bars. Default is |
show.values |
Logical; if |
digits |
Integer; number of decimal places for displayed values.
Default is |
base_size |
Numeric; base font size passed to
|
label |
For |
... |
Additional arguments (currently unused). |
A ggplot object. The plot is printed
automatically when called interactively.
set.seed(123)
target_data <- gen_simData_homo(n = 50, p_x = 3, p_m = 20, rho = 0.1)$data
source_data <- gen_simData_homo(n = 100, p_x = 3, p_m = 20, rho = 0.1,
source = TRUE, transferable = TRUE)$data
result <- TransHDM(
target_data = target_data, source_data = source_data,
Y = "Y", D = "D", M = paste0("M", 1:20), X = paste0("X", 1:3),
transfer = TRUE, ncore = 1, topN = 10
)
plot(result)
plot(result, type = "mediator")
plot(result, type = "pvalue")
plot(result, type = "alpha_beta")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.