predict.mbnma | R Documentation |
Used to predict responses for different doses of agents or to predict the results of a new study. This is calculated by combining relative treatment effects with a given reference treatment response (specific to the population of interest).
## S3 method for class 'mbnma'
predict(
object,
n.doses = 30,
exact.doses = NULL,
E0 = 0.2,
synth = "fixed",
lim = "cred",
regress.vals = NULL,
...
)
object |
An S3 object of class |
n.doses |
A number indicating the number of doses at which to make predictions
within each agent. The default is |
exact.doses |
A list of numeric vectors. Each named element in the list corresponds to an
agent (either named similarly to agent names given in the data, or named
correspondingly to the codes for agents given in |
E0 |
An object to indicate the value(s) to use for the response at dose = 0 (i.e.
placebo) in the prediction. This can take a number of different formats depending
on how it will be used/calculated. The default is
|
synth |
A character object that can take the value |
lim |
Specifies calculation of either 95% credible intervals ( |
regress.vals |
A named numeric vector of effect modifier values at which results should
be predicted. Named elements must match variable names specified in |
... |
Arguments to be sent to |
The range of doses on which to make predictions can be specified in one of two ways:
Use max.dose
and n.doses
to specify the maximum dose for each agent and the
number of doses within that agent for which to predict responses. Doses will be chosen
that are equally spaced from zero to the maximum dose for each agent. This is useful
for generating plots of predicted responses (using [plot-mbnma.predict]
) as it will
lead to fitting a smooth dose-response curve (provided n.doses
is sufficiently high).
Use exact.doses
to specify the exact doses for which to predict responses for each
agent. This may be more useful when ranking different predicted responses using
[rank-mbnma.predict]
An S3 object of class mbnma.predict
that contains the following
elements:
predicts
A named list of
matrices. Each matrix contains the MCMC results of predicted responses at
follow-up times specified in times
for each treatment specified in
treats
likelihood
The likelihood used in the MBNMA model object
link
The link function used in the MBNMA model object
network
The dataset in mbnma.network
format
E0
A numeric vector of value(s) used for E0 in the prediction, on the
link scale.
# Using the triptans data
network <- mbnma.network(triptans)
# Run an Emax dose-response MBNMA
emax <- mbnma.run(network, fun=demax(), method="random")
###########################
###### Specifying E0 ######
###########################
#### Predict responses using deterministic value for E0 ####
# Data is binomial so we specify E0 on the natural scale as a probability
pred <- predict(emax, E0 = 0.2)
# Specifying non-sensical values will return an error
#pred <- predict(emax, E0 = -10)
### ERROR ###
#### Predict responses using stochastic value for E0 ####
# Data is binomial so we might want to draw from a beta distribution
pred <- predict(emax, E0 = "rbeta(n, shape1=1, shape2=5)")
# Misspecifying the RNG string will return an error
#pred <- predict(emax, E0 = "rbeta(shape1=1, shape2=5)")
### ERROR ###
#### Predict responses using meta-analysis of dose = 0 studies ####
# E0 is assigned a data frame of studies to synthesis
# Can be taken from placebo arms in triptans dataset
ref.df <- network$data.ab[network$data.ab$agent==1,]
# Synthesis can be fixed/random effects
pred <- predict(emax, E0 = ref.df, synth="random")
######################################################################
#### Specifying which doses/agents for which to predict responses ####
######################################################################
# Change the number of predictions for each agent
pred <- predict(emax, E0 = 0.2, n.doses=20)
pred <- predict(emax, E0 = 0.2, n.doses=3)
# Specify several exact combinations of doses and agents to predict
pred <- predict(emax, E0 = 0.2,
exact.doses=list("eletriptan"=c(0:5), "sumatriptan"=c(1,3,5)))
plot(pred) # Plot predictions
# Print and summarise `mbnma.predict` object
print(pred)
summary(pred)
# Plot `mbnma.predict` object
plot(pred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.