View source: R/relative.effect.table.R
relative.effect.table | R Documentation |
Generates a table of the relative effects of all pairs of treatments. Unlike relative.effect
, this method stores summaries only, not raw samples.
relative.effect.table(result, covariate=NA)
## S3 method for class 'mtc.relative.effect.table'
print(x, ...)
## S3 method for class 'mtc.relative.effect.table'
forest(x, t1, use.description=FALSE, ...)
## S3 method for class 'mtc.relative.effect.table'
as.data.frame(x, ...)
result |
An object of S3 class |
covariate |
(Regression analyses only) Value of the covariate at which to compute relative effects. |
x |
An object of S3 class |
t1 |
Baseline treatment for the Forest plot. |
use.description |
Display treatment descriptions instead of treatment IDs. |
... |
Additional arguments. |
Returns an mtc.relative.effect.table
object containing the quantiles of the calculated relative effects of all pair-wise comparisons among the treatments.
The result will be pretty printed as an n-by-n table of relative treatment effects.
It can also be used to produce Forest plots against any arbitrary baseline.
Finally, the as.data.frame
generic method makes it possible to export the table for use in Excel or other spreadsheet software, using the core R methods write.csv
or write.csv2
.
Gert van Valkenhoef
relative.effect
model <- mtc.model(smoking)
# To save computation time we load the samples instead of running the model
## Not run: results <- mtc.run(model)
results <- readRDS(system.file("extdata/luades-smoking-samples.rds", package="gemtc"))
# Creates a forest plot of the relative effects
tbl <- relative.effect.table(results)
# Print the n*n table
print(tbl)
# Plot effect relative to treatment "C"
forest(tbl, "C")
# Write to CSV (e.g. to import to Excel, then use in a Word table)
## Not run: write.csv(tbl, "smoking-effects.csv")
# Note: use write.csv2 for Western European locales
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.