Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treatment specific shape and scale parameter #1

Open
shubhrampandey opened this issue Jan 13, 2020 · 3 comments
Open

Treatment specific shape and scale parameter #1

shubhrampandey opened this issue Jan 13, 2020 · 3 comments

Comments

@shubhrampandey
Copy link

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

Thanks
Shubhram

@wwiecek
Copy link
Contributor

wwiecek commented Jan 13, 2020

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
Copy link
Author

shubhrampandey commented Jan 13, 2020

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
Copy link
Contributor

wwiecek commented Jan 14, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants