Skip to content

Commit

Permalink
Patch to bypass misaem error (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngreifer committed Sep 3, 2024
1 parent bcc5fa0 commit abf1fe2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: WeightIt
Type: Package
Title: Weighting for Covariate Balance in Observational Studies
Version: 1.3.0
Version: 1.3.0.9000
Authors@R: c(
person("Noah", "Greifer", role=c("aut", "cre"),
email = "noah.greifer@gmail.com",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
WeightIt News and Updates
======

# `WeightIt` (development version)

* Changed defaults with `missing = "saem"` for binary and multi-category treatments to bypass bug in `misaem` code. (#71)

# `WeightIt` 1.3.0

* Added `anova()` methods for `glm_weightit`, `multinom_weightit`, `ordinal_weightit`, and `coxph_weightit` objects to perform Wald tests for comparing nested models. The models do not have to be symbolically nested.
Expand Down
6 changes: 3 additions & 3 deletions R/weightit2glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ weightit2glm <- function(covs, treat, s.weights, subset, estimand, focal,
rlang::check_installed("misaem")
if (is_null(A[["saem.method"]])) A[["saem.method"]] <- "map"
if (is_null(A[["control"]])) A[["control"]] <- list()
if (is_null(A[["control"]][["var_cal"]])) A[["control"]][["var_cal"]] <- FALSE
if (is_null(A[["control"]][["var_cal"]])) A[["control"]][["var_cal"]] <- TRUE #need TRUE to bypass error in miss.glm.fit()
if (is_null(A[["control"]][["ll_obs_cal"]])) A[["control"]][["ll_obs_cal"]] <- FALSE

data <- data.frame(treat, covs)

# browser()
withCallingHandlers({
verbosely({
fit <- misaem::miss.glm(formula(data), data = data, control = as.list(A[["control"]]))
Expand Down Expand Up @@ -614,7 +614,7 @@ weightit2glm.multi <- function(covs, treat, s.weights, subset, estimand, focal,
rlang::check_installed("misaem")
if (is_null(A[["saem.method"]])) A[["saem.method"]] <- "map"
if (is_null(A[["control"]])) A[["control"]] <- list()
if (is_null(A[["control"]][["var_cal"]])) A[["control"]][["var_cal"]] <- FALSE
if (is_null(A[["control"]][["var_cal"]])) A[["control"]][["var_cal"]] <- TRUE #need TRUE to bypass error in miss.glm.fit()
if (is_null(A[["control"]][["ll_obs_cal"]])) A[["control"]][["ll_obs_cal"]] <- FALSE

ps <- make_df(levels(treat), nrow = length(treat))
Expand Down

0 comments on commit abf1fe2

Please sign in to comment.