andybega / spduration

Split-population duration model in R
https://andybeger.com/spduration/
4 stars 0 forks source link

Implement "weights" option #24

Open andybega opened 6 years ago

andybega commented 6 years ago

Like:

library(CBPS)
library(data.table)
library(spduration)
data("bscoup")
dt <- data.table(bscoup)
dt <- dt[complete.cases(dt)]

# get weights by matching on treatment : recentcoups
fit <- CBPS(recentcoups ~ milreg + instab,
            data = dt,method = "exact")

dt[,coup := as.numeric(coup)-1]

# estimate hazard with with weights
model<- glm(coup ~ instab + recentcoups + wealth,
            weights = fitted(fit),data=dt,family=quasibinomial(link="cloglog"))
andybega commented 2 years ago

(see Jeroen van den Ochtend email from back in September 2018)