| DPI_dag | R Documentation |
Directed acyclic graphs (DAGs) via DPI exploratory analysis (causal discovery) for all significant partial rs.
DPI_dag(
data,
k.covs = 1,
n.sim = 1000,
alpha = 0.05,
bonf = FALSE,
pseudoBF = FALSE,
seed = NULL,
progress,
file = NULL,
width = 6,
height = 4,
dpi = 500
)
data |
A dataset with at least 3 variables. |
k.covs |
An integer vector (e.g., |
n.sim |
Number of simulation samples. Defaults to |
alpha |
Significance level for computing the
|
bonf |
Bonferroni correction to control for false positive rates:
|
pseudoBF |
Use normalized pseudo Bayes Factors Defaults to |
seed |
Random seed for replicable results. Defaults to |
progress |
Show progress bar. Defaults to |
file |
File name of saved plot ( |
width, height |
Width and height (in inches) of saved plot. Defaults to |
dpi |
Dots per inch (figure resolution). Defaults to |
Return a data.frame (class dpi.dag) of DPI exploration results.
S3method.network
DPI()
DPI_curve()
BNs_dag()
cor_net()
p_to_bf()
# partial correlation networks (undirected)
cor_net(airquality, "pcor")
# directed acyclic graphs (grey edge = insignificant DPI)
dpi.dag = DPI_dag(airquality, k.covs=c(1,3,5), seed=1)
print(dpi.dag, k=1) # DAG with DPI(k=1)
print(dpi.dag, k=3) # DAG with DPI(k=3)
print(dpi.dag, k=5) # DAG with DPI(k=5)
# set edge labels and edge transparency
# (grey edge = insignificant DPI)
print(dpi.dag, k=5, show.label=FALSE, faded.dpi=TRUE)
# modify ggplot attributes
gg = plot(dpi.dag, k=5, show.label=FALSE, faded.dpi=TRUE)
gg + labs(title="DAG with DPI (k=5)")
# visualize DPIs of multiple paths
ggplot(dpi.dag$DPI, aes(x=k.cov, y=DPI)) +
geom_ribbon(
aes(ymin=Sim.LLCI, ymax=Sim.ULCI, fill=path),
alpha=0.1) +
geom_line(aes(color=path), linewidth=0.7) +
geom_point(aes(color=path)) +
geom_hline(yintercept=0, color="red",
linetype="dashed") +
scale_y_continuous(limits=c(NA, 0.5)) +
labs(color="Directed Prediction",
fill="Directed Prediction") +
theme_classic()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.