Skip to content

Commit

Permalink
Adjust doc to prevent gbm warning with multinomial
Browse files Browse the repository at this point in the history
  • Loading branch information
ngreifer committed Aug 20, 2024
1 parent 6dd448c commit 4f74647
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
31 changes: 18 additions & 13 deletions R/get_w_from_ps.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,27 @@
#' estimand = "ATT", treated = "A")
#' all.equal(w1, w3)
#'
#' #Using MMWS
#' # Using MMWS
#' w4 <- get_w_from_ps(ps, treat = lalonde$treat,
#' estimand = "ATE", subclass = 20,
#' stabilize = TRUE)
#' @examplesIf requireNamespace("gbm", quietly = TRUE)
#' #A multi-category example using GBM predicted probabilities
#' library(gbm)
#' T3 <- factor(sample(c("A", "B", "C"), nrow(lalonde), replace = TRUE))
#'
#' gbm.fit <- gbm(T3 ~ age + educ + race + married +
#' nodegree + re74 + re75, data = lalonde,
#' distribution = "multinomial", n.trees = 200,
#' interaction.depth = 3)
#' ps.multi <- drop(predict(gbm.fit, type = "response",
#' n.trees = 200))
#' w <- get_w_from_ps(ps.multi, T3, estimand = "ATE")
#'
#' # A multi-category example using predicted probabilities
#' # from multinomial logistic regression
#' T3 <- factor(sample(c("A", "B", "C"), nrow(lalonde),
#' replace = TRUE))
#'
#' multi.fit <- multinom_weightit(
#' T3 ~ age + educ + race + married +
#' nodegree + re74 + re75, data = lalonde,
#' vcov = "none"
#' )
#'
#' ps.multi <- fitted(multi.fit)
#' head(ps.multi)
#'
#' w5 <- get_w_from_ps(ps.multi, treat = T3,
#' estimand = "ATE")

#' @export
get_w_from_ps <- function(ps, treat, estimand = "ATE", focal = NULL, treated = NULL,
Expand Down
32 changes: 18 additions & 14 deletions man/get_w_from_ps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4f74647

Please sign in to comment.