Closed cbr13032024 closed 8 months ago
Not sure where you are reading the coefficients from, but if it is using the coef()
method, then this is explained in the help page for coef.flexsurvreg
, see here. Positive parameters are estimated on the log scale. See also the $res
and $res.t
components of the fitted model object, help(flexsurvreg) section "Value".
Thank you for your help. I tried several ways to look at the coefficients:
print(fit_pfs_CAB_gengamma)
or coeff(fit_pfs_CAB_gengamma)
or fit_pfs_CAB_gengamma[["res.t"]]
all show the coefficients:
mu sigma Q
2.1130724 -0.7993928 2.5144787
(I see that the latter command shows also the 95%CI and SE.)
The help page for coeff()
you referred to (https://chjackson.github.io/flexsurv/reference/coef.flexsurvreg.html) says: "This presents all parameter estimates, transformed to the real line if necessary. For example, shape or scale parameters, which are constrained to be positive, are returned on the log scale."
--> According to the Distributions reference, (https://cran.r-project.org/web/packages/flexsurv/vignettes/distributions.pdf) Sigma is constraint to be positive.
--> Putting this information together, I would assume that sigma is presented on the log scale with the coeff()
command, right? But values on the log scale cannot be negative, so Sigma cannot be on the log scale... ?
Sorry for being so slow! I am still not sure whether I am interpreting these correctly (and how to proceed with the negative values).
By "on the log scale", I mean "after using the log() function to transform a value in [0,Inf] to a value in [-Inf,Inf]".
Ah, I see. So, exp(sigma) should give me the value I could use for the user-defined distribution... I'll check that. Thank you very much!
Hi all,
I am fairly new to modelling survival curves, so any help is appreciated. Using llogis, gompertz and generalized gamma distributions when estimating the fit to observed individual patient data with
flexsurvreg
, I am getting negative sigma (gengamma), negative sdlog (llogis) and negative rate (gompertz) coeffcients. All of these are not defined, according to the Distributions Reference. Why does flexsurvreg calculate negative values, if these are not defined? Do I have to transform them (which coefficients/distributions and how)? How exactly are the coefficients given (scale, parametrization) in the output and where can I see that exact parametrization?I would greatly appreciate any help! Best, CB
Detailed explanation: I used published Kaplan Meier curves to reconstruct individual patient data (IPD), then used this data to fit survival curves (for transition probabilities of a state transition model). I tried several distributions (weibull, exp, gamma, lnorm, llogis, gompertz, generalized gamma) for the fitting with
flexsurvreg
(to see which fits best) and plotted each fit with the observed data (ggsurvplot
). This works well, e.g. for generalized gamma:For this example, the flexsurvreg-given parameters of the generalized gamma are: mu=2.113, sigma: -0.799, Q=2.514. I can also
predict
values with this, and generate a plot with these predicted values. Because this works, I assume that there is some other transformation going on in the background to use these coefficients (so the parametrization is a different one than explained in the Distributions Reference?).Now I want to use these coefficients to define a user-defined distribution for extrapolation purposes independent of the reconstructed IPD (I am modelling in heemod, which integrated flexsurv). This is not possibe (I can't even plot this user-defined distribution), as a negative sigma is not allowed. I assume here that I have to tranform the coefficients first, before using them for other purposes, but I am not sure how (and if only the negative coefficients or all need to be transformed) and could not find an answer in the vignettes.