Learn R Programming

MBNMAdose (version 0.4.3)

plot.mbnma.rank: Plot histograms of rankings from MBNMA models

Description

Plot histograms of rankings from MBNMA models

Usage

# S3 method for mbnma.rank
plot(x, params = NULL, treat.labs = NULL, ...)

Value

A series of histograms that show rankings for each treatment/agent/prediction, with a separate panel for each parameter. The object returned is a list containing a separate element for each parameter in params

which is an object of class(c("gg", "ggplot")).

Arguments

x

An object of class "mbnma.rank" generated by rank.mbnma()

params

A character vector of named parameters in the model that vary by either agent or class (depending on the value assigned to level). If left as NULL (the default), then ranking will be calculated for all available parameters that vary by agent/class.

treat.labs

A vector of treatment labels in the same order as treatment codes. Easiest to use treatment labels stored by mbnma.network()

...

Arguments to be sent to ggplot::geom_bar()

Examples

Run this code
# \donttest{
# Using the triptans data
network <- mbnma.network(triptans)

# Estimate rankings  from an Emax dose-response MBNMA
emax <- mbnma.run(network, fun=demax(), method="random")
ranks <- rank(emax)

# Plot rankings for both dose-response parameters (in two separate plots)
plot(ranks)

# Plot rankings just for ED50
plot(ranks, params="ed50")

# Plot rankings from prediction
doses <- list("eletriptan"=c(0,1,2,3), "rizatriptan"=c(0.5,1,2))
pred <- predict(emax, E0 = "rbeta(n, shape1=1, shape2=5)",
            exact.doses=doses)
rank <- rank(pred)
plot(rank)


# Trying to plot a parameter that has not been ranked will return an error
#### ERROR ####
# plot(ranks, params="not.a.parameter")
# }

Run the code above in your browser using DataLab