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]]
______________________________________________
[email protected] 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.