Title: | Provides a suite of extension functions for NMA using the `gemtc` package |
---|---|
Description: | Functions for generating outputs: tables and plots for NMA reports. |
Authors: | Sandro Gsteiger [aut, cre], Nick Howlett [aut], Beth Ashlee [aut], F. Hoffmann La Roche Ltd [cph] |
Maintainer: | Sandro Gsteiger <[email protected]> |
License: | Apache License (>= 2) |
Version: | 1.0.0 |
Built: | 2024-11-10 04:20:24 UTC |
Source: | https://github.com/Roche/gemtcPlus |
Creates a fractional polynomial model plan
bth_prior(model = "PWE", bth.model = "RE", type, distr, param)
bth_prior(model = "PWE", bth.model = "RE", type, distr, param)
model |
One of "PWE" or "FP" |
bth.model |
If model is PWE then must be "RE". If model is FP then One of "RE" or "REINT" |
type |
If PWE RE or FP REINT then one of "sd" or "var". If FP RE then "vcov" |
distr |
If type is "sd" then one of "unif" or "hn". If type is "var" then "ln". If typeis "vcov" then "invwish" |
param |
A |
create_jags_init. Helper function to create jags init list dependant on length on chains provided
create_jags_init(n.chains = 3)
create_jags_init(n.chains = 3)
n.chains |
Number of chains' |
Creates a minimal project template for selected model type
create_template(type = c("binary", "gsd", "fp", "pwe"), file = NULL)
create_template(type = c("binary", "gsd", "fp", "pwe"), file = NULL)
type |
model type |
file |
file name (optional); if not provided, default filename will be <type>_model.Rmd. The .Rmd extension will be added. |
create_template("binary")
create_template("binary")
Helper function to extract BUGS files for given input parameters
extract_BUGS_file( data.type, bth.model, bth.prior, model.pars = NULL, model.type = c("PWE", "FP") )
extract_BUGS_file( data.type, bth.model, bth.prior, model.pars = NULL, model.type = c("PWE", "FP") )
data.type |
Only GSD currently supported |
bth.model |
FE or RE |
bth.prior |
list containins priors infomation |
model.pars |
Only needed for FP model, list containing exponets to determin order (1st of 2nd) |
model.type |
Either PWE or FP |
This package was designed to work alongside the gemtc
package.
Included are numerous convenience functions to aid in the production of reports.
Sandro Gsteiger [email protected]>
First order fractional polynomial
get_fp_1o(x, params, exponents, sums = NULL)
get_fp_1o(x, params, exponents, sums = NULL)
x |
A vector with the dependent variable. |
params |
A matrix with two columns giving the intercept and the "slope". If more than one rows given, the fractional polynomial is evaluated for each row. |
sums |
A function. If non-null, sums of the fractional polynomial at each x value (i.e. summaries over the different params values) are calculated. |
exponent |
A numerical value giving the exponent (p1) of the polynomial. |
A matrix with length(x) rows giving the FP values or FP summaries.
Calculate the study and arm level survivor functions estimates from a 1st order fractional polynomial NMA. These estimates provide the basis for a goodness-of-fit graph when plotted along with the input data.
get_fp_1o_GoF(fit, time = 1:24, bl.node = "mu", contrast.node = "d")
get_fp_1o_GoF(fit, time = 1:24, bl.node = "mu", contrast.node = "d")
fit |
JAGS object with FP NMA fit. |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
The FP parameters to calculate the log-hazard curves for each survivor function are combinations bl.node + contrast.node
. Here, every study-specific baseline estimate is combined with the arm-specific contrast to obtain arm level NMA estimates.
a data.frame
containing survivor function for each treatment
Calculate the time-dependent hazard ratios obtained from fitting a first order fractional polynomial model.
get_fp_1o_HR( x, fit, trt.nos, ref.no, trt.labs = NULL, node = "d", CI = TRUE, revert = FALSE )
get_fp_1o_HR( x, fit, trt.nos, ref.no, trt.labs = NULL, node = "d", CI = TRUE, revert = FALSE )
x |
A vector with the dependent variable. |
fit |
An rjags object with the output from the JAGS fit. |
trt.nos |
A vector with the numerical treatment IDs for which the HRs shall be calculated (including the ref). |
ref.no |
An integer with the numerical ID of the reference for the HR calculations. |
trt.labs |
A character vector of same length as trt.nos with the treatment labels. |
node |
A character string that identifies the node in the JAGS model giving the treatment effect estimates. |
CI |
Logical, shall CIs for the fractional polynomial be given? (Medians are always provided.) |
Requires the packages: dplyr, coda.
A data frame with pointwise median (and CI) HRs for all comparisons of trt.nos vs ref.no.
Calculate the survivor functions estimated in a 1st order fractional polynomial NMA model. The absolute S(t) estimates combining the estimated baseline survival from a reference trial (in the NMA) with the fractional polynomial (log)hazard ratio estimates to construct the S(t) functions for each treatment.
get_fp_1o_S( fit, ref.std, ref.arm, treatments, time = 1:24, bl.node = "mu", contrast.node = "d" )
get_fp_1o_S( fit, ref.std, ref.arm, treatments, time = 1:24, bl.node = "mu", contrast.node = "d" )
fit |
JAGS object with FP NMA fit. |
ref.std |
Numeric identifier of reference study to use for baseline survival estimate. |
ref.arm |
Numeric identifier of arm in reference study to use for baseline survival estimate. |
treatments |
Vector with character strings to label the treatments. |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
The FP parameters to calculate the log-hazard curves for each survivor function are combinations bl.node + contrast.node
. This means the combination ref.std, ref.arm
must identify a study arm in the NMA that used the (NMA) reference treatment. The basic parameters (contrasts vs reference) are then added to optain the parameters for each treatment in the study.
a data.frame
containing survivor function for each treatment
Second order fractional polynomial
get_fp_2o(x, params, exponents, sums = NULL)
get_fp_2o(x, params, exponents, sums = NULL)
x |
A vector with the dependent variable. |
params |
A matrix with two columns giving the intercept and the "slope". If more than one rows given, the fractional polynomial is evaluated for each row. |
exponents |
A vector giving the exponents (p1, p2) of the polynomial. |
sums |
A function. If non-null, sums of the fractional polynomial at each x value (i.e. summaries over the different params values) are calculated. |
A matrix with length(x) rows giving the FP values or FP summaries.
Calculate the study and arm level survivor functions estimates from a 2nd order fractional polynomial NMA. These estimates provide the basis for a goodness-of-fit graph when plotted along with the input data.
get_fp_2o_GoF(fit, time = 1:24, bl.node = "mu", contrast.node = "d")
get_fp_2o_GoF(fit, time = 1:24, bl.node = "mu", contrast.node = "d")
fit |
JAGS object with FP NMA fit. |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
The FP parameters to calculate the log-hazard curves for each survivor function are combinations bl.node + contrast.node
. Here, every study-specific baseline estimate is combined with the arm-specific contrast to obtain arm level NMA estimates.
a data.frame
containing survivor function for each treatment
Calculate the time-dependent hazard ratios obtained from fitting a second order fractional polynomial model.
get_fp_2o_HR( x, fit, trt.nos, ref.no, trt.labs = NULL, node = "d", CI = TRUE, revert = FALSE )
get_fp_2o_HR( x, fit, trt.nos, ref.no, trt.labs = NULL, node = "d", CI = TRUE, revert = FALSE )
x |
A vector with the dependent variable. |
fit |
An rjags object with the output from the JAGS fit. |
trt.nos |
A vector with the numerical treatment IDs for which the HRs shall be calculated (including the ref). |
ref.no |
An integer with the numerical ID of the reference for the HR calculations. |
trt.labs |
A character vector of same length as trt.nos with the treatment labels. |
node |
A character string that identifies the node in the JAGS model giving the treatment effect estimates. |
CI |
Logical, shall CIs for the fractional polynomial be given? (Medians are always provided.) |
Requires the packages: dplyr, coda.
A data frame with pointwise median (and CI) HRs for all comparisons of trt.nos vs ref.no.
Calculate the survivor functions estimated in a 2nd order fractional polynomial NMA model. The absolute S(t) estimates combining the estimated baseline survival from a reference trial (in the NMA) with the fractional polynomial (log)hazard ratio estimates to construct the S(t) functions for each treatment.
get_fp_2o_S( fit, ref.std, ref.arm, treatments, time = 1:24, bl.node = "mu", contrast.node = "d" )
get_fp_2o_S( fit, ref.std, ref.arm, treatments, time = 1:24, bl.node = "mu", contrast.node = "d" )
fit |
JAGS object with FP NMA fit. |
ref.std |
Numeric identifier of reference study to use for baseline survival estimate. |
ref.arm |
Numeric identifier of arm in reference study to use for baseline survival estimate. |
treatments |
Vector with character strings to label the treatments. |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
The FP parameters to calculate the log-hazard curves for each survivor function are combinations bl.node + contrast.node
. This means the combination ref.std, ref.arm
must identify a study arm in the NMA that used the (NMA) reference treatment. The basic parameters (contrasts vs reference) are then added to optain the parameters for each treatment in the study.
a data.frame
containing survivor function for each treatment
Extract model information and fit statistics from a list of fractional polynomial NMAs.
get_fp_comparison(nmaout.list)
get_fp_comparison(nmaout.list)
nmaout.list |
List of results lists (which must contain the names elements |
matrix comparing the models
Extract the treatment contrasts vs the reference in the network
get_fp_contrasts(fit.jg, treatments = NULL, node = "d", revert = FALSE)
get_fp_contrasts(fit.jg, treatments = NULL, node = "d", revert = FALSE)
fit.jg |
The jags output object. |
treatments |
A vector with the labels for the treatments in the network (in the correct order). If NULL treatments calculate from fit |
node |
The name of the node identifying the contrast. |
Calculate correlations between the contrast estimates for multi-dimensional effect estimates for all treatments in a FP NMA.
get_fp_corrs(fit, node = "d")
get_fp_corrs(fit, node = "d")
fit |
Jags output |
node |
The name of the node with the contrasts (default is "d"). |
a data.frame
containing the posterior correlations
Extract model information and fit statistics from NMA fit in jags of a fractional polynomial model.
get_fp_elements(nmaout)
get_fp_elements(nmaout)
nmaout |
A list with the results from NMA fit (jags). The list must contain the names elements 'descr_s, model.pars, fit, DICsamp'. |
list with description and fit metrics
Calculate the study and arm level survivor functions estimates from a fractional polynomial NMA. These estimates provide the basis for a goodness-of-fit graph when plotted along with the input data.
get_fp_GoF(fit, treatments, time = 1:24, bl.node = "mu", contrast.node = "d")
get_fp_GoF(fit, treatments, time = 1:24, bl.node = "mu", contrast.node = "d")
fit |
JAGS object with FP NMA fit. |
treatments |
Vector with character strings to label the treatments. Argument not currently used |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
The FP parameters to calculate the log-hazard curves for each survivor function are combinations bl.node + contrast.node
. Here, every study-specific baseline estimate is combined with the arm-specific contrast to obtain arm level NMA estimates.
a data.frame
containing survivor function for each treatment
Calculate the time-dependent hazard ratios obtained from fitting a fractional polynomial model (first or second order).
get_fp_HR( x, fit, trt.nos, ref.no, trt.labs = NULL, node = "d", CI = TRUE, revert = FALSE )
get_fp_HR( x, fit, trt.nos, ref.no, trt.labs = NULL, node = "d", CI = TRUE, revert = FALSE )
x |
A vector with the dependent variable. |
fit |
An rjags object with the output from the JAGS fit. |
trt.nos |
A vector with the numerical treatment IDs for which the HRs shall be calculated (including the ref). |
ref.no |
An integer with the numerical ID of the reference for the HR calculations. |
trt.labs |
A character vector of same length as trt.nos with the treatment labels. |
node |
A character string that identifies the node in the JAGS model giving the treatment effect estimates. |
CI |
Logical, shall CIs for the fractional polynomial be given? (Medians are always provided.) |
Requires the packages: dplyr, coda.
A data frame with pointwise median (and CI) HRs for all comparisons of trt.nos vs ref.no.
Calculate the survivor functions estimated in a fractional polynomial NMA model. The absolute S(t) estimates combining the estimated baseline survival from a reference trial (in the NMA) with the fractional polynomial (log)hazard ratio estimates to construct the S(t) functions for each treatment.
get_fp_S( fit, ref.std, ref.arm, treatments = NULL, time, bl.node = "mu", contrast.node = "d" )
get_fp_S( fit, ref.std, ref.arm, treatments = NULL, time, bl.node = "mu", contrast.node = "d" )
fit |
JAGS object with NMA fit. |
ref.std |
Numeric identifier of reference study to use for baseline survival estimate. |
ref.arm |
Numeric identifier of arm in reference study to use for baseline survival estimate. |
treatments |
Vector with character strings to label the treatments. If NULL treatments calculated from fit |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
The FP parameters to calculate the log-hazard curves for each survivor function are combinations bl.node + contrast.node
. This means the combination ref.std, ref.arm
must identify a study arm in the NMA that used the (NMA) reference treatment. The basic parameters (contrasts vs reference) are then added to optain the parameters for each treatment in the study.
A data.frame
containing survivor function for each treatment
Utility function to return jags data and model for reporting (e.g. in appendix)
get_jags_info( sims, include.comments = FALSE, input.round.function = function(x) signif(x, digits = 4) )
get_jags_info( sims, include.comments = FALSE, input.round.function = function(x) signif(x, digits = 4) )
sims |
rjags object |
include.comments |
Logical, should comments in the model by included or stripped out (default: FALSE) |
input.round.function |
Function to apply to data inputs - default: function(x) signif(x, digits = 4) |
jagsInfo
object which contains jags simulation information accesed via a call to print
Iain Bennett (adaptations: Sandro Gsteiger)
Utility function to extract effect estimates "other treatments vs new" from gemtc fit.
get_mtc_allVsNew(x, new.lab, transform = NULL, digits = NULL)
get_mtc_allVsNew(x, new.lab, transform = NULL, digits = NULL)
x |
Object of class |
new.lab |
Character string with name of new intervention. |
transform |
Optional name of transformation to apply to output (e.g. "exp"). |
digits |
Optional integer number of digits to round the output to. |
Returns a data.frame of effect estimates
Utility function to extract effect estimates "new vs other treatments" from gemtc fit.
get_mtc_newVsAll(x, new.lab, transform = NULL, digits = NULL)
get_mtc_newVsAll(x, new.lab, transform = NULL, digits = NULL)
x |
Object of class |
new.lab |
Character string with name of new intervention. |
transform |
Optional name of transformation to apply to output (e.g. "exp"). |
digits |
Optional integer number of digits to round the output to. |
Returns a data.frame of effect estimates
Utility function to extract probabilities of new treatment being better from gemtc fit (e.g. P(HR<1) for HRs new vs other).
get_mtc_probBetter( x, new.lab, smaller.is.better = TRUE, threshold = 0, sort.by = c("name", "effect")[1], digits = 3 )
get_mtc_probBetter( x, new.lab, smaller.is.better = TRUE, threshold = 0, sort.by = c("name", "effect")[1], digits = 3 )
x |
Object of class mtc.result containing the NMA fit. |
new.lab |
Character string with name of new intervention. |
smaller.is.better |
Logical (default is TRUE). |
threshold |
Numerical value (default is 0) giving the threshold against which contrasts are being compared. |
sort.by |
Character string, must be either "name" or "effect" (default), indicating the sorting of the output table. |
digits |
Integer (default is 3); if provided, outputs will be rounded accordingly. |
A data.frame of probabilities of a treatment being better from a mtc model
Utility function to extract summary stats from mtc.result object.
get_mtc_sum(x, digits = 2)
get_mtc_sum(x, digits = 2)
x |
Object of class |
digits |
Integer specifiying the number of digits for rounding (default is 2). |
A data.frame of mtc model summary statistics
Extract edges information ("from-to matrix") from network data frame.
get_nw_fromto(dat)
get_nw_fromto(dat)
dat |
|
A matrix
with columns "from", "to".
Utility function to get segments (as character strings) from vector with cutpoints
get_pw_segments(x = NULL, cuts, right = FALSE, ordered_results = TRUE)
get_pw_segments(x = NULL, cuts, right = FALSE, ordered_results = TRUE)
x |
NULL value |
cuts |
Vector with cut points |
right |
Logical |
ordered_results |
Logical |
factor
of segments
Extract model information and fit statistics from a list of piecewise-exponential NMA fits.
get_pwe_comparison(nmaout.list)
get_pwe_comparison(nmaout.list)
nmaout.list |
List of results lists (which must contain the names elements 'descr_s, model.pars, fit, DICsamp'). |
matrix comparing the models
Utility function to extract HR estimates from piece-wise exponential model fit in (format needed for ggplot)
get_pwe_contrasts( fit, treatments = NULL, ref, reverse = FALSE, exponentiate = TRUE, xmax = 24, digits = 3, alpha = 0.05 )
get_pwe_contrasts( fit, treatments = NULL, ref, reverse = FALSE, exponentiate = TRUE, xmax = 24, digits = 3, alpha = 0.05 )
fit |
|
treatments |
Vector of treatment names (character string) ordered according to array indexes in jags fit. If NULL treatments extracted from fit |
ref |
Character string identifying reference treatment to use in calculating contrasts. |
reverse |
Logical, if TRUE (default) "ref vs others" is calculated (instead of "others vs ref"). |
exponentiate |
Logical, if TRUE (default) contrast estimates are exponentiated in output. |
xmax |
Numeric |
digits |
Numeric |
alpha |
Numeric |
A data.frame
contatining hazzard ratio estimates from an rjags
object which is the return of R2jags::jags()
Utility function: convergence diagnostics for piece-wise constant models
get_pwe_conv_diag(fit, file = NULL, patterns = c("d", "mu"), re.pattern = "sd")
get_pwe_conv_diag(fit, file = NULL, patterns = c("d", "mu"), re.pattern = "sd")
fit |
|
file |
Optional output filename (a pdf with this name will be created if provided). |
patterns |
Vector of character strings used to identify the patterns selected for conv assessment. |
re.pattern |
Character |
ggplot object
Extract model information and fit statistics from NMA fit in jags of a piecewise-exponential model.
get_pwe_elements(nmaout)
get_pwe_elements(nmaout)
nmaout |
A list with the results from NMA fit (jags). The list must contain the named elements 'descr_s, model.pars, fit, DICsamp'. |
list with description and fit metrics
Calculate the survivor function estimates for each study and arm. Calculate also the observed survival curves from the binned KM data to compare observed and estimated survivor functions.
get_pwe_GoF( fit, data.arms, data.jg, time = 0:60, bl.node = "mu", contrast.node = "d" )
get_pwe_GoF( fit, data.arms, data.jg, time = 0:60, bl.node = "mu", contrast.node = "d" )
fit |
JAGS object with NMA fit. |
data.arms |
Data frame with one line per study arm and columns study, treatment, studyn, treatmentn. |
data.jg |
List with input data set that was used in jags fit. |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
data.frame
Calculate the survivor functions estimated in piecewise-constant NMA model. The absolute S(t) estimates combining the estimated baseline survival from a reference trial (in the NMA) with the piecewise-constant hazard ratio estimates to construct the S(t) functions for each treatment.
get_pwe_S( fit, ref.std, ref.arm, treatments = NULL, time = 0:24, bl.node = "mu", contrast.node = "d" )
get_pwe_S( fit, ref.std, ref.arm, treatments = NULL, time = 0:24, bl.node = "mu", contrast.node = "d" )
fit |
JAGS object with NMA fit. |
ref.std |
Numeric identifier of reference study to use for baseline survival estimate. |
ref.arm |
Numeric identifier of arm in reference study to use for baseline survival estimate. |
treatments |
Vector with character strings to label the treatments. If NULL treatments extracted from fit |
time |
Vector of time-points at which S(t) functions are calculated. |
bl.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "mu"). |
contrast.node |
Charactor to identify the node in the jags model that identifies the baseline estimates (default is "d"). |
a data.frame
containing survivor function for each treatment
Utility function to get segments (as character strings) from vector with cutpoints
get_segments(cut.pts)
get_segments(cut.pts)
cut.pts |
Vector with cut points |
factor
of segments
Utility function for pre-processing: prepare jags input data for FP model.
groupedTTE_fp_pre_proc( dat, ref.std = NULL, nma.ref.trt = NULL, model.pars = NULL, feprior_mean = NULL, feprior_prec = NULL, bth.prior = NULL )
groupedTTE_fp_pre_proc( dat, ref.std = NULL, nma.ref.trt = NULL, model.pars = NULL, feprior_mean = NULL, feprior_prec = NULL, bth.prior = NULL )
dat |
A |
ref.std |
A |
nma.ref.trt |
A |
model.pars |
|
feprior_mean |
A |
feprior_prec |
A |
A list
with input data for jags fit of PWE model.
nma_pre_proc
, groupedTTE_pwe_pre_proc
Utility function for pre-processing: prepare jags input data for PWE model.
groupedTTE_pwe_pre_proc( dat, ref.std = NULL, nma.ref.trt = NULL, model.pars = NULL, feprior_mean = NULL, feprior_prec = NULL, bth.prior = NULL )
groupedTTE_pwe_pre_proc( dat, ref.std = NULL, nma.ref.trt = NULL, model.pars = NULL, feprior_mean = NULL, feprior_prec = NULL, bth.prior = NULL )
dat |
A |
ref.std |
A |
nma.ref.trt |
A |
model.pars |
|
feprior_mean |
A |
feprior_prec |
A |
bth.prior |
A |
A list
with input data for jags fit of PWE model.
nma_pre_proc
, groupedTTE_fp_pre_proc
Lists all available model files inside the inst directory
list_BUGS(full.path = FALSE)
list_BUGS(full.path = FALSE)
full.path |
lgl Return full path to file? |
character vector containing a file name/path
Helper function to extract named elements from a list to match the arguments of supplied function
match_args_to_func(args, func)
match_args_to_func(args, func)
args |
A named |
func |
A function of whose argumetns to extract |
Utility function providing pairwise probability of being better (col vs row). (Adapted from gemtc::relative.effect.table()).
mtc.prob.better.table(x, smaller.is.better, threshold = 0, covariate = NA)
mtc.prob.better.table(x, smaller.is.better, threshold = 0, covariate = NA)
x |
Object of class |
smaller.is.better |
Logical (default is TRUE). |
threshold |
Numerical value (default is 0) giving the threshold against which contrasts are being compared. |
covariate |
NA; for compatibility with gemtc::relative.effect.table(). |
An array of class 'mtc.prob.better.table'
Takes input data and a model plan and passes to the model engine specified. Current supported engines are the 'gemtc' package (using mtc.model & mtc.run) or 'rjags' (using jags and dic.samples functions)
nma_fit(model_input)
nma_fit(model_input)
model_input |
a list containing named elements fitting_data (data which has been pre-processed) and plan (list object containing all input parameters) |
model object of class 'rjags' or 'mtc.result'
NMA data pre-processing
nma_pre_proc(data, plan)
nma_pre_proc(data, plan)
data |
input |
plan |
A |
A network object or if gsd a list containing a network object and jags init parameters
groupedTTE_fp_pre_proc
, groupedTTE_pwe_pre_proc
Creates a model plan for binary data
plan_binary( bth.model = c("FE", "RE"), engine = "gemtc", data.type = "BINARY", binary_data_type = "arm_level", jags_init = NULL, n.chain = NULL, n.iter = NULL, n.adapt = NULL, thin = NULL, bth.prior = NULL, rsd = 13579, model = "binom", link = "logit", om.scale = 5, ... )
plan_binary( bth.model = c("FE", "RE"), engine = "gemtc", data.type = "BINARY", binary_data_type = "arm_level", jags_init = NULL, n.chain = NULL, n.iter = NULL, n.adapt = NULL, thin = NULL, bth.prior = NULL, rsd = 13579, model = "binom", link = "logit", om.scale = 5, ... )
bth.model |
One of "FE", or "RE" |
engine |
Only 'gemtc' currently supported |
data.type |
Only "BINARY" supported |
binary_data_type |
One of "relative_effect" or "arm_level" |
jags_init |
A |
n.chain |
A |
n.iter |
A |
n.adapt |
A |
thin |
A |
bth.prior |
Output of using |
rsd |
|
model |
defult "binom" |
link |
default "logit" |
om.scale |
defult is 5 |
... |
any other names arguments must match arguments names from |
A list containing model, engine, binary_data_type and model params
plan_binary(bth.model = "RE", n.chain = 3, n.iter = 6000, thin = 1, n.adapt = 1000, link = "logit", bth.prior = gemtc::mtc.hy.prior(type = "var", distr = "dlnorm",-4.18, 1 / 1.41 ^ 2))
plan_binary(bth.model = "RE", n.chain = 3, n.iter = 6000, thin = 1, n.adapt = 1000, link = "logit", bth.prior = gemtc::mtc.hy.prior(type = "var", distr = "dlnorm",-4.18, 1 / 1.41 ^ 2))
Creates a fractional polynomial model plan
plan_fp( model.pars, bth.model = c("FE", "REINT", "RE"), ref.std, nma.ref.trt, engine = "rjags", data.type = "GSD", feprior_mean = 0, feprior_prec = 1e-04, descr = "Fractional polynomial model", descr_s = "FP", n.chains = NULL, n.iter = NULL, n.burnin = NULL, n.thin = NULL, bth.prior = NULL, rsd = 13579, model.file = NULL, ... )
plan_fp( model.pars, bth.model = c("FE", "REINT", "RE"), ref.std, nma.ref.trt, engine = "rjags", data.type = "GSD", feprior_mean = 0, feprior_prec = 1e-04, descr = "Fractional polynomial model", descr_s = "FP", n.chains = NULL, n.iter = NULL, n.burnin = NULL, n.thin = NULL, bth.prior = NULL, rsd = 13579, model.file = NULL, ... )
model.pars |
A named |
bth.model |
One of "FE", "REINT", or "RE" |
ref.std |
A string containing the reference study |
nma.ref.trt |
A string containing the reference treatment |
engine |
Only 'rjags' currently supported |
data.type |
Only "GSD" supported |
feprior_mean |
A |
feprior_prec |
A |
descr |
A |
descr_s |
Short description |
n.chains |
A |
n.iter |
A |
n.burnin |
A |
n.thin |
A |
bth.prior |
A |
rsd |
|
model.file |
Path to BUGS file. If NULL file name will be built from input parameters and extracted from BUGScode folder if present |
... |
any other named arguments must match arguments names from |
See the vignettes for the specification of bth.prior
. Currently parameter names not fully aligned betwen PWE and FP.
A list containing model, engine, analysis and model params
plan_fp(model.pars = list(exponents = 0, t.eval = "midpoint"), bth.model = "FE", ref.std = "STUDY2", nma.ref.trt = "B", model.file = system.file("BUGScode", "gsd_fracpoly-1o_fe.txt", package = "gemtcPlus"))
plan_fp(model.pars = list(exponents = 0, t.eval = "midpoint"), bth.model = "FE", ref.std = "STUDY2", nma.ref.trt = "B", model.file = system.file("BUGScode", "gsd_fracpoly-1o_fe.txt", package = "gemtcPlus"))
Creates a model plan for hazard ratio
plan_hr( bth.model = c("FE", "RE"), engine = "gemtc", data.type = "HR", binary_data_type = "relative_effect", jags_init = NULL, n.chain = NULL, n.iter = NULL, n.adapt = NULL, thin = NULL, bth.prior = NULL, rsd = 13579, model = "binom", link = "identity", om.scale = 5, ... )
plan_hr( bth.model = c("FE", "RE"), engine = "gemtc", data.type = "HR", binary_data_type = "relative_effect", jags_init = NULL, n.chain = NULL, n.iter = NULL, n.adapt = NULL, thin = NULL, bth.prior = NULL, rsd = 13579, model = "binom", link = "identity", om.scale = 5, ... )
bth.model |
One of "FE", or "RE" |
engine |
Only 'gemtc' currently supported |
data.type |
Only "HR" supported |
binary_data_type |
One of "relative_effect" or "arm_level" |
jags_init |
A |
n.chain |
A |
n.iter |
A |
n.adapt |
A |
thin |
A |
bth.prior |
Output of using |
rsd |
|
model |
defult "binom" |
link |
default "logit" |
om.scale |
defult is 5 |
... |
any other names arguments must match arguments names from |
A list containing model, engine, binary_data_type and model params
plan_hr(bth.model = "RE", n.chain = 3, n.iter = 6000, thin = 1, n.adapt = 1000, link = "identity", linearModel = "random", bth.prior = gemtc::mtc.hy.prior(type = "var", distr = "dlnorm",-4.18, 1 / 1.41 ^ 2))
plan_hr(bth.model = "RE", n.chain = 3, n.iter = 6000, thin = 1, n.adapt = 1000, link = "identity", linearModel = "random", bth.prior = gemtc::mtc.hy.prior(type = "var", distr = "dlnorm",-4.18, 1 / 1.41 ^ 2))
Creates a fractional polynomial model plan
plan_pwe( model.pars, bth.model = c("FE", "RE"), ref.std, nma.ref.trt, engine = "rjags", data.type = "GSD", feprior_mean = 0, feprior_prec = 1e-04, descr = "Piecewise Exponential model", descr_s = "PWE", n.chains = NULL, n.iter = NULL, n.burnin = NULL, n.thin = NULL, bth.prior = NULL, rsd = 13579, model.file = NULL, ... )
plan_pwe( model.pars, bth.model = c("FE", "RE"), ref.std, nma.ref.trt, engine = "rjags", data.type = "GSD", feprior_mean = 0, feprior_prec = 1e-04, descr = "Piecewise Exponential model", descr_s = "PWE", n.chains = NULL, n.iter = NULL, n.burnin = NULL, n.thin = NULL, bth.prior = NULL, rsd = 13579, model.file = NULL, ... )
model.pars |
A named |
bth.model |
One of "FE" or "RE" |
ref.std |
A string containing the reference study |
nma.ref.trt |
A string containing the reference treatment |
engine |
Only 'rjags' currently supported |
data.type |
Only "GSD" supported |
feprior_mean |
A |
feprior_prec |
A |
descr |
A |
descr_s |
Short description |
n.chains |
A |
n.iter |
A |
n.burnin |
A |
n.thin |
A |
bth.prior |
A |
rsd |
A |
model.file |
Path to BUGS file. If NULL file name will be built from input parameters and extracted from BUGScode folder if present |
... |
any other named arguments must match arguments names from |
A list containing model, engine, analysis and model params
model_plan <- plan_pwe(model.pars = list(cut.pts = c(3, 10)), bth.model = "FE", ref.std = "STUDY2", nma.ref.trt = "B", n.chains = 2, n.iter = 6000, n.burnin = 1000, n.thin = 1)
model_plan <- plan_pwe(model.pars = list(cut.pts = c(3, 10)), bth.model = "FE", ref.std = "STUDY2", nma.ref.trt = "B", n.chains = 2, n.iter = 6000, n.burnin = 1000, n.thin = 1)
Produce ggplot from HR values in data.frame (medians vs time for several trts, all in one plot)
plot_fp_HR( HRs, xlab = "Month", legend.pos = "right", breaks = c(0.125, 0.25, 0.5, 1, 2, 4, 8), facet = FALSE, ncol = NULL )
plot_fp_HR( HRs, xlab = "Month", legend.pos = "right", breaks = c(0.125, 0.25, 0.5, 1, 2, 4, 8), facet = FALSE, ncol = NULL )
HRs |
fig
Utility function to do forest plot from data.frame with effect estimates.
plot_mtc_forest( x, sort.by = c("name", "effect")[1], lab = NULL, do.log = TRUE, breaks = c(0.25, 0.5, 0.8, 1, 1.25, 2, 4) )
plot_mtc_forest( x, sort.by = c("name", "effect")[1], lab = NULL, do.log = TRUE, breaks = c(0.25, 0.5, 0.8, 1, 1.25, 2, 4) )
x |
A data.frame with columns: Comparator, Med, CIlo, CIup. |
sort.by |
Character string defining how estimates are sorted, either "name" (the default) or "effect". |
lab |
Label to plot underneath x-axis. |
do.log |
Logical, whether log transformed x-axis or not (default = TRUE). |
breaks |
Where to put x-axis breaks and labels. |
A ggplot2 plot object which
Transforms binary data
process_binary(data)
process_binary(data)
data |
input |
data.frame
Transforms grouped survival data
process_gsd(data)
process_gsd(data)
data |
input |
data.frame
Transforms hazard ratio data
process_hr(data)
process_hr(data)
data |
input |
data.frame
Calculate the cumulative hazard over [0, tmax] from piecewise constant model.
pwe_Hu(time, cut.pts, haz.rates)
pwe_Hu(time, cut.pts, haz.rates)
time |
Time-point at which cumulative hazard evaluated, H(time) = int_0^time h(u) du. |
cut.pts |
Vector of cut points. |
haz.rates |
Vector of hazard rates (must have one element more than the cut.pts vector). |
numeric
estimate of the hazard over [0, tmax]
Calculate the survivor function S(t) from a piecewise exponential model.
pwe_S(time, cut.pts, haz.rates)
pwe_S(time, cut.pts, haz.rates)
time |
Time-point at which survivor fct is evaluated, S(time) = exp(-H(time)). |
cut.pts |
Vector of cut points. |
haz.rates |
Vector of hazard rates (must have one element more than the cut.pts vector). |
numeric
estimate of survivor function at time t, S(t)