GithubHelp home page GithubHelp logo

Balance summary / Variance about aipw HOT 1 OPEN

kali-alex avatar kali-alex commented on September 27, 2024
Balance summary / Variance

from aipw.

Comments (1)

yqzhong7 avatar yqzhong7 commented on September 27, 2024

How can we have the balance summary across each covariates for the propensity score ? (To calcul the Standardized Mean Difference for example)

You could extract the propensity scores and put them into other packages like cobalt. Please refer to cobalt for more details. I'll add cobalt support in the near future.

Here's a short example for using cobalt to example the balance.

library(AIPW)
library(cobalt)
library(SuperLearner)

set.seed(123)
data("eager_sim_obs")
cov = c("eligibility","loss_num","age", "time_try_pregnant","BMI","meanAP")

AIPW_SL <- AIPW$new(Y= eager_sim_obs$sim_Y,
                    A= eager_sim_obs$sim_A,
                    W= subset(eager_sim_obs,select=cov), 
                    Q.SL.library = c("SL.mean","SL.glm"),
                    g.SL.library = c("SL.mean","SL.glm"),
                    k_split = 10,
                    verbose=FALSE)$
  fit()$ #for ATT please use stratified_fit()
  summary(g.bound = c(0.025,0.975)) #Default truncation of propsensity scores


ate.weights <- function(aipw_obj,estimand = c("ATE","ATT")) {
  call <- match.call()
  out <- list(treat = aipw_obj$.__enclos_env__$private$A,
              covs = aipw_obj$.__enclos_env__$private$g.set,
              distance = aipw_obj$obs_est$p_score, #change this to `aipw_obj$obs_est$raw_p_score` for untruncated ps
              weights = aipw_obj$obs_est$ip_weights,
              estimand = estimand,
              call = call)
  return(out)
}

out <- ate.weights(AIPW_SL,"ATE")

bal.tab(out)

Which estimator is use to compute the variance (and thus 95%CI) ?

We used the delta method for variance estimations. You can find more in our manuscript (Derivations are in the Appendix 2)

from aipw.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.