UM-COG-HSR / BP-COG_Aim2_Dementia

Cox model using time-varying cognition to predict dementia hazard
0 stars 0 forks source link

Notes on using flexsurv package in R #6

Open agalecki opened 4 years ago

agalecki commented 4 years ago

Parameterization

library(flexsurv) ?flexsurv.dists ?dweibull


--- dist--- Typically, one of the strings in the first column of the following table, identifying a built-in distribution. This table also identifies the location parameters, and whether covariates on these parameters represent a proportional hazards (PH) or accelerated failure time (AFT) model. In an accelerated failure time model, the covariate speeds up or slows down the passage of time. So if the coefficient (presented on the log scale) is log(2), then doubling the covariate value would give half the expected survival time.

"weibull" Weibull scale AFT ... many more distributions

----- Weibull parameterization --- The Weibull parameterisation is different from that in survreg, instead it is consistent with dweibull. The "scale" reported by survreg is equivalent to 1/shape as defined by dweibull and hence flexsurvreg. The first coefficient (Intercept) reported by survreg is equivalent to log(scale) in dweibull and flexsurvreg.

agalecki commented 4 years ago

thank you Nick,

As a first step could you use foreign package to convert your analytical data from SAS to .rdata format.

Second step would be to trying to fit weibull model using syntax similar to

library(flexsurv)
flx0 <- flexsurvreg(Surv(start, stop, event ==1) ~ 1+ covariates_from_cox_model, data = dt, dist="weibull")
coef(flx0)

--- explore dist = "weibullPH" Tx Andrzej