Skip to content

Commit

Permalink
version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Greifer authored and cran-robot committed Oct 16, 2017
1 parent 5d47040 commit a0814cd
Show file tree
Hide file tree
Showing 41 changed files with 2,364 additions and 1,148 deletions.
15 changes: 5 additions & 10 deletions DESCRIPTION
@@ -1,24 +1,19 @@
Package: cobalt
Title: Covariate Balance Tables and Plots
Version: 2.2.0
Version: 3.0.0
Author: Noah Greifer [aut, cre]
Maintainer: Noah Greifer <noah@unc.edu>
Description: Generate balance tables and plots for covariates of groups
preprocessed through matching, weighting or subclassification, for example,
using propensity scores. Includes integration with 'MatchIt', 'twang', 'Matching', 'optmatch',
'CBPS', and 'ebal' for assessing balance on the output of their preprocessing functions. Users
can also specify data for balance assessment not generated through the above packages. Also
included are methods for assessing balance in clustered or multiply imputed data sets.
Description: Generate balance tables and plots for covariates of groups preprocessed through matching, weighting or subclassification, for example, using propensity scores. Includes integration with 'MatchIt', 'twang', 'Matching', 'optmatch', 'CBPS', 'ebal', and 'WeightIt' for assessing balance on the output of their preprocessing functions. Users can also specify data for balance assessment not generated through the above packages. Also included are methods for assessing balance in clustered or multiply imputed data sets.
Depends: R (>= 3.1)
Imports: ggplot2 (>= 2.2.0), ggstance
Suggests: MatchIt, twang, Matching, optmatch, CBPS, ebal, mice, knitr,
rmarkdown
License: GPL (>= 2)
Encoding: UTF-8
LazyData: true
Date: 2017-09-05
Date: 2017-10-15
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2017-09-05 04:53:50 UTC; NoahGreifer
Packaged: 2017-10-16 03:31:38 UTC; NoahGreifer
Repository: CRAN
Date/Publication: 2017-09-05 14:28:31 UTC
Date/Publication: 2017-10-16 03:45:40 UTC
70 changes: 35 additions & 35 deletions MD5
@@ -1,45 +1,45 @@
0f71c1c0c47cf9072c41b2b4fa890094 *DESCRIPTION
64a792efd9244738e27f126e30a31aa4 *NAMESPACE
946e6a1c07fab01a23c98d2ea5ce7342 *NEWS.md
24890b1551219a8361b64627ea5f81df *R/bal.plot.R
a7a0267fdb1dc84a02341ad7d328d29f *R/bal.tab.R
1c9d5f5d972887b7776b85477ee7f4d4 *R/do_not_include/Under_construction/d.out.R
f3c30985fb7d42211d9649bd92c5d710 *R/do_not_include/Under_construction/int.poly.R
7a88a49e108b455e3346d09208d2ef2f *R/do_not_include/Under_construction/under_construction.R
02f82204b617b13829f5cc81b6e85d70 *R/do_not_include/tests.R
272ef91ca2545c26cef7439b5f9c7ab5 *R/functions_for_processing.R
98f88d77c54c0adee74bd16e851efc6c *R/love.plot.R
a3ccb15b15525ac3d1f9a76e36a6600c *R/print.bal.tab.R
ebd0402b50a048f528e337cd9e06ab8c *R/utilities.R
482cf5c3b684ed8db17970f2091a2893 *R/x2base.R
ca2d343b11b537cfaab2b1f89501b711 *DESCRIPTION
ea42585b65311b9a8931c0052277f937 *NAMESPACE
26d5c54cd52fb32900b42c3455c823c3 *NEWS.md
58db4c6619cfbe2967c496f19d24dc6a *R/bal.plot.R
8aa83a8e229c06d38dcc4cae5c0a0633 *R/bal.tab.R
5bf42da2cad76685f4ed2f447ca7c952 *R/functions_for_processing.R
10a1b042992e2b6446fa3f05e1ae5b9e *R/love.plot.R
3e183692e8f52950b2174210d4511324 *R/print.bal.tab.R
7a28a548ebc2127d39d8e2d73bccddbb *R/utilities.R
18b07d6b4e9ac89d20bd59f97fc28276 *R/x2base.R
b7832b812849537f814324193462610b *README.md
6e1d3a8b89d55d5d3c7823133a1dc3f2 *build/vignette.rds
cf62b3177b577aaff9a8dcff09beeb0b *build/vignette.rds
949b492287de79b9a90d520db98768c1 *data/lalonde.RData
d22e5afa667cdc190e348ae984c830a2 *data/lalonde_mis.RData
8a95d708d4b879551be1a7b4c6cfbfd7 *inst/doc/cobalt_basic_use.R
9798f99ade90d1011cb6b624ba26f65f *inst/doc/cobalt_basic_use.Rmd
e660abfdb0f23281e253048b2bc8f207 *inst/doc/cobalt_basic_use.html
15be95d892231d34903252ba29dbca6a *inst/doc/cobalt_basic_use.R
d2e161fb211577f54198cc19ae535270 *inst/doc/cobalt_basic_use.Rmd
949e2c207b188c41c3d60c919b014aa7 *inst/doc/cobalt_basic_use.html
0afa9b5d4c5fc247bc3aea495e62f3dd *inst/doc/cobalt_cluster_imp.R
aae0b33ee8cf294a55dfab63815cc279 *inst/doc/cobalt_cluster_imp.Rmd
879215eee3d70050bd30008d1674fe62 *inst/doc/cobalt_cluster_imp.html
8a6479e87453790a1e9616a03c64e3fa *inst/doc/cobalt_cluster_imp.Rmd
3d27c00958636ff7ac94290b194ef38f *inst/doc/cobalt_cluster_imp.html
18e63995f37fcb1b800639423a057aee *inst/figures/README-unnamed-chunk-3-1.png
ee5f3f538bc5e9fc8e3851274334d79b *inst/figures/README-unnamed-chunk-3-2.png
1ceccc3c579652a5c6c694f909d75b85 *inst/figures/README-unnamed-chunk-4-1.png
72555ab97cf404d532f9f03b436fdc73 *man/bal.plot.Rd
c87ff7ab5ee3bf16337e4c31e2830975 *man/bal.tab.CBPS.Rd
3855125ac9d872496a2ddcd7361f24f8 *man/bal.tab.Match.Rd
123152ab4d8dd4bd9c0d2a62bed06a88 *man/bal.tab.Rd
6784b882655fcea7304b1df8d6d135f9 *man/bal.tab.df.formula.Rd
769a47ac5c474d23d941a739dd7b9320 *man/bal.tab.ebalance.Rd
97f9a661548cf714f02e9ec10337887e *man/bal.tab.matchit.Rd
3aa5761deee4eb1608d80f6f8e1dee5c *man/bal.tab.mnps.Rd
f7ba05956821866f4490d8985a600457 *man/bal.tab.optmatch.Rd
63e1d8f08d911960f1fa20fb3a7037c4 *man/bal.tab.ps.Rd
4dccdfa8d002a4f1f55dce51e535bf57 *man/bal.plot.Rd
0aa32d5b1cfb2ac6bab34ceb21ae78ef *man/bal.tab.CBPS.Rd
388f96d09b43041c44907162679a9eec *man/bal.tab.Match.Rd
82b929d3ecd6857d6eb3d00758de0afc *man/bal.tab.Rd
fa8e4803bdb103f94cafaf3b4ede2b06 *man/bal.tab.df.formula.Rd
148619a53638fc73201874d1b1db6f88 *man/bal.tab.ebalance.Rd
e71d489d606394d1babf734973b7e5dd *man/bal.tab.matchit.Rd
ccca9464d0f320811c93117f50786a29 *man/bal.tab.optmatch.Rd
981dd2648eefca6a0f37cb6de1cd5b6c *man/bal.tab.ps.Rd
cb5a1c401b63744706aa2f1ff0deafac *man/bal.tab.weightit.Rd
5393b869fd5241a0b67a953d0bfd50eb *man/class-bal.tab.cluster.Rd
69424d5e9261defe66fbb22f2bd9a988 *man/class-bal.tab.imp.Rd
0a3f822364669424af887fd16615ca6d *man/class-bal.tab.multi.Rd
872387cdbd9055ab1f1fb6ee98eb2018 *man/class-bal.tab.subclass.Rd
a08ee89605f037da64ad5c71d24badec *man/f.build.Rd
ca310aec24f9c4d676405064e9f4cbfa *man/get.w.Rd
dbb727841b8761742ca6be1d6863db83 *man/get.w.Rd
e43b36b1df7ae5954e88f78eeb9d7f87 *man/lalonde.Rd
e6ec522d43cb08fb133cfacaa4b9bfb0 *man/love.plot.Rd
66ba4630da735356b5a25f11f8f36ff0 *man/print.bal.tab.Rd
2582bb816ba54acbc3f38a2cd29a4fc7 *man/love.plot.Rd
4d56dae63a52319d5686c0286163ee39 *man/print.bal.tab.Rd
969532fe9e9ee03bfb532d4255a2f49b *man/splitfactor.Rd
9798f99ade90d1011cb6b624ba26f65f *vignettes/cobalt_basic_use.Rmd
aae0b33ee8cf294a55dfab63815cc279 *vignettes/cobalt_cluster_imp.Rmd
d2e161fb211577f54198cc19ae535270 *vignettes/cobalt_basic_use.Rmd
8a6479e87453790a1e9616a03c64e3fa *vignettes/cobalt_cluster_imp.Rmd
8 changes: 7 additions & 1 deletion NAMESPACE
Expand Up @@ -12,6 +12,7 @@ S3method(print, bal.tab.subclass)
S3method(print, bal.tab.cluster)
S3method(print, bal.tab.imp)
S3method(print, bal.tab.imp.cluster)
S3method(print, bal.tab.multi)
S3method(plot, bal.tab)
S3method(bal.tab, matchit)
S3method(bal.tab, ps)
Expand All @@ -21,11 +22,16 @@ S3method(bal.tab, CBPS)
S3method(bal.tab, formula)
S3method(bal.tab, data.frame)
S3method(bal.tab, ebalance)
S3method(bal.tab, ebalance.trim)
S3method(bal.tab, optmatch)
S3method(bal.tab, weightit)
S3method(get.w, matchit)
S3method(get.w, ps)
S3method(get.w, mnps)
S3method(get.w, Match)
S3method(get.w, CBPS)
S3method(get.w, npCBPS)
S3method(get.w, ebalance)
S3method(get.w, optmatch)
S3method(get.w, ebalance.trim)
S3method(get.w, optmatch)
S3method(get.w, weightit)
15 changes: 15 additions & 0 deletions NEWS.md
@@ -1,5 +1,20 @@
cobalt News and Updates
======

Version 3.0.0

* Added support for multinomial treatments in `bal.tab()`, including output from `CBPS` and `twang`

* Added support for `weightit` objects from `WeightIt`, including for multinomial treatments.

* Added support for `ebalance.trim` objects from `ebal`.

* Fixes to the vignette.

* Fixes to `splitfactor()` to handle tibbles better.

* Fixed bug when using `bal.tab()` with multiply imputed data without adjustment. Fixed bug when using `s.weights` with the `formula` method of `bal.tab()`.

Version 2.2.0

* Added `disp.ks` and `ks.threshold` options to `bal.tab()` to display Kolmogorov-Smirnov statistics before and after preprocessing.
Expand Down
34 changes: 29 additions & 5 deletions R/bal.plot.R
@@ -1,4 +1,4 @@
bal.plot <- function(obj, var.name, ..., which, which.sub = NULL, cluster = NULL, which.cluster = NULL, imp = NULL, which.imp = NULL, size.weight = FALSE) {
bal.plot <- function(obj, var.name, ..., which, which.sub = NULL, cluster = NULL, which.cluster = NULL, imp = NULL, which.imp = NULL, which.treat = NULL, size.weight = FALSE) {

args <- list(...)

Expand Down Expand Up @@ -191,8 +191,7 @@ bal.plot <- function(obj, var.name, ..., which, which.sub = NULL, cluster = NULL
}
}

if (length(unique(D$treat)) > 2 && is.numeric(D$treat)) { #Continuous treatments

if (nunique(D$treat) > 2 && is.numeric(D$treat)) { #Continuous treatments
if ("subclass" %in% facet) {
if (is.categorical.var) {
weights <- with(D, mapply(function(w, s, v) w / sum(weights[subclass==s & var==v]), w = weights, s = subclass, v = var))
Expand Down Expand Up @@ -232,6 +231,33 @@ bal.plot <- function(obj, var.name, ..., which, which.sub = NULL, cluster = NULL
else { #Categorical treatments (multinomial supported)
D$treat <- factor(D$treat)

if (length(which.treat) == 0)
which.treat <- character(0)
else if (is.numeric(which.treat)) {
which.treat <- levels(D$treat)[seq_along(levels(D$treat)) %in% which.treat]
if (length(which.treat) == 0) {
warning("No numbers in which.treat correspond to treatment values. All treatment groups will be displayed.", call. = FALSE)
which.treat <- character(0)
}
}
else if (is.character(which.treat)) {
which.treat <- levels(D$treat)[levels(D$treat) %in% which.treat]
if (length(which.treat) == 0) {
warning("No names in which.treat correspond to treatment values. All treatment groups will be displayed.", call. = FALSE)
which.treat <- character(0)
}
}
else if (is.na(which.treat)) {
which.treat <- character(0)
}
else {
warning("The argument to which.treat must be NA, NULL, or a vector of treatment names or indices. All treatment groups will be displayed.", call. = FALSE)
which.treat <- character(0)
}
if (length(which.treat) > 0 && all(!is.na(which.treat))) D <- D[D$treat %in% which.treat,]

for (i in names(D)[sapply(D, is.factor)]) D[, i] <- factor(D[, i])

if (length(facet) > 0) {
if ("subclass" %in% facet) {
weights <- with(D, mapply(function(w, t, s) w / sum(weights[treat==t & subclass==s]), w = weights, t = treat, s = subclass))
Expand All @@ -240,9 +266,7 @@ bal.plot <- function(obj, var.name, ..., which, which.sub = NULL, cluster = NULL
else {
weights <- with(D, mapply(function(w, t, c, i, f.which) w / sum(weights[treat==t & cluster==c & imp==i & facet.which==f.which]), w = weights, t = treat, c= cluster, i = imp, f.which = facet.which))
d <- data.frame(weights = weights, treat = D$treat, var = D$var, cluster = D$cluster, imp = D$imp, facet.which = D$facet.which)

}

}
else {
weights <- with(D, mapply(function(w, t) w / sum(weights[treat==t]), w = weights, t = treat))
Expand Down

0 comments on commit a0814cd

Please sign in to comment.