yqzhong7 / aipw Goto Github PK
View Code? Open in Web Editor NEWR Package: Augmented Inverse Probability Weighted (AIPW) Estimation for Average Causal Effect
Home Page: https://yqzhong7.github.io/AIPW/
License: GNU General Public License v3.0
R Package: Augmented Inverse Probability Weighted (AIPW) Estimation for Average Causal Effect
Home Page: https://yqzhong7.github.io/AIPW/
License: GNU General Public License v3.0
AIPW_base
classAIPW_manual$new(A, Y, mu0, mu1, mu, raw_p_score, verbose)
Supporting categorical exposure by using missing outcome mechanism. (Chapter 6, Gruber, S. and Van der Laan, M.J., 2011. tmle: An R package for targeted maximum likelihood estimation.)
Kennedy, E.H., Sjölander, A. and Small, D.S., 2015. Semiparametric causal inference in matched cohort studies. Biometrika, 102(3), pp.739-746.
@yqzhong7 Could this be addressed, please?
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.0.0d2 (32-bit)
> library(testthat)
> library(AIPW)
>
> test_check("AIPW")
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 206 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-stratified_fit.R:75:3'): AIPW stratified_fit: sl3 & k_split ────
Error in `is.nan(A)`: default method not implemented for type 'list'
Backtrace:
▆
1. └─aipw$stratified_fit() at test-stratified_fit.R:75:3
2. └─private$.f_lapply(...)
3. └─future.apply::future_lapply(...)
4. └─future.apply:::future_xapply(...)
5. ├─future::value(fs)
6. └─future:::value.list(fs)
7. ├─future::resolve(...)
8. └─future:::resolve.list(...)
9. └─future (local) signalConditionsASAP(obj, resignal = FALSE, pos = ii)
10. └─future:::signalConditions(...)
── Error ('test-tmle_support.R:53:3'): AIPW_tmle class: tmle3 ──────────────────
Error in `trim_logit(X)`: 'list' object cannot be coerced to type 'double'
Backtrace:
▆
1. └─tmle3::tmle3(or_spec, data = df, node_list, learner_list) at test-tmle_support.R:53:3
2. └─tmle_spec$make_initial_likelihood(tmle_task, learner_list)
3. └─tmle3::point_tx_likelihood(tmle_task, learner_list)
4. └─likelihood_def$train(tmle_task)
5. └─delayed_fit$compute(job_type = sl3_delayed_job_type(), progress = verbose)
6. └─scheduler$compute()
7. └─self$compute_step()
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 206 ]
Error: Test failures
Execution halted
How can we have the balance summary across each covariates for the propensity score ? (To calcul the Standardized Mean Difference for example)
Which estimator is use to compute the variance (and thus 95%CI) ?
Missing outcome:
Missing outcome is detected, assuming missing at random (MAR)
Packages on CRAN require that their dependencies are also on CRAN. Since sl3 and tmle3 are not on CRAN at this time, we are planning to:
use different splits of cross-fitting for
summarise
Newey, W. K., & Robins, J. R. (2018). Cross-fitting and fast remainder rates for semiparametric estimation. arXiv preprint arXiv:1801.09138.
Chernozhukov V, Chetverikov D, Demirer M, et al. Double/debiased machine learning for treatment and structural parameters. The Econometrics Journal 2018;21(1):C1–C68. doi:10.1111/ectj.12097. Publisher: Oxford Academic.
g.bound
is provided, truncation >0.5 is not allowed (provide error message)g.bound
is provided, asymmetric ps truncation is supported (e.g., g.bound = c(0.05, 0.95)
)g.bound
>=3In line 278 of AIPW/R/AIPW_base.R, the std error of RR may calculate -(2*sigma_covar[1,2]/(mean(aipw_eif1)*mean(aipw_eif0))) twice, which occur NaNs in sqrt function.
Hi, thanks for the fantastic package! I have a small suggestion. Would you be able to change the text included with the results output to something like 'exposure mean', 'control mean' and 'mean difference' when the outcome is continuous? Otherwise it can be a bit confusing seeing 'risk difference' etc for a continuous outcome.
Here is a quick reprex to demonstrate the issue:
A <- rbinom(100, 1, 0.5)
W <- rnorm(100)
Y <- rnorm(100)
aipw_out <- aipw_wrapper(
Y = Y,
A = A,
W = W,
Q.SL.library = "SL.mean",
g.SL.library = "SL.mean",
k = 1
)
Estimate SE 95% LCL 95% UCL N
Risk of exposure -0.2493 0.133 -0.511 0.0124 51
Risk of control -0.0778 0.126 -0.325 0.1697 49
Risk Difference -0.1714 0.183 -0.531 0.1879 100
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.