Perhaps this package could be considered

https://cran.r-project.org/web/packages/hrIPW/hrIPW.pdf

That packages author also has a 2016 article in Statistics in Medicine on the 
properties of estimates from such analyses that might be useful. 

— 
David Winsemius, MD, MPH

Sent from my iPhone

> On May 19, 2021, at 8:01 PM, Sorkin, John <jsor...@som.umaryland.edu> wrote:
> 
> When running a propensity score weighted analysis using coxph(), are the 
> weights entered as the log of the weights, or as the weights on the original 
> scale, i.e. coxph(Surv(time,status)~group,weights=weights       ,data=mydata) 
> or
>      coxph(Surv(time,status)~group,weights=log(weights),data=mydata)
> 
> I am creating weights using logistic regression as described below.
> 
> # Lalonde data from the MatchIt package is used in the pseudo code below
> install.packages("MatchIt")
> library("MatchIt")
> 
> #############################################
> # Calculate propensity scores using logistic regression.#
> #############################################
> ps <- glm(treat ~ age + educ +nodegree +re74+ 
> re75,data=lalonde,family=binomial())
> summary(ps)
> #PS on the scale of the dependent variable
> # Add the propensity scores to the dataset
> lalonde$psvalue <- predict(ps,type="response")
> #################################################
> # END Calculate propensity scores using logistic regression.#
> #################################################
> 
> #################################
> # Convert propensity scores to weights#
> #################################
> # Different weights for cases (1) and controls
> lalonde$weight.ATE <- ifelse(lalonde$treat == 1, 
> 1/lalonde$psvalue,1/(1-lalonde$psvalue))
> summary(lalonde$weight.ATE)
> #####################################
> # END Convert propensity scores to weights#
> #####################################
> 
> ##########################################################
> # Examples of two possible way  to enter weights in the coxph model. #
> ##########################################################
> fit1 <- coxph(Surv(time,status)~group,weights=lalonde$weight,data=lalonde)
> or
> fit2 <- 
> coxph(Surv(time,status)~group,weights=log(lalonde$weight),data=lalonde)
> ##########################################################
> # Examples of two possible way  to enter weights in the coxph model. #
> ##########################################################
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to