Fits a Cox-Weibull with cumulative hazard given by $$ \Lambda(t) = \lambda \cdot t^s $$ where \(s\) is the shape parameter, and \(\lambda\) the rate parameter. We here allow a regression model for both parameters $$\lambda := \exp(\beta^\top X)$$ $$s := \exp(\gamma^\top Z)$$ as defined by `formula` and `shape.formula` respectively.
Usage
phreg_weibull(formula, shape.formula = ~1, data, control = list())Examples
data(sTRACE, package="mets")
sTRACE$entry <- 0
fit1 <- phreg_weibull(Event(entry, time, status == 9) ~ age,
shape.formula = ~age, data = sTRACE)
tt <- seq(0,10, length.out=100)
pr1 <- predict(fit1, newdata = sTRACE[1, ], times = tt)
fit2 <- phreg(Event(time, status == 9) ~ age, data = sTRACE)
pr2 <- predict(fit2, newdata = sTRACE[1, ], se = FALSE)
if (interactive()) {
plot(pr2$times, pr2$surv, type="s")
lines(tt, pr1[,1,1], col="red", lwd=2)
}
