Added IPTW function

This commit is contained in:
2025-05-26 16:16:11 +02:00
parent acb08e00c1
commit d979d08612

View File

@ -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)
}