I am trying to perform a set of survival analyses on surgical duration, with a set of covariates as controls. The purpose is to compare the coefficients and marginal effects of covariates across different distributional forms (e.g., exponential, Weibull, log-logistic). To help your understanding, suppose that the exponential model is defined as: exponential model specification and with log-logistic distribution, the duration model can be specified as: log-logistic model specification
QUESTION: I need to introduce explanatory variables, by replacing the parameter γ with exp(X_i * β). Is there any R function that can allow me to modify such parameter?
Sample data
set.seed(1)
Data <- data.frame(
X1 = sample(1:10),
X2 = sample(c("yes", "no"), 10, replace = TRUE),
status = sample(1, 10, replace=TRUE),
# no censoring. -- all entry and exit are recorded.
surgical.duration = sample(1:10)
)
Trial 1: rms and survival Packages (psm function)
library(rms)
library("survival")
exp.model <- psm(Surv(surgical.duration, status) ~ 1 + X1 + X2,
data = Data, dist="exponential")
# Is there any way to put the parameter specification into this?
Trial 2: survival package (survereg and Surv functions)
exp.model2 <- survreg(Surv(surgical.duration, status) ~ 1 + X1 + X2,
data = Data, dist="exponential", parms = )
# Can I use this parms argument to specify the parameter?
summary(exp.model2)
Thank you for your help.