Skip to content

Commit

Permalink
Fixed issue with tibble dataset, discard, and optimal/full matching (k…
Browse files Browse the repository at this point in the history
  • Loading branch information
ngreifer committed Jan 19, 2024
1 parent f526eca commit 947a0b8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: MatchIt
Version: 4.5.5
Version: 4.5.5.9000
Title: Nonparametric Preprocessing for Parametric Causal Inference
Description: Selects matched samples of the original treated and
control groups with similar covariate distributions -- can be
Expand Down
1 change: 1 addition & 0 deletions MatchIt.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ output:
`MatchIt` News and Updates
======

# MatchIt (development version)

* Fixed a bug when using `method = "optimal"` or `method = "full"` with `discard` specified and `data` given as a tibble (`tbl_df` object). (#185)

# MatchIt 4.5.5

* When using `method = "cardinality"`, a new solver, HiGHS, can be requested by setting `solver = "highs"`, which relies on the `highs` package. This is much faster and more reliable than GLPK and is free and easy to install as a regular R package with no additional requirements.
Expand Down
2 changes: 1 addition & 1 deletion R/matchit2full.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ matchit2full <- function(treat, formula, data, distance, discarded,
mo <- mo[!discarded[treat == focal], !discarded[treat != focal], drop = FALSE]
dimnames(mo) <- list(names(treat_)[treat_ == 1], names(treat_)[treat_ == 0])

mo <- optmatch::match_on(mo, data = data[!discarded,, drop = FALSE])
mo <- optmatch::match_on(mo, data = as.data.frame(data)[!discarded,, drop = FALSE])
mo <- optmatch::as.InfinitySparseMatrix(mo)

#Process antiexact
Expand Down
4 changes: 2 additions & 2 deletions R/matchit2optimal.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ matchit2optimal <- function(treat, formula, data, distance, discarded,
ratio = 1, s.weights = NULL, caliper = NULL,
mahvars = NULL, exact = NULL,
estimand = "ATT", verbose = FALSE,
is.full.mahalanobis, antiexact = NULL, ...) {
is.full.mahalanobis, antiexact = NULL, ...) {

rlang::check_installed("optmatch")

Expand Down Expand Up @@ -360,7 +360,7 @@ matchit2optimal <- function(treat, formula, data, distance, discarded,
mo <- mo[!discarded[treat == focal], !discarded[treat != focal], drop = FALSE]
dimnames(mo) <- list(names(treat_)[treat_ == 1], names(treat_)[treat_ == 0])

mo <- optmatch::match_on(mo, data = data[!discarded,, drop = FALSE])
mo <- optmatch::match_on(mo, data = as.data.frame(data)[!discarded,, drop = FALSE])
mo <- optmatch::as.InfinitySparseMatrix(mo)

#Process antiexact
Expand Down

0 comments on commit 947a0b8

Please sign in to comment.