mtc.run {gemtc} | R Documentation |
Running an mtc.model
using an MCMC sampler
Description
The function mtc.run
is used to generate samples from a object of type mtc.model
using a MCMC sampler.
The resulting mtc.result
object can be coerced to an mcmc.list
for further analysis of the dataset using the coda
package.
Usage
mtc.run(model, sampler = NA, n.adapt = 5000, n.iter = 20000, thin = 1)
## S3 method for class 'mtc.result'
summary(object, ...)
## S3 method for class 'mtc.result'
plot(x, ...)
## S3 method for class 'mtc.result'
forest(x, use.description=FALSE, ...)
## S3 method for class 'mtc.result'
print(x, ...)
## S3 method for class 'mtc.result'
as.mcmc.list(x, ...)
Arguments
model |
An object of S3 class |
sampler |
Deprecated: gemtc now only supports the JAGS sampler. Specifying a sampler will result in a warning or error. This argument will be removed in future versions. |
n.adapt |
Amount of adaptation (or tuning) iterations. |
n.iter |
Amount of simulation iterations. |
thin |
Thinning factor. |
object |
Object of S3 class |
x |
Object of S3 class |
use.description |
Display treatment descriptions instead of treatment IDs. |
... |
Additional arguments. |
Value
An object of class mtc.result
. This is a list with the following elements:
samples |
The samples resulting from running the MCMC model, in |
model |
The |
deviance |
Residual deviance statistics, a list with the following elements. |
The object can be coerced to an mcmc.list
from the coda
package by the generic S3 method as.mcmc.list
.
Analysis of the results
Convergence of the model can be assessed using methods from the coda
package.
For example the Brooks-Gelman-Rubin method (coda::gelman.diag
, coda::gelman.plot
).
The summary
also provides useful information, such as the MCMC error and the time series and densities given by plot
should also be inspected.
The forest
function can provide forest plots for mtc.result
objects.
This is especially useful in combination with the relative.effect
function that can be used to calculate relative effects compared to any baseline for consistency models.
The rank.probability
function calculates rank probabilities for consistency models.
Author(s)
Gert van Valkenhoef, Joël Kuiper
See Also
relative.effect.table
,
relative.effect
,
rank.probability
coda::gelman.diag
,
coda::gelman.plot
Examples
model <- mtc.model(smoking)
## Not run: results <- mtc.run(model, thin=10)
results <- readRDS(system.file("extdata/luades-smoking-samples.rds", package="gemtc"))
# Convergence diagnostics
gelman.plot(results)
# Posterior summaries
summary(results)
## Iterations = 5010:25000
## Thinning interval = 10
## Number of chains = 4
## Sample size per chain = 2000
##
## 1. Empirical mean and standard deviation for each variable,
## plus standard error of the mean:
##
## Mean SD Naive SE Time-series SE
## d.A.B 0.4965 0.4081 0.004563 0.004989
## d.A.C 0.8359 0.2433 0.002720 0.003147
## d.A.D 1.1088 0.4355 0.004869 0.005280
## sd.d 0.8465 0.1913 0.002139 0.002965
##
## 2. Quantiles for each variable:
##
## 2.5% 25% 50% 75% 97.5%
## d.A.B -0.2985 0.2312 0.4910 0.7530 1.341
## d.A.C 0.3878 0.6720 0.8273 0.9867 1.353
## d.A.D 0.2692 0.8197 1.0983 1.3824 2.006
## sd.d 0.5509 0.7119 0.8180 0.9542 1.283
plot(results) # Shows time-series and density plots of the samples
forest(results) # Shows a forest plot