diff --git a/README.md b/README.md index f9616fe..bfa0a71 100644 --- a/README.md +++ b/README.md @@ -4,58 +4,56 @@ The `NetworkCausalTree` package introduces a machine learning method that uses t ## Getting Started -Installing the latest developing version: +Installing the latest developing version: -```r +``` r library(devtools) install_github("fbargaglistoffi/NetworkCausalTree", ref="master") ``` -Import: +Import + set seed: -```r +``` r library("NetworkCausalTree") +set.seed(123) ``` ## Examples ### Example 1 -Data generated using Erdos Renyi networks. +Data generated using Erdos Renyi networks. -```r +``` r ## Examples -dataset <- data_generator_direct_indirect(N = 4000, - M = 4, - k = 80, - p = rep(0.2,4000), - het = TRUE, - h = 2, - method_networks = "er", - param_er = 0.1) +dataset_direct <- data_generator_direct(N = 4000, + M = 4, + k = 80, + p = rep(0.2,4000), + het = TRUE, + h = 2, + method_networks = "er", + param_er = 0.1) ``` -Singular splitting based on the main treatment effect only +Singular splitting based on the main treatment effect only -```r - - -result <- NetworkCausalTree(X = dataset[["X"]], - Y = dataset[["Y"]], - W = dataset[["W"]], - A = dataset[["A"]], - K = dataset[["K"]], - p = dataset[["p"]], +``` r +result <- NetworkCausalTree(X = dataset_direct[["X"]], + Y = dataset_direct[["Y"]], + W = dataset_direct[["W"]], + A = dataset_direct[["A"]], + K = dataset_direct[["K"]], + p = dataset_direct[["p"]], effect_weights = c(1,0,0,0), ratio_disc = 0.5, - depth = 3, + depth = 2, minsize = 5, method = "singular", output = "estimation") - title <- expression(paste("CAUSAL TREE TARGETED TO ",tau,"(1,0;0,0)"),sep="") -cov_names <- colnames(dataset[["X"]]) +cov_names <- colnames(dataset_direct[["X"]]) plot_NCT(NCT = result, cov_names = cov_names, @@ -64,55 +62,50 @@ plot_NCT(NCT = result, ### Example 2 -Data generated using Barabasi - Albert networks. - -```r - - -dataset <- data_generator_direct_indirect(N = 4000, - M = 4, - k = 80, - p = rep(0.2,4000), - het = TRUE, - h = 3, - method_networks = "sf") +Data generated using Barabasi - Albert networks. +``` r +dataset_direct_indirect <- data_generator_direct_indirect(N = 4000, + M = 4, + k = 80, + p = rep(0.2,4000), + het = TRUE, + h = 3, + method_networks = "sf") ``` Composite splitting (NCT based on all the four effects) -```r - -result <- NetworkCausalTree(X = dataset[["X"]], - Y = dataset[["Y"]], - W = dataset[["W"]], - A = dataset[["A"]], - K = dataset[["K"]], - p = dataset[["p"]], +``` r +result <- NetworkCausalTree(X = dataset_direct_indirect[["X"]], + Y = dataset_direct_indirect[["Y"]], + W = dataset_direct_indirect[["W"]], + A = dataset_direct_indirect[["A"]], + K = dataset_direct_indirect[["K"]], + p = dataset_direct_indirect[["p"]], effect_weights = c(0.25, 0.25, 0.25, 0.25), ratio_disc = 0.5, depth = 2, minsize = 5, method = "composite", - output = "detection") + output = "estimation") -title <- expression("CAUSAL TREE TARGETED TO ALL THE EFFECTS") -cov_names <- colnames(dataset[["X"]]) +title <- expression(paste("CAUSAL TREE TARGETED TO ",tau,"(0.25,0.25;0.25,0.25)"),sep="") +cov_names <- colnames(dataset_direct_indirect[["X"]]) plot_NCT(NCT = result, cov_names = cov_names, title = title, - output = "detection") + effect_color_nodes = "0100") ``` ## Code of Conduct Please note that the CRE project is released with a [Contributor Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct). By contributing to this project, you agree to abide by its terms. More information about the opening issues and contributing (i.e., git branching model) can be found [here](https://nsaph-software.github.io/CRE/articles/Contribution.html). - ## Cite -```bibtex +``` bibtex @article{bargagli2025heterogeneous, title={Heterogeneous treatment and spillover effects under clustered network interference}, author={Bargagli-Stoffi, Falco J. and Tort{\'u}, Costanza and Forastiere, Laura}, diff --git a/paper/images/NCT_algorithm.png b/paper/images/NCT_algorithm.png index d2652e1..0d2d449 100644 Binary files a/paper/images/NCT_algorithm.png and b/paper/images/NCT_algorithm.png differ diff --git a/paper/images/nct_algorithm.png b/paper/images/nct_algorithm.png deleted file mode 100644 index 0d2d449..0000000 Binary files a/paper/images/nct_algorithm.png and /dev/null differ