mlbalance
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.0%) to scientific vocabulary
Last synced: 9 months ago
·
JSON representation
·
Repository
Basic Info
- Host: GitHub
- Owner: MLCause
- License: gpl-3.0
- Language: R
- Default Branch: master
- Size: 5.58 MB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Created almost 2 years ago
· Last pushed almost 2 years ago
Metadata Files
Readme
License
Citation
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# MLbalance (alpha version)
MLbalance implements a novel machine learning balance test, the balance permutation test, for experiments with binary, multiarm, and continuous treatments. The purpose of this test is to detect failures of random assignment or imbalance across treatment arms. For more detail, see Rametta and Fuller (2024).
This package is in alpha, any recommendations or comments welcome in the issues section.
## Installation
Stable version is be available on Github here:
``` r
# install.packages("pak")
pak::pak("samjfuller/MLbalance")
```
You can install the development version of MLbalance from [GitHub](https://github.com/CetiAlphaFive/MLbalance) with:
``` r
# install.packages("pak")
pak::pak("CetiAlphaFive/MLbalance")
```
## Binary Treatment Example
Here is a basic example demonstrating the balance permutation test on a simulated binary treatment DGP with multidimensional contamation of the treatment assignment.
```{r example}
# install.packages("randomizr")
library(MLbalance)
#
set.seed(1995)
#
# Simple simulation
n <- 1000
p <- 20
X <- matrix(rnorm(n*p,0,1),n,p)
w_real <- rbinom(n, 1, ifelse(.021 + abs(.4*X[,4] - .5*X[,8]) < 1, .021 + abs(.4*X[,4] - .5*X[,8]), 1))
# install.packages("randomizr")
w_sim <- randomizr::complete_ra(N = n,m = sum(w_real))
e <- rnorm(n,0,1)
y <- 2*w_real*X[,4] + 3*X[,2] -2*X[,8] + e
df <- data.frame(y,w_real,w_sim,X)
#
r.check <- random_check(W_real = df$w_real, #real treatment assignment vector
W_sim = df$w_sim, #simulated vector, comment out this argument to use permutated real assignment vector instead
X = subset(df,select = -c(y,w_real,w_sim)) #matrix of pretreatment covariates (or any covariates that SHOULD NOT be related to the assignment process/mechanism
); r.check$plot
# to see variables important for predicting assignment, check r.check$imp.predictors
```
Owner
- Name: MLCause
- Login: MLCause
- Kind: organization
- Email: mlcausalinference@gmail.com
- Repositories: 1
- Profile: https://github.com/MLCause
Developing causal machine learning tools for social science
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Rametta" given-names: "Jack" orcid: "https://orcid.org/0000-0002-9841-146X" - family-names: "Fuller" given-names: "Sam" orcid: "https://orcid.org/0000-0002-9670-1092" title: "MLbalance" version: 0.1 date-released: 2024-08-02 url: "https://github.com/samjfuller/MLbalance"
GitHub Events
Total
Last Year
Dependencies
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- R >= 4.1.0 depends
- ggdist * imports
- ggplot2 * imports
- grf * imports