mlbalance
Balance Permutation Test (Rametta, Fuller 2024)
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.2%) to scientific vocabulary
Keywords
causal-inference
experimental-design
machine-learning
Last synced: 10 months ago
·
JSON representation
·
Repository
Balance Permutation Test (Rametta, Fuller 2024)
Basic Info
- Host: GitHub
- Owner: CetiAlphaFive
- License: gpl-3.0
- Language: R
- Default Branch: master
- Homepage: https://cetialphafive.github.io/MLbalance/
- Size: 5.7 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
causal-inference
experimental-design
machine-learning
Created almost 3 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: Jack T. Rametta
- Login: CetiAlphaFive
- Kind: user
- Location: Sacramento
- Company: UC Davis
- Website: jackrametta.com
- Twitter: JtRametta
- Repositories: 1
- Profile: https://github.com/CetiAlphaFive
PoliSci Grad Student, UC Davis
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"