From d979d08612811c3f5c43eae8eeea26c4299ce49c Mon Sep 17 00:00:00 2001 From: corentinchoisy Date: Mon, 26 May 2025 16:16:11 +0200 Subject: [PATCH] Added IPTW function --- R/iptw.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/iptw.R b/R/iptw.R index 8ade6ce..7e05f88 100644 --- a/R/iptw.R +++ b/R/iptw.R @@ -30,4 +30,5 @@ iptw <- function(df=NULL,Y=NULL,X=NULL) { } lr_out <- glm(formula = as.formula(formu),data=df,family = binomial(link = 'logit')) psw <- df$TT/fitted(lr_out) + (1-df$TT)/(1-fitted(lr_out)) + return(psw) }