Added IPTW function
This commit is contained in:
1
R/iptw.R
1
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'))
|
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))
|
psw <- df$TT/fitted(lr_out) + (1-df$TT)/(1-fitted(lr_out))
|
||||||
|
return(psw)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user