1

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.

J.K.
  • 325
  • 2
  • 8
  • 1
    Please read [(1)](https://stackoverflow.com/help/how-to-ask) how do I ask a good question, [(2)](https://stackoverflow.com/help/mcve) how to create a MCVE as well as [(3)](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example#answer-5963610) how to provide a minimal reproducible example in R. Then edit and improve your question accordingly. I.e., abstract from your real problem... – Christoph Nov 28 '20 at 17:41
  • Thank you, I will re-read them again and try to improve it. – J.K. Nov 28 '20 at 17:43
  • In fact, survreg does what I want. In the above, gamma is being replaced by exp(1+x1+x2). – J.K. Nov 28 '20 at 20:40
  • 1
    I don't understand "introduce explanatory variables, by replacing the parameter γ with exp(X_i ...)" – Christoph Nov 29 '20 at 11:25
  • Yeah I think you need to either add more maths or more code because currently it sounds like you want to manually change the fitted coefficients, which can't be right – RaphaelS Dec 17 '20 at 17:34

0 Answers0