certara / survivalnma

R interface for popular survival network meta-analysis models (requires WinBUGS)
12 stars 5 forks source link

Treatment specific shape and scale parameter #1

Open shubhrampandey opened 4 years ago

shubhrampandey commented 4 years ago

How can I get the treatment specific shape and scale parameter in Weibull model?

Thanks Shubhram

wwiecek commented 4 years ago

Do you mean how to extract these once your model is ready?

If possible, can you share code so that I can answer in terms of an example?

shubhrampandey commented 4 years ago

Thanks for you quick response.

Yes exactly, I have 3 treatments please find the result below:

survival NMA with fixed effects, weibull family of distributions
------------------------------------------------------------
Treatments (d): Chemo: 1, Pembro: 2, Atezo: 3
Studies (mu): IMPower: 1, KN407: 2
------------------------------------------------------------
Inference for Bugs model at "C:\Users\PandeyS6\AppData\Local\Temp\Rtmp8qIiV2\file1f14f5a728e", fit using WinBUGS,
 3 chains, each with 2e+05 iterations (first 1e+05 discarded), n.thin = 300
 n.sims = 1002 iterations saved
           mean  sd   2.5%    25%    50%    75%  97.5% Rhat n.eff
mu[1,1]    -3.7 0.2   -4.1   -3.8   -3.7   -3.6   -3.3    1   640
mu[1,2]     0.3 0.1    0.1    0.2    0.3    0.4    0.5    1   450
mu[2,1]    -3.3 0.2   -3.7   -3.5   -3.3   -3.2   -3.0    1  1000
mu[2,2]     0.3 0.1    0.1    0.2    0.3    0.3    0.5    1   570
d[2,1]     -0.5 0.3   -1.0   -0.7   -0.5   -0.2    0.1    1  1000
d[2,2]      0.0 0.2   -0.3   -0.1    0.0    0.1    0.3    1   810
d[3,1]      0.0 0.3   -0.6   -0.2    0.0    0.1    0.5    1  1000
d[3,2]     -0.1 0.1   -0.3   -0.2   -0.1    0.0    0.1    1  1000
deviance 1013.0 4.1 1007.0 1010.0 1012.0 1015.0 1023.0    1  1000

For each parameter, n.eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor (at convergence, Rhat=1).

DIC info (using the rule, pD = Dbar-Dhat)
pD = 8.0 and DIC = 1020.9
DIC is an estimate of expected predictive error (lower deviance is better).

Now I want to extract the shape and scale parameter values for all the three treatments individually. So that I can extrapolate the survival curves without baseline adjusted.

wwiecek commented 4 years ago

The parameters you have in there (mu and d) can be extracted from a matrix:

ww <- survnma(somedata, model = "weibull")
head(ww$fit$sims.matrix)
apply(ww$fit$sims.matrix, 2, mean)
apply(ww$fit$sims.matrix, 2, sd)

If you want to specifically calculate shape and scale of, e.g., Weibull, you can follow formulas in Jensen paper (see documentation for reference if needed). But if you want shape and scale simply to calculate hazard or survival values, see code in R/generate_survival.R and R/generate_hazard.R. Right now these functions are "internal" (you don't see them when you load in the package) but I can include them in the next package release. Until then, the code in the .R files might be useful.

survival_plot and survival_table might also do what you need, please have a look

PS: Ah, I've only seen your last comment now. For what you want to do, you have to choose some mu as a reference, as the treatment effect is always applied to some baseline risk. Survival/hazard function should allow you to derive any combination of baseline (study) & treatment.