rank.mb.predict: Rank predictions at a specific time point

View source: R/mb.predict-class.R

rank.mb.predictR Documentation

Rank predictions at a specific time point

Description

Rank predictions at a specific time point

Usage

## S3 method for class '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


# Create an mb.network object from a dataset
network <- mb.network(osteopain)

# 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"))

# 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)))

# Rank predictions at latest predicted time-point
rank(preds, lower_better=TRUE)


#### 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))

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

# Plot ranks
plot(ranks)



MBNMAtime documentation built on Oct. 14, 2023, 5:08 p.m.