Title: | Bayesian Meta-Analysis via 'Stan' |
---|---|
Description: | Performs Bayesian meta-analysis, meta-regression and model-based meta-analysis using 'Stan'. Includes binomial-normal hierarchical models and option to use weakly informative priors for the heterogeneity parameter and the treatment effect parameter which are described in Guenhan, Roever, and Friede (2020) <doi:10.1002/jrsm.1370>. |
Authors: | Burak Kuersad Guenhan [aut, cre]
|
Maintainer: | Burak Kuersad Guenhan <[email protected]> |
License: | GPL (>=3) |
Version: | 1.0.0 |
Built: | 2025-02-23 05:06:31 UTC |
Source: | https://github.com/gunhanb/metastan |
Fitting Bayesian meta-analysis models via Rstan.
To fit meta-analysis models using frequentist methods, there are many R packages available including 'metafor'. On the other hand, Bayesian estimation methods such as Markov chain Monte Carlo (MCMC) are very attractive for meta-analysis, especially because they can be used to fit more complicated models. These include binomial-normal hierarchical models and beta-binomial models which are based on the exact distributional assumptions unlike (commonly used) normal-normal hierarchical model. Another advantage of Bayesian methods to be able to use informative prior distributions for example to regularize heterogeneity estimates in case of low number of studies. Thus, we developed 'MetaStan' which uses Stan (a modern MCMC engine) to fit several pairwise meta-analysis models including binomial-normal hierarchical model and beta-binomial model. This package is also the accompanying package of Guenhan et al (2020). Another important functionality of the package is the model-based meta-analysis models.
Burak Kuersad Guenhan <[email protected]>
Stan Development Team (2018). RStan: the R interface to Stan. R package version 2.17.3. http://mc-stan.org
Günhan, B and Röver, C and Friede, T (2020). Random-effects meta-analysis of few studies involving rare events. Research Synthesis Methods. doi = 10.1002/jrsm.1370.
Takes a vector of MBMA_stan
fits and give
the model comparison results based on LOO-IC criteria. This
is useful to compare different dose-response models. The function
depends on loo_compare
function from loo
package.
compare_MBMA(model_list, digits = 2, ...)
compare_MBMA(model_list, digits = 2, ...)
model_list |
A vector of |
digits |
An integer indicating the number of decimal places. |
... |
Further arguments passed to or from other methods. |
Vehtari, A, A Gelman, and J Gabry (Sept. 2017). "Practical Bayesian model evaluation using leave one-out cross-validation and WAIC." In: Statistics and Computing 27.5, pp. 1413–1432.
loo::loo_compare
convert_data_arm
creates a dataframe to fit a meta-analysis
model using meta_Stan
function.
convert_data_arm(nt, nc, pt, pc, pub, data = NULL)
convert_data_arm(nt, nc, pt, pc, pub, data = NULL)
nt |
Number of subjects in treatment arm |
nc |
Number of subjects in control arm |
pt |
Number of events in treatment arm |
pc |
Number of events in treatment arm |
pub |
The corresponding publication |
data |
Optional data frame containing the variables given to the arguments above. |
A dataframe object
## Create arm-based dataset data('dat.Crins2014', package = "MetaStan") dat_converted <- convert_data_arm(exp.total, cont.total, exp.AR.events, cont.AR.events, publication, data = dat.Crins2014)
## Create arm-based dataset data('dat.Crins2014', package = "MetaStan") dat_converted <- convert_data_arm(exp.total, cont.total, exp.AR.events, cont.AR.events, publication, data = dat.Crins2014)
create_MetaStan_dat
converts datasets in the one-study-per-row
format to one-arm-per-row format,
create_MetaStan_dat( dat = NULL, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = "nd" )
create_MetaStan_dat( dat = NULL, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = "nd" )
dat |
Data in one-study-per-row format. |
armVars |
Vector of per-arm variables The name of each component will be the column name in the resulting dataset. |
nArmsVar |
Variable holding the number of arms for each study. |
The resulting data.frame can be used as data argument in MBMA_stan
.
A data frame with the generated columns.
Burak Kuersad Guenhan, [email protected] and Gert van Valkenhoef
gemtc::mtc.data.studyrow
and nmaINLA::create_INLA_dat
## Not run: data('dat.Eletriptan') ## Create the dataset suitable for MBMA_stan EletriptanDat <- create_MetaStan_dat(dat = dat.Eletriptan, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = 'nd') ## Check that the data are correct print(EletriptanDat) ## End(Not run)
## Not run: data('dat.Eletriptan') ## Create the dataset suitable for MBMA_stan EletriptanDat <- create_MetaStan_dat(dat = dat.Eletriptan, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = 'nd') ## Check that the data are correct print(EletriptanDat) ## End(Not run)
A dataset containing the results from 13 trials examining the efficacy of Bacillus Calmette-Guerin (BCG) vaccine against tuberculosis (TB).
dat.Berkey1995
dat.Berkey1995
A data frame with following coloumns
Trial number
number of TB events in treatment arm
number of subjects in treatment arm
number of TB events in control arm
number of subjects in control arm
absolute latitude of the study location
author and date
Berkey, C.S., Hoaglin, D.C., Mosteller, F. and Colditz, G.A., 1995. A random-effects regression model for meta-analysis. Statistics in medicine, 14(4), pp.395-411
Numbers of patients and events (paresthesia rates) in experimental and control groups of 6 studies. It is in one-study-per-row format.
dat.Boucher2016
dat.Boucher2016
A data frame with following coloumns
dose (mg) in the first arm (placebo)
number of events in the first arm (placebo)
number of patients in the first arm (placebo)
dose (mg) in the second arm
number of events in the second arm
number of patients in the second arm
dose (mg) in the third arm
number of events in the third arm
number of patients in the third arm
dose (mg) in the fourth arm
number of events in the fourth arm
number of patients in the fourth arm
number of treatment arms
Boucher M, and Bennets M. The Many Flavors of Model-Based Meta-Analysis: Part I - Introduction and Landmark Data. CPT Pharmacometrics Syst. Pharmacol. (2016) 5, 54-64; doi:10.1002/psp4.12041
Numbers of patients and events (paresthesia rates) in experimental and control groups of 6 studies. It is in one-study-per-row format. Only the arm with 200 mg is included.
dat.Boucher2016.pairwise
dat.Boucher2016.pairwise
A data frame with following coloumns
Study ID
Durtaion of the study
number of events in the first arm (placebo)
number of patients in the first arm (placebo)
number of events in the second arm
number of patients in the second arm
Boucher M, and Bennets M. The Many Flavors of Model-Based Meta-Analysis: Part I - Introduction and Landmark Data. CPT Pharmacometrics Syst. Pharmacol. (2016) 5, 54-64; doi:10.1002/psp4.12041
Numbers of cases and events (PTLDs or deaths) in experimental and control groups of six studies.
dat.Crins2014
dat.Crins2014
A data frame with following columns
publication identifier (first author and publication year)
publication year
randomization status (y/n)
type of control group ("concurrent" or "historical")
type of comparison ("IL-2RA only", "delayed CNI", or "no/low steroids")
t follow-up time in months
number of AR events in experimental group
number of PTLD events in experimental group
number of deaths in experimental group
number of patients in experimental group
number of SRR events in experimental group
number of AR events in control group
number of SRR events in control group
number of PTLD events in control group
number of deaths in control group
number of patients in control group
number of AR events in experimental group
number of patients in control group
number of patients in experimental group
number of AR events in control group
N.D. Crins, C. Roever, A.D. Goralczyk, T. Friede. Interleukin-2 receptor antagonists for pediatric liver transplant recipients: A systematic review and meta-analysis of controlled studies. Pediatric Transplantation, 18(8):839-850, 2014.
Numbers of patients and events (headcahe free at 2 hours) in experimental and control groups of 12 studies. It is in one-study-per-row format.
dat.Eletriptan
dat.Eletriptan
A data frame with following coloumns
trial ID
dose (mg) in the first arm (placebo)
number of events in the first arm (placebo)
number of patients in the first arm (placebo)
dose (mg) in the second arm
number of events in the second arm
number of patients in the second arm
dose (mg) in the third arm
number of events in the third arm
number of patients in the third arm
dose (mg) in the fourth arm
number of events in the fourth arm
number of patients in the fourth arm
number of treatment arms
Thorlund, K., Mills, E., Wu, P., Ramos, E., Chatterjee, A., Druyts, E., and Goadsby, P. (2014). Comparative efficacy of triptans for the abortive treatment of migraine: A multiple treatment comparison meta-analysis. Cephalalgia, 34(4):258-267.
Takes a meta_stan
object which is obtained by function meta_stan
and plot
a forestplot, showing individual estimates along with their 95 percent credible intervals,
resulting effect estimate and prediction interval.
forest_plot( x = NULL, labels = NULL, digits = 2, boxsize = 0.3, heterogeneity = TRUE, col, ... )
forest_plot( x = NULL, labels = NULL, digits = 2, boxsize = 0.3, heterogeneity = TRUE, col, ... )
x |
A |
labels |
Optional vector with labels for the studies (publication author/year). |
digits |
A numerical value specifying the number of significant digits to be shown. Default is 2. |
boxsize |
A numerical value specifying the box size. Default is 0.3. |
heterogeneity |
A logical value to include heterogeneity estimates (DEFAULT = TRUE) |
col |
A function specifying the colors. See |
... |
Further arguments passed to or from other methods. |
The return value is invisible NULL
.
Christian Roever and Burak Kuersad Guenhan
This function is based foresplot
function from foresplot
R package.
foresplot::foresplot
## Not run: data('dat.Crins2014', package = "MetaStan") dat_long <- create_MetaStan_dat(dat = dat.Crins2014, armVars = c(responders = "r", sampleSize = "n")) bnhm.Crins <- meta_stan(data = dat_long, likelihood = "binomial", mu_prior = c(0, 10), theta_prior = c(0, 100), tau_prior = 0.5) forest_plot(bnhm.Crins, xlab = "log-OR", labels = dat.Crins2014$publication) ## End(Not run)
## Not run: data('dat.Crins2014', package = "MetaStan") dat_long <- create_MetaStan_dat(dat = dat.Crins2014, armVars = c(responders = "r", sampleSize = "n")) bnhm.Crins <- meta_stan(data = dat_long, likelihood = "binomial", mu_prior = c(0, 10), theta_prior = c(0, 100), tau_prior = 0.5) forest_plot(bnhm.Crins, xlab = "log-OR", labels = dat.Crins2014$publication) ## End(Not run)
'MBMA_stan' fits a model-based meta-analysis model using Stan.
MBMA_stan( data = NULL, likelihood = NULL, dose_response = "emax", mu_prior = c(0, 10), Emax_prior = c(0, 100), alpha_prior = c(0, 100), tau_prior = 0.5, tau_prior_dist = "half-normal", ED50_prior = c(-2.5, 1.8), ED50_prior_dist = "functional", gamma_prior = c(1, 2), Pred_doses, re = TRUE, ncp = TRUE, chains = 4, iter = 2000, warmup = 1000, adapt_delta = 0.95, ... )
MBMA_stan( data = NULL, likelihood = NULL, dose_response = "emax", mu_prior = c(0, 10), Emax_prior = c(0, 100), alpha_prior = c(0, 100), tau_prior = 0.5, tau_prior_dist = "half-normal", ED50_prior = c(-2.5, 1.8), ED50_prior_dist = "functional", gamma_prior = c(1, 2), Pred_doses, re = TRUE, ncp = TRUE, chains = 4, iter = 2000, warmup = 1000, adapt_delta = 0.95, ... )
data |
An object of 'create_MBMA_dat'. |
likelihood |
A string specifying the likelihood of distributions defining the statistical model. Options include "normal", "binomial", and "Poisson". |
dose_response |
A string specifying the function defining the dose-response model. Options include "linear", "log-linear", "emax", and "sigmoidal". |
mu_prior |
A numerical vector specifying the parameter of the normal prior density for baseline risks, first value is parameter for mean, second is for variance. Default is c(0, 10). |
Emax_prior |
A numerical vector specifying the parameter of the normal prior density for Emax parameter, first value is parameter for mean, second is for standard deviation. Default is c(0, 10). Needed for emax and sigmoidal models. |
alpha_prior |
A numerical vector specifying the parameter of the normal prior density for the alpha parameter, first value is parameter for mean, second is for variance. Default is c(0, 10). Needed for linear and linear log-dose models. |
tau_prior |
A numerical value specifying the standard dev. of the prior density for heterogenety stdev. Default is 0.5. |
tau_prior_dist |
A string specifying the prior density for the heterogeneity standard deviation, option is 'half-normal' for half-normal prior, 'uniform' for uniform prior, 'half-cauchy' for half-cauchy prior. |
ED50_prior |
A numerical vector specifying the parameter of the normal prior density for ED50 parameter, first value is parameter for mean, second is for standard deviation. Default is c(0, 10). Needed for emax and sigmoidal models. |
ED50_prior_dist |
A string specifying the prior density for the ED50 parameter, 'functional' is for a functional uniform prior, 'half-normal' for uniform prior, 'half-cauchy' for half-cauchy prior. |
gamma_prior |
A numerical vector specifying the parameter of the normal prior density for gamma parameter, first value is parameter for mean, second is for standard deviation. Default is c(1, 2). Needed for sigmoidal model. |
Pred_doses |
A numerical vector specifying the doses which prediction will be made. |
re |
A string specifying whether random-effects are included to the model. When 'FALSE', the model corresponds to a fixed-effects model. The default is 'TRUE'. |
ncp |
A string specifying whether to use a non-centered parametrization. The default is 'TRUE'. |
chains |
A positive integer specifying the number of Markov chains. The default is 4. |
iter |
A positive integer specifying the number of iterations for each chain (including warmup). The default is 2000. |
warmup |
A positive integer specifying the number of warmup (aka burnin) iterations per chain. The default is 1000. |
adapt_delta |
A numerical value specfying the target average proposal acceptance probability for adaptation. See Stan manual for details. Default is 0.95. In general you should not need to change adapt_delta unless you see a warning message about divergent transitions, in which case you can increase adapt_delta from the default to a value closer to 1 (e.g. from 0.95 to 0.99, or from 0.99 to 0.999, etc). |
... |
Further arguments passed to or from other methods. |
an object of class 'stanfit' returned by 'rstan::sampling'
Boucher M, et al. The many flavors of model-based meta-analysis: Part I-Introduction and landmark data. CPT: Pharmacometrics and Systems Pharmacology. 2016;5:54-64.
Guenhan BK, Roever C, Friede T. MetaStan: An R package for meta-analysis and model-based meta-analysis using Stan. In preparation.
Mawdsley D, et al. Model-based network meta-analysis: A framework for evidence synthesis of clinical trial data. CPT: Pharmacometrics and Systems Pharmacology. 2016;5:393-401.
Zhang J, et al. (2014). Network meta-analysis of randomized clinical trials: Reporting the proper summaries. Clinical Trials. 11(2), 246–262.
Dias S, et al. Absolute or relative effects? Arm-based synthesis of trial data. Research Synthesis Methods. 2016;7:23–28.
## Not run: ## Load the dataset data('dat.Eletriptan', package = "MetaStan") datMBMA = create_MetaStan_dat(dat = dat.Eletriptan, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = "nd") MBMA.Emax <- MBMA_stan(data = datMBMA, likelihood = "binomial", dose_response = "emax", Pred_doses = seq(0, 80, length.out = 11), mu_prior = c(0, 100), Emax_prior = c(0, 100), tau_prior_dist = "half-normal", tau_prior = 0.5) plot(MBMA.Emax) + ggplot2::xlab("Doses (mg)") + ggplot2::ylab("response probabilities") ## End(Not run)
## Not run: ## Load the dataset data('dat.Eletriptan', package = "MetaStan") datMBMA = create_MetaStan_dat(dat = dat.Eletriptan, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = "nd") MBMA.Emax <- MBMA_stan(data = datMBMA, likelihood = "binomial", dose_response = "emax", Pred_doses = seq(0, 80, length.out = 11), mu_prior = c(0, 100), Emax_prior = c(0, 100), tau_prior_dist = "half-normal", tau_prior = 0.5) plot(MBMA.Emax) + ggplot2::xlab("Doses (mg)") + ggplot2::ylab("response probabilities") ## End(Not run)
'meta_stan' fits a meta-analysis model using Stan.
meta_stan( data = NULL, likelihood = NULL, mu_prior = c(0, 10), theta_prior = NULL, tau_prior = 0.5, tau_prior_dist = "half-normal", beta_prior = c(0, 100), delta = NULL, param = "Smith", re = TRUE, ncp = TRUE, interval.type = "shortest", mreg = FALSE, cov = NULL, chains = 4, iter = 2000, warmup = 1000, adapt_delta = 0.95, ... )
meta_stan( data = NULL, likelihood = NULL, mu_prior = c(0, 10), theta_prior = NULL, tau_prior = 0.5, tau_prior_dist = "half-normal", beta_prior = c(0, 100), delta = NULL, param = "Smith", re = TRUE, ncp = TRUE, interval.type = "shortest", mreg = FALSE, cov = NULL, chains = 4, iter = 2000, warmup = 1000, adapt_delta = 0.95, ... )
data |
Data frame created by 'create_MetaStan_dat' |
likelihood |
A string specifying the likelihood function defining the statistical model. Options include 'normal', 'binomial', and 'Poisson'. |
mu_prior |
A numerical vector specifying the parameter of the normal prior density for baseline risks, first value is parameter for mean, second is for variance. Default is c(0, 10). |
theta_prior |
A numerical vector specifying the parameter of the normal prior density for treatment effect estimate, first value is parameter for mean, second is for variance. Default is NULL. |
tau_prior |
A numerical value specifying the standard dev. of the prior density for heterogeneity stdev. Default is 0.5. |
tau_prior_dist |
A string specifying the prior density for the heterogeneity standard deviation, option is 'half-normal' for half-normal prior, 'uniform' for uniform prior, 'half-cauchy' for half-cauchy prior. |
beta_prior |
A numerical vector specifying the parameter of the normal prior density for beta coefficients in a meta-regression model, first value is parameter for mean, second is for variance. Default is c(0, 100). |
delta |
A numerical value specifying the upper bound of the a priori interval for treatment effect on odds ratio scale (Guenhan et al (2020)). This is used to calculate a normal weakly informative prior. for theta. Thus when this argument is specified, 'theta' should be left empty. Default is NULL. |
param |
Paramteriztaion used. The default is the 'Smith' model suggested by Smith et al (1995). The alternative is 'Higgins' is the common meta-analysis model (Simmonds and Higgins, 2014). |
re |
A string specifying whether random-effects are included to the model. When 'FALSE', the model corresponds to a fixed-effects model. The default is 'TRUE'. |
ncp |
A string specifying whether to use a non-centered parametrization. The default is 'TRUE'. |
interval.type |
A string specifying the type of interval estimate. Options include shortest credible interval 'shortest' (default) and qui-tailed credible interval 'central'. |
mreg |
A string specifying whether to fit a meta-regression model. The default is 'FALSE'. |
cov |
A numeric vector or matrix specifying trial-level covariates (in each row). This is needed when 'mreg = TRUE'. |
chains |
A positive integer specifying the number of Markov chains. The default is 4. |
iter |
A positive integer specifying the number of iterations for each chain (including warmup). The default is 2000. |
warmup |
A positive integer specifying the number of warmup (aka burnin) iterations per chain. The default is 1000. |
adapt_delta |
A numerical value specifying the target average proposal acceptance probability for adaptation. See Stan manual for details. Default is 0.95. In general you should not need to change adapt_delta unless you see a warning message about divergent transitions, in which case you can increase adapt_delta from the default to a value closer to 1 (e.g. from 0.95 to 0.99, or from 0.99 to 0.999, etc). |
... |
Further arguments passed to or from other methods. |
an object of class 'MetaStan'.
Guenhan BK, Roever C, Friede T. MetaStan: An R package for meta-analysis and model-based meta-analysis using Stan. In preparation.
Guenhan BK, Roever C, Friede T. Random-effects meta-analysis of few studies involving rare events Resarch Synthesis Methods 2020; doi:10.1002/jrsm.1370.
Jackson D, Law M, Stijnen T, Viechtbauer W, White IR. A comparison of 7 random-effects models for meta-analyses that estimate the summary odds ratio. Stat Med 2018;37:1059–1085.
Kuss O. Statistical methods for meta-analyses including information from studies without any events-add nothing to nothing and succeed nevertheless, Stat Med, 2015; 4; 1097–1116, doi: 10.1002/sim.6383.
## Not run: ## TB dataset data('dat.Berkey1995', package = "MetaStan") ## Fitting a Binomial-Normal Hierarchical model using WIP priors dat_MetaStan <- create_MetaStan_dat(dat = dat.Berkey1995, armVars = c(responders = "r", sampleSize = "n")) ma.stan <- meta_stan(data = dat_MetaStan, likelihood = "binomial", mu_prior = c(0, 10), theta_prior = c(0, 100), tau_prior = 0.5, tau_prior_dist = "half-normal") print(ma.stan) forest_plot(ma.stan) meta.reg.stan <- meta_stan(data = dat_MetaStan, likelihood = "binomial", mu_prior = c(0, 10), theta_prior = c(0, 100), tau_prior = 0.5, tau_prior_dist = "half-normal", mreg = TRUE, cov = dat.Berkey1995$Latitude) print(meta.reg.stan) ## End(Not run)
## Not run: ## TB dataset data('dat.Berkey1995', package = "MetaStan") ## Fitting a Binomial-Normal Hierarchical model using WIP priors dat_MetaStan <- create_MetaStan_dat(dat = dat.Berkey1995, armVars = c(responders = "r", sampleSize = "n")) ma.stan <- meta_stan(data = dat_MetaStan, likelihood = "binomial", mu_prior = c(0, 10), theta_prior = c(0, 100), tau_prior = 0.5, tau_prior_dist = "half-normal") print(ma.stan) forest_plot(ma.stan) meta.reg.stan <- meta_stan(data = dat_MetaStan, likelihood = "binomial", mu_prior = c(0, 10), theta_prior = c(0, 100), tau_prior = 0.5, tau_prior_dist = "half-normal", mreg = TRUE, cov = dat.Berkey1995$Latitude) print(meta.reg.stan) ## End(Not run)
metastan_data
creates datasets suitable for meta_stan function
metastan_data( id, treatment, x, type = c("normal", "binomial", "poisson"), y, se, v, count, total, exposure, labels, data, sort = TRUE, checkForConflicts = TRUE )
metastan_data( id, treatment, x, type = c("normal", "binomial", "poisson"), y, se, v, count, total, exposure, labels, data, sort = TRUE, checkForConflicts = TRUE )
id |
a vector of study IDs (labels) |
treatment |
(optional) vector indicating treatment groups |
x |
(optional) covariable/regressor vector or matrix |
type |
type of outcome |
y |
estimates (for normal outcomes) |
se |
associated standard errors (normal outcomes) |
v |
variances / squared standard errors (normal outcomes) |
count |
event count (for binomial or Poisson outcomes) |
total |
sample size (for binomial outcomes) |
exposure |
exposure (for Poisson outcomes) |
labels |
(optional) vector of row labels |
data |
a data frame from which (some of) above variables may be taken |
sort |
if TRUE (the default), output rows will be sorted (keeping entries corresponding to the same study ("id") next to each other, and sorting by "treatment" and "x") |
The resulting data.frame can be used as data argument in meta_stan
.
NB: arguments "id", "treatment", "x", "y", "se", "v", "count", "total", "exposure", "labels" may be taken from local environment OR from "data" (data frame) argument.
The returned object is a "list" of class "metastan_data" containing the following elements: * "id" : study identifier (a vector of type factor) * "treatment" : (optional) a treatment identifier (a vector of type factor, or NULL) * "x" : (optional) covariable(s), (a numeric matrix, or NULL) * "type" : a flag identifying the outcome type ("normal", "binomial", or "poisson") * "outcome" : the actual outcome data (a two-column numeric matrix) * "call" : the original function call
# 3 studies, binomial endpoint, one covariable (named "dose"): msd <- metastan_data(id=c("Smith","Smith", "Taylor","Taylor", "Jones", "Jones","Taylor"), treatment=c("placebo","verum","placebo","verum", "verum","placebo","verum"), type="binomial", count=c(3, 2, 7, 5, 4, 5, 6), total=c(10, 10, 25, 27, 15, 16, 23), x=cbind("dose"=c(0, 50, 0, 50, 30, 0, 20))) msd print(msd, n=7) # (show all 7 lines of data) print.default(msd) # default view of returned object
# 3 studies, binomial endpoint, one covariable (named "dose"): msd <- metastan_data(id=c("Smith","Smith", "Taylor","Taylor", "Jones", "Jones","Taylor"), treatment=c("placebo","verum","placebo","verum", "verum","placebo","verum"), type="binomial", count=c(3, 2, 7, 5, 4, 5, 6), total=c(10, 10, 25, 27, 15, 16, 23), x=cbind("dose"=c(0, 50, 0, 50, 30, 0, 20))) msd print(msd, n=7) # (show all 7 lines of data) print.default(msd) # default view of returned object
Takes a MBMA_stan
object which is obtained by function MBMA_stan
and plot
a dose-response plot, showing observed event probabilities and the estimated dose-response
function with pointwise 95
## S3 method for class 'MBMA_stan' plot(x = MBMA.stan, ...)
## S3 method for class 'MBMA_stan' plot(x = MBMA.stan, ...)
x |
A |
... |
Further arguments passed to ggplot. |
The return value is invisible NULL
.
Christian Roever and Burak Kuersad Guenhan
This function uses ggplot
function from ggplot2
R package.
ggplot2::ggplot
## Not run: data('dat.Eletriptan', package = "MetaStan") datMBMA = create_MetaStan_dat(dat = dat.Eletriptan, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = "nd") MBMA.Emax <- MBMA_stan(data = datMBMA, likelihood = "binomial", dose_response = "emax", Pred_doses = seq(0, 80, length.out = 11), mu_prior = c(0, 100), Emax_prior = c(0, 100), tau_prior_dist = "half-normal", tau_prior = 0.5) plot(MBMA.Emax) + ggplot2::xlab("Doses (mg)") + ggplot2::ylab("response probabilities") ## End(Not run)
## Not run: data('dat.Eletriptan', package = "MetaStan") datMBMA = create_MetaStan_dat(dat = dat.Eletriptan, armVars = c(dose = "d", responders = "r", sampleSize = "n"), nArmsVar = "nd") MBMA.Emax <- MBMA_stan(data = datMBMA, likelihood = "binomial", dose_response = "emax", Pred_doses = seq(0, 80, length.out = 11), mu_prior = c(0, 100), Emax_prior = c(0, 100), tau_prior_dist = "half-normal", tau_prior = 0.5) plot(MBMA.Emax) + ggplot2::xlab("Doses (mg)") + ggplot2::ylab("response probabilities") ## End(Not run)
Takes an MBMA_stan
object which is obtained by function MBMA_stan
and print
the model and data information such as model type used in the model.
## S3 method for class 'MBMA_stan' print(x, digits = 2, ...)
## S3 method for class 'MBMA_stan' print(x, digits = 2, ...)
x |
A |
digits |
An integer indicating the number of decimal places. |
... |
Further arguments passed to or from other methods. |
The return value is invisible NULL
Takes an meta_stan
object which is obtained by function meta_stan
and print
the model and data information such as model type used in the model.
## S3 method for class 'meta_stan' print(x, digits = 2, ...)
## S3 method for class 'meta_stan' print(x, digits = 2, ...)
x |
A |
digits |
An integer indicating the number of decimal places. |
... |
Further arguments passed to or from other methods. |
The return value is invisible NULL