The goal of causnet is to find a globally optimal causal network given some data.
You can install the development version from GitHub with:
require("devtools")
install_github("USCbiostats/causnet")
\~You can install the released version of causnet from CRAN with:\~
install.packages("causnet")
library(causnet)
# simulate data
set.seed(1234)
mydata <- simdat(n_var = 5)
# causnet results
links.s <- causnet(mydata)
links.s
#> $network
#> from to component
#> 1 4 5 1
#> 2 3 4 1
#> 3 2 3 1
#> 4 1 2 1
#> 5 4 5 2
#> 6 3 4 2
#>
#> $n_best_parents
#> [1] 1 1 1 1 1 1
To use he a BGE scoring function simply pass thr score_bge()
to the
score_fun
argument.
causnet(mydata, score_fun = score_bge)
#> $network
#> from to component
#> 1 3 5 1
#> 2 3 4 1
#> 3 1 3 1
#> 4 1 2 1
#> 5 4 5 2
#> 6 3 4 2
#>
#> $n_best_parents
#> [1] 2 1 2 1 2 1
Please note that the causnet project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.