Skip to contents

Rank predictions at a specific time point

Usage

# S3 method for mb.predict
rank(
  x,
  time = max(x$summary[[1]]$time),
  lower_better = FALSE,
  treats = names(x$summary),
  ...
)

Arguments

x

an object of class("mb.predict") that contains predictions from an MBNMA model

time

a number indicating the time point at which predictions should be ranked. It must be one of the time points for which predictions in x are available.

lower_better

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

treats

A character vector of treatment/class names for which responses have been predicted in x As default, rankings will be calculated for all treatments/classes in x.

...

Arguments to be passed to methods

Value

Returns an object of class("mb.rank") containing ranked predictions

Examples

# \donttest{
# Create an mb.network object from a dataset
network <- mb.network(osteopain)
#> Reference treatment is `Pl_0`
#> Studies reporting change from baseline automatically identified from the data

# Run an MBNMA model with an Emax time-course
emax <- mb.run(network,
  fun=temax(pool.emax="rel", method.emax="common",
    pool.et50="abs", method.et50="common"))
#> 'et50' parameters must take positive values.
#>  Default half-normal prior restricts posterior to positive values.
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 417
#>    Unobserved stochastic nodes: 89
#>    Total graph size: 7703
#> 
#> Initializing model
#> 

# Predict responses using a stochastic baseline (E0) and a distribution for the
#network reference treatment
preds <- predict(emax, E0=7,
  ref.resp=list(emax=~rnorm(n, -0.5, 0.05)))
#> Priors required for: mu.1
#> Success: Elements in prior match consistency time-course treatment effect parameters

# Rank predictions at latest predicted time-point
rank(preds, lower_better=TRUE)
#> 
#> ========================================
#> Treatment rankings
#> ======================================== 
#> 
#> Predictions at time = 24 ranking
#> 
#> |Treatment |  Mean| Median| 2.5%| 97.5%|
#> |:---------|-----:|------:|----:|-----:|
#> |Pl_0      | 27.61|     28|   26|    28|
#> |Ce_100    | 21.82|     22|   18|    23|
#> |Ce_200    | 13.76|     14|   11|    17|
#> |Ce_400    | 10.92|     10|    7|    17|
#> |Du_90     | 20.90|     22|   11|    25|
#> |Et_10     | 26.31|     26|   24|    28|
#> |Et_30     |  6.88|      7|    4|     9|
#> |Et_5      | 26.29|     26|   24|    28|
#> |Et_60     |  2.51|      3|    2|     3|
#> |Et_90     |  2.51|      2|    2|     3|
#> |Lu_100    | 16.13|     16|   12|    20|
#> |Lu_200    | 16.85|     17|   12|    21|
#> |Lu_400    | 10.16|     10|    7|    14|
#> |Lu_NA     | 12.34|     12|    7|    21|
#> |Na_1000   |  5.11|      5|    4|     7|
#> |Na_1500   |  7.05|      7|    5|    10|
#> |Na_250    | 28.98|     29|   29|    29|
#> |Na_750    | 14.35|     14|    9|    20|
#> |Ox_44     |  6.97|      6|    4|    18|
#> |Ro_12     | 16.01|     16|   10|    22|
#> |Ro_125    |  1.00|      1|    1|     1|
#> |Ro_25     |  5.59|      5|    4|     9|
#> |Tr_100    | 25.49|     25|   24|    27|
#> |Tr_200    | 24.18|     24|   23|    26|
#> |Tr_300    | 19.84|     20|   15|    23|
#> |Tr_400    | 17.75|     18|   11|    22|
#> |Va_10     | 18.76|     20|   11|    23|
#> |Va_20     | 11.52|     11|    7|    19|
#> |Va_5      | 17.42|     18|   10|    23|
#> 
#> 


#### Rank predictions at 5 weeks follow-up ####

# First ensure responses are predicted at 5 weeks
preds <- predict(emax, E0=7,
  ref.resp=list(emax=~rnorm(n, -0.5, 0.05)),
  times=c(0,5,10))
#> Priors required for: mu.1
#> Success: Elements in prior match consistency time-course treatment effect parameters

# Rank predictions at 5 weeks follow-up
ranks <- rank(preds, lower_better=TRUE, time=5)

# Plot ranks
plot(ranks)


# }