Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.0%) to scientific vocabulary
Keywords
causal-inference
inverse-probability-weights
observational-study
propensity-scores
r
Last synced: 6 months ago
·
JSON representation
Repository
WeightIt: an R package for propensity score weighting
Basic Info
- Host: GitHub
- Owner: ngreifer
- Language: R
- Default Branch: master
- Homepage: https://ngreifer.github.io/WeightIt/
- Size: 14.8 MB
Statistics
- Stars: 115
- Watchers: 3
- Forks: 20
- Open Issues: 6
- Releases: 0
Topics
causal-inference
inverse-probability-weights
observational-study
propensity-scores
r
Created over 8 years ago
· Last pushed 7 months ago
Metadata Files
Readme
Changelog
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = FALSE,
warning = FALSE,
message = FALSE,
tidy = FALSE,
fig.align='center',
comment = "#>",
fig.path = "man/figures/README-"
)
```
# WeightIt: Weighting for Covariate Balance in Observational Studies
[](https://CRAN.R-project.org/package=WeightIt)
[](https://cran.r-project.org/package=WeightIt)
### Overview
*WeightIt* is a one-stop package to generate balancing weights for point and longitudinal treatments in observational studies. Support is included for binary, multi-category, and continuous treatments, a variety of estimands including the ATE, ATT, ATC, ATO, and others, and support for a wide variety of weighting methods, including those that rely on parametric modeling, machine learning, or optimization. *WeightIt* also provides functionality for fitting regression models in weighted samples that account for estimation of the weights in quantifying uncertainty. *WeightIt* uses a familiar formula interface and is meant to complement `MatchIt` as a package that provides a unified interface to basic and advanced weighting methods.
For a complete vignette, see the [website](https://ngreifer.github.io/WeightIt/articles/WeightIt.html) for *WeightIt* or `vignette("WeightIt")`.
To install and load *WeightIt*, use the code below:
```{r, eval = FALSE}
#CRAN version
pak::pkg_install("WeightIt")
#Development version
pak::pkg_install("ngreifer/WeightIt")
library("WeightIt")
```
```{r, include = FALSE}
library("WeightIt")
```
The workhorse function of *WeightIt* is `weightit()`, which generates weights from a given formula and data input according to methods and other parameters specified by the user. Below is an example of the use of `weightit()` to generate propensity score weights for estimating the ATT:
```{r}
data("lalonde", package = "cobalt")
W <- weightit(treat ~ age + educ + nodegree +
married + race + re74 + re75,
data = lalonde, method = "glm",
estimand = "ATT")
W
```
Evaluating weights has two components: evaluating the covariate balance produced by the weights, and evaluating whether the weights will allow for sufficient precision in the eventual effect estimate. For the first goal, functions in the *cobalt* package, which are fully compatible with *WeightIt*, can be used, as demonstrated below:
```{r}
library("cobalt")
bal.tab(W, un = TRUE)
```
For the second goal, qualities of the distributions of weights can be assessed using `summary()`, as demonstrated below.
```{r}
summary(W)
```
Large effective sample sizes imply low variability in the weights, and therefore increased precision in estimating the treatment effect.
Finally, we can estimate the effect of the treatment using a weighted outcome model, accounting for estimation of the weights in the standard error of the effect estimate:
```{r}
fit <- lm_weightit(re78 ~ treat, data = lalonde,
weightit = W)
summary(fit, ci = TRUE)
```
The tables below contain the available methods in *WeightIt* for estimating weights for binary, multi-category, and continuous treatments. Some of these methods require installing other packages to use; see `vignette("installing-packages")` for information on how to install them.
#### Binary Treatments
Method | `method`
-------------------- | --------
Binary regression PS | [`"glm"`](https://ngreifer.github.io/WeightIt/reference/method_glm.html)
Generalized boosted modeling PS | [`"gbm"`](https://ngreifer.github.io/WeightIt/reference/method_gbm.html)
Covariate balancing PS | [`"cbps"`](https://ngreifer.github.io/WeightIt/reference/method_cbps.html)
Non-Parametric covariate balancing PS | [`"npcbps"`](https://ngreifer.github.io/WeightIt/reference/method_npcbps.html)
Entropy balancing | [`"ebal"`](https://ngreifer.github.io/WeightIt/reference/method_ebal.html)
Inverse probability tilting | [`"ipt"`](https://ngreifer.github.io/WeightIt/reference/method_ipt.html)
Stable balancing weights | [`"optweight"`](https://ngreifer.github.io/WeightIt/reference/method_optweight.html)
SuperLearner PS | [`"super"`](https://ngreifer.github.io/WeightIt/reference/method_super.html)
Bayesian additive regression trees PS | [`"bart"`](https://ngreifer.github.io/WeightIt/reference/method_bart.html)
Energy balancing | [`"energy"`](https://ngreifer.github.io/WeightIt/reference/method_energy.html)
#### Multi-Category Treatments
Method | `method`
-------------------- | --------
Multinomial regression PS | [`"glm"`](https://ngreifer.github.io/WeightIt/reference/method_glm.html)
Generalized boosted modeling PS | [`"gbm"`](https://ngreifer.github.io/WeightIt/reference/method_gbm.html)
Covariate balancing PS | [`"cbps"`](https://ngreifer.github.io/WeightIt/reference/method_cbps.html)
Non-parametric covariate balancing PS | [`"npcbps"`](https://ngreifer.github.io/WeightIt/reference/method_npcbps.html)
Entropy balancing | [`"ebal"`](https://ngreifer.github.io/WeightIt/reference/method_ebal.html)
Inverse probability tilting | [`"ipt"`](https://ngreifer.github.io/WeightIt/reference/method_ipt.html)
Stable balancing weights | [`"optweight"`](https://ngreifer.github.io/WeightIt/reference/method_optweight.html)
SuperLearner PS | [`"super"`](https://ngreifer.github.io/WeightIt/reference/method_super.html)
Bayesian additive regression trees PS | [`"bart"`](https://ngreifer.github.io/WeightIt/reference/method_bart.html)
Energy balancing | [`"energy"`](https://ngreifer.github.io/WeightIt/reference/method_energy.html)
#### Continuous Treatments
Method | `method`
-------------------- | --------
Generalized linear model GPS | [`"glm"`](https://ngreifer.github.io/WeightIt/reference/method_glm.html)
Generalized boosted modeling GPS | [`"gbm"`](https://ngreifer.github.io/WeightIt/reference/method_gbm.html)
Covariate balancing GPS | [`"cbps"`](https://ngreifer.github.io/WeightIt/reference/method_cbps.html)
Non-parametric covariate balancing GPS | [`"npcbps"`](https://ngreifer.github.io/WeightIt/reference/method_npcbps.html)
Entropy balancing | [`"ebal"`](https://ngreifer.github.io/WeightIt/reference/method_ebal.html)
Stable balancing weights | [`"optweight"`](https://ngreifer.github.io/WeightIt/reference/method_optweight.html)
SuperLearner GPS | [`"super"`](https://ngreifer.github.io/WeightIt/reference/method_super.html)
Bayesian additive regression trees GPS | [`"bart"`](https://ngreifer.github.io/WeightIt/reference/method_bart.html)
Distance covariance optimal weighting | [`"energy"`](https://ngreifer.github.io/WeightIt/reference/method_energy.html)
In addition, *WeightIt* implements the subgroup balancing propensity score using the function `sbps()`. Several other tools and utilities are available, including `trim()` to trim or truncate weights, `calibrate()` to calibrate propensity scores, and `get_w_from_ps()` to compute weights from propensity scores.
*WeightIt* provides functions to fit weighted models that account for the uncertainty in estimating the weights. These include `glm_weightit()` for fitting generalized linear models, `ordinal_weightit()` for ordinal regression models, `multinom_weightit()` for multinomial regression models, and `coxph_weightit()` for Cox proportional hazards models. Several methods are available for computing the parameter variances, including asymptotically correct M-estimation-based variances, robust variances that treat the weights as fixed, and traditional and fractional weighted bootstrap variances. Clustered variances are supported. See `vignette("estimating-effects")` for information on how to use these after weighting to estimate treatment effects.
Please submit bug reports, questions, comments, or other issues to https://github.com/ngreifer/WeightIt/issues. If you would like to see your package or method integrated into *WeightIt*, please contact the author. Fan mail is greatly appreciated.
Owner
- Name: Noah Greifer
- Login: ngreifer
- Kind: user
- Company: Harvard University
- Website: ngreifer.github.io
- Twitter: noah_greifer
- Repositories: 7
- Profile: https://github.com/ngreifer
Data Science Specialist at Harvard University Institute for Quantitative Social Science (IQSS)
GitHub Events
Total
- Commit comment event: 1
- Issues event: 16
- Watch event: 11
- Issue comment event: 24
- Push event: 38
- Pull request review event: 1
- Pull request event: 4
- Fork event: 7
Last Year
- Commit comment event: 1
- Issues event: 16
- Watch event: 11
- Issue comment event: 24
- Push event: 38
- Pull request review event: 1
- Pull request event: 4
- Fork event: 7
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Noah Greifer | n****r@g****m | 928 |
| Noah Greifer | n****r@N****l | 2 |
| Greifer | n****r@a****u | 2 |
| Tom Larsen | 3****m | 1 |
Committer Domains (Top 20 + Academic)
ad.unc.edu: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 77
- Total pull requests: 6
- Average time to close issues: 3 months
- Average time to close pull requests: about 1 month
- Total issue authors: 57
- Total pull request authors: 4
- Average comments per issue: 2.3
- Average comments per pull request: 0.67
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 12
- Pull requests: 4
- Average time to close issues: about 2 months
- Average time to close pull requests: 3 days
- Issue authors: 11
- Pull request authors: 2
- Average comments per issue: 2.42
- Average comments per pull request: 0.5
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- lorenzoFabbri (5)
- andrewjmc (4)
- statzhero (4)
- Blanch-Font (3)
- zeynepbaskurt (3)
- joshuafayallen (2)
- ahinton-mmc (2)
- kgkirgkiris (2)
- BERENZ (2)
- vincentarelbundock (2)
- mkrasmus (2)
- jeffbone (1)
- frankpopham (1)
- dannysack (1)
- JonNDCN (1)
Pull Request Authors
- larsentom (2)
- vincentarelbundock (2)
- felixthoemmes (1)
- etiennebacher (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 4,832 last-month
- Total docker downloads: 42,005
-
Total dependent packages: 8
(may contain duplicates) -
Total dependent repositories: 8
(may contain duplicates) - Total versions: 37
- Total maintainers: 1
cran.r-project.org: WeightIt
Weighting for Covariate Balance in Observational Studies
- Homepage: https://ngreifer.github.io/WeightIt/
- Documentation: http://cran.r-project.org/web/packages/WeightIt/WeightIt.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 1.4.0
published about 1 year ago
Rankings
Docker downloads count: 0.6%
Stargazers count: 4.3%
Average: 6.2%
Dependent packages count: 7.3%
Forks count: 7.3%
Downloads: 7.6%
Dependent repos count: 10.5%
Maintainers (1)
Last synced:
7 months ago
conda-forge.org: r-weightit
- Homepage: https://github.com/ngreifer/WeightIt
- License: GPL-2.0-or-later
-
Latest release: 0.13.1
published over 3 years ago
Rankings
Dependent repos count: 34.0%
Stargazers count: 34.1%
Average: 41.0%
Forks count: 44.7%
Dependent packages count: 51.2%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.3.0 depends
- backports >= 1.4.1 imports
- cobalt >= 4.3.0 imports
- crayon * imports
- ggplot2 >= 3.3.0 imports
- ATE >= 0.2.0 suggests
- CBPS >= 0.18 suggests
- MASS * suggests
- MNP >= 3.1 suggests
- SuperLearner >= 2.0 suggests
- boot * suggests
- brglm2 >= 0.5.2 suggests
- dbarts >= 0.9 suggests
- gbm >= 2.1.3 suggests
- knitr * suggests
- mclogit * suggests
- misaem >= 1.0.1 suggests
- mlogit >= 1.1.0 suggests
- optweight >= 0.2.4 suggests
- osqp >= 0.6.0.5 suggests
- rmarkdown * suggests
- survey * suggests
- twang >= 1.5 suggests
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite