We encourage all developers to test the package in different conditions. Testing the package is the easiest way to get familiar with the package and its functionalities.
To test the package, please install the package on your system (R (>= 3.5.0)). You can install the package by following one of these approaches:
In this project, we follow A
successful Git Branching Model. As a result, the
develop branch is the most updated branch for developers.
devtools::install_github to install the package. If you
do not specify the
ref, it will install the master (or
?CRE. It should open the package description page
under the help tab (assuming you are using RStudio).
Installing the package from CRAN for developing purposes is not recommended. Because most probably, the version on CRAN is not the latest version.
[Complete this section after submitting the package to CRAN]
In order to install the package from the source, you need to download the source code into your computer and install it from the source. Here are the steps:
Go to package Github repository and
from the drop-down menu change the branch to
click on the
Code tab and then click on the
Download Zip tab.
Open one of the files using RStudio, then change the project
directory to the project directory
Session > Set Working Directory > To Project Directory).
devtools library and then load CRE.
Forking the package under your Github account is the best option if
you are planning on installing, testing, modifying, and contributing to
the project. Go to package Github repository and
click on the
Fork button at the top right corner. After
forking the package, Open your terminal (or Gitbash for Windows,
Anaconda prompt, …) and run the following command (brackets are not
Now, you can modify the codebase and track your modification. Navigate to the package folder and Install the package following the Installing the package from source steps. It is a good idea to create a new branch to work on the codebase. Read A successful Git Branching Model for branching convention.
Run the following command to test the package.
library(CRE) # Generate sample data set.seed(1358) dataset <- generate_cre_dataset(n = 1000, rho = 0, n_rules = 2, p = 10, effect_size = 2, binary_covariates = TRUE, binary_outcome = FALSE, confounding = "no") y <- dataset[["y"]] z <- dataset[["z"]] X <- dataset[["X"]] method_params <- list(ratio_dis = 0.25, ite_method_dis = "aipw", include_ps_dis = TRUE, ps_method_dis = "SL.xgboost", ps_method_inf = "SL.xgboost", oreg_method_dis = "SL.xgboost", oreg_method_inf = "SL.xgboost", ite_method_inf = "aipw", include_ps_inf = TRUE, offset = NULL) hyper_params <- list(intervention_vars = NULL, ntrees_rf = 200, ntrees_gbm = 200, node_size = 20, max_nodes = 5, max_depth = 15, replace = TRUE, max_decay = 0.025, type_decay = 2, t_ext = 0.01, t_corr = 1, t_pvalue = 0.05, stability_selection = TRUE, cutoff = 0.6, pfer = 1, penalty_rl = 1) # linreg CATE estimation with aipw ITE estimation cre_results <- cre(y, z, X, method_params, hyper_params) summary(cre_results) plot(cre_results)