Learn R Programming

MBNMAdose (version 0.5.0)

rank.mbnma.predict: Rank predicted doses of different agents

Description

Ranks predictions at different doses from best to worst.

Usage

# S3 method for mbnma.predict
rank(x, lower_better = TRUE, rank.doses = NULL, ...)

Value

An object of class("mbnma.rank") which is a list containing a summary data frame, a matrix of rankings for each MCMC iteration, and a matrix of probabilities that each agent has a particular rank, for each parameter that has been ranked.

Arguments

x

An object on which to apply the rank method

lower_better

Indicates whether negative responses are better (TRUE) or positive responses are better (FALSE)

rank.doses

A list of numeric vectors. Each named element corresponds to an agent (as named/coded in predict), and each number within the vector for that element corresponds to the dose for that agent. Doses of agents specified in rank.doses must be a subset of those for which responses have been predicted in predict. If left as NULL (the default) then all doses of all agents in predict will be ranked.

...

Arguments to be passed to methods

Details

If predict contains multiple predictions at dose=0, then only the first of these will be included, to avoid duplicating rankings.

Examples

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

# Rank all predictions from a log-linear dose-response MBNMA
loglin <- mbnma.run(network, fun=dloglin())
pred <- predict(loglin, E0 = 0.5)
rank <- rank(pred)
summary(rank)

# Rank selected predictions from an Emax dose-response MBNMA
emax <- mbnma.run(network, fun=demax(), method="random")
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,
            rank.doses=list("eletriptan"=c(0,2), "rizatriptan"=2))

# Print and generate summary data frame for `mbnma.rank` object
summary(rank)
print(rank)

# Plot `mbnma.rank` object
plot(rank)
# }

Run the code above in your browser using DataLab