The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
causalnet
is an R package for enumerating and analyzing
directed causal networks derived from an undirected or partially
directed skeleton. It includes:
fixed_edges
).stress_event(t, state)
;"reflect"
, "clamp"
,
"none"
, or "auto"
.install.packages("remotes")
::install_github("KyuriP/causalnet") remotes
library(causalnet)
## 1) Undirected skeleton (triangle)
<- matrix(0, 3, 3,
adj dimnames = list(paste0("X", 1:3), paste0("X", 1:3)))
1,2] <- adj[2,1] <- 1
adj[2,3] <- adj[3,2] <- 1
adj[3,1] <- adj[1,3] <- 1
adj[
## 2) Enumerate all directed variants (allowing bidirected edges)
<- generate_directed_networks(adj, allow_bidirectional = TRUE)
nets
## 3) Summarize structure
<- summarize_network_metrics(nets)
summary_df plot_network_metrics(summary_df, n_bins = 6) # cowplot grid of 4 panels
## 4) Pick two representatives
<- which(summary_df$num_loops == 0)[1]
i_no_loop <- which.max(summary_df$num_loops)
i_max_loop
## 5) Simulate dynamics with a brief external stress at t ∈ [0, 5]
<- get_sample_parameters(n_nodes = nrow(adj))
params <- function(t, state) if (t <= 5) rep(0.01, length(state)) else rep(0, length(state))
stress_event
<- simulate_dynamics(nets[[i_no_loop]], params,
S_no t_max = 20, dt = 0.05, stress_event = stress_event)
<- simulate_dynamics(nets[[i_max_loop]], params,
S_hi t_max = 20, dt = 0.05, stress_event = stress_event)
## 6) Plot trajectories (stress windows use the *time* axis)
plot_dynamics(S_no, stress_windows = list(c(0, 5)), title = "No Loops")
plot_dynamics(S_hi, stress_windows = list(c(0, 5)), title = "Many Loops")
A full walk-through (enumeration → metrics → simulation → visuals) is available in the Quarto vignette:
::quarto_preview("vignettes/causalnet_demo.qmd") quarto
Issues & feature requests: please use the
tracker → https://github.com/KyuriP/causalnet/issues.
When filing a bug, include a minimal reproducible
example (reprex
), your sessionInfo()
,
and the package version.
Questions / ideas: open a Discussion or an Issue.
Pull requests welcome: add a short description, tests (if applicable), and updated docs where relevant.
This project is released under the GPL-3 license.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.