Thank you for your interest in contributing to NetworkCausalTree! We welcome contributions from the community and appreciate your efforts to improve this package.
NetworkCausalTree is implemented in R and follows standard R development conventions. Before contributing, please:
- Read our Code of Conduct
- Check the GitHub Issues page for existing issues or feature requests
- Review the package documentation and vignettes to understand the current functionality
We welcome various types of contributions:
If you find a bug, please report it by:
- Opening a new issue on our GitHub Issues page
- Including a clear title and description
- Providing a minimal reproducible example (reprex)
- Specifying your R version, operating system, and package version
- Describing the expected vs. actual behavior
Have an idea for a new feature? We'd love to hear it! Please:
- Check if a similar request already exists in the Issues
- Open a new issue with the "enhancement" label
- Clearly describe the feature and its potential use cases
- Explain how it would benefit users of the package
# Install development dependencies
install.packages(c("devtools", "roxygen2", "testthat", "knitr"))
# Clone the repository
git clone https://github.com/fbargaglistoffi/NetworkCausalTree.git
cd NetworkCausalTree
# Load the package for development
devtools::load_all()
# Run tests
devtools::test()
# Check package
devtools::check()- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/NetworkCausalTree.git
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
- Make your changes following our coding standards (see below)
- Write or update tests to cover your changes
- Update documentation as needed (including roxygen2 comments)
- Run checks to ensure everything passes:
devtools::check() devtools::test()
- Commit your changes with clear, descriptive commit messages:
git commit -m "Add feature: brief description of what you did" - Push to your fork:
git push origin feature/your-feature-name
- Submit a Pull Request on GitHub with a clear description of your changes
Documentation improvements are always welcome! This includes:
- Fixing typos or clarifying existing documentation
- Adding examples to function documentation
- Improving or creating vignettes
- Updating the README
To update function documentation:
- Edit the roxygen2 comments in the R source files
- Run
devtools::document()to regenerate the documentation - Preview changes with
?function_name
We encourage contributions that improve reproducibility:
- Add example scripts demonstrating specific use cases
- Create or improve vignettes showing real-world applications
- Provide datasets that illustrate network causal inference scenarios
To maintain consistency across the codebase, please follow these guidelines:
- Follow the tidyverse style guide
- Use meaningful variable and function names
- Keep functions focused on a single task
- Use
<-for assignment, not= - Indent with 2 spaces (no tabs)
All exported functions must include roxygen2 documentation with:
@titleand@description@paramfor each parameter@returndescribing the return value@examplesshowing usage@exportif the function should be user-facing
Example:
#' @title Estimate Network Causal Effects
#' @description Estimates treatment effects under network interference
#' @param X Matrix of covariates
#' @param Y Outcome vector
#' @param W Treatment assignment vector
#' @return A list containing estimated effects and standard errors
#' @examples
#' result <- estimate_effects(X, Y, W)
#' @export
estimate_effects <- function(X, Y, W) {
# Function implementation
}- All new features should include tests using
testthat - Tests should be placed in the
tests/testthat/directory - Aim for good coverage of edge cases and error conditions
- Use
expect_equal(),expect_error(), etc. for assertions
Example test structure:
test_that("estimate_effects works correctly", {
# Setup test data
X <- matrix(rnorm(100), ncol = 2)
Y <- rnorm(50)
W <- rbinom(50, 1, 0.5)
# Run function
result <- estimate_effects(X, Y, W)
# Check results
expect_type(result, "list")
expect_true("effects" %in% names(result))
})We are particularly interested in contributions related to:
- Continuous Exposures: Extending the package to handle multiple dosage levels (e.g., vaccine dosage)
- Ensemble Methods: Integration with random forest estimators for ensemble-based causal discovery (similar to grf building on causalTree)
- Diagnostic Tools: Developing sensitivity analysis tools under partial interference
- CNI Assumption Testing: Tools to assess whether the Conditional Network Independence assumption is reasonable for a given dataset
- Performance Optimization: Improving computational efficiency for large networks
- Visualization Tools: Enhanced plotting and visualization capabilities
If you have questions or need support:
- Check the package vignettes and documentation first
- Search existing GitHub Issues
- If your question hasn't been addressed, open a new issue with the "question" label
Contributors will be acknowledged in:
- The package DESCRIPTION file (for significant contributions)
- Release notes
- The project README
By contributing to NetworkCausalTree, you agree that your contributions will be licensed under the same license as the project (see LICENSE file).
Your contributions help make NetworkCausalTree better for everyone. We appreciate your time and effort in improving this package!