Skip to contents

Used to predict effects over time for different treatments or to predict the results of a new study. For MBNMA models that include consistency relative effects on time-course parameters, this is calculated by combining relative treatment effects with a given reference treatment response (specific to the population of interest).

Usage

# S3 method for mbnma
predict(
  object,
  times = seq(0, max(object$model.arg$jagsdata$time, na.rm = TRUE), length.out = 30),
  E0 = 0,
  treats = NULL,
  level = "treatment",
  ref.resp = NULL,
  synth = "common",
  lim = "cred",
  ...
)

Arguments

object

An S3 object of class("mbnma") generated by running a time-course MBNMA model

times

A sequence of positive numbers indicating which time points to predict mean responses for (or at which to conduct a node-split if used with mb.nodesplit())

E0

An object to indicate the value(s) to use for the response at time = 0 in the prediction. This can take a number of different formats depending on how it will be used/calculated. The default is 0 but this may lead to non-sensical predictions if Ratio of Means are modeled.

  • numeric() A single numeric value representing the deterministic response at time = 0

  • formula() A formula representing a stochastic distribution for the response at time = 0. This is specified as a random number generator (RNG) given as a string, and can take any RNG distribution for which a function exists in R. For example: ~rnorm(n, 7, 0.5).

treats

A character vector of treatment/class names or a numeric vector of treatment/class codes (as coded in mbnma) that indicates which treatments/classes to calculate predictions for. If left as NULL then predictions will be calculated for all treatments/classes. Whether the vector should correspond to treatments or classes depends on the value of level.

level

Can take either "treatment" to make predictions for treatments, or "class" to make predictions for classes (in which case object must be a class effect model).

ref.resp

An object to indicate the value(s) to use for the reference treatment response in MBNMA models in which the reference treatment response is not estimated within the model (i.e. those that model any time- course parameters using pool="rel"). This can take a number of different formats depending on how it will be used/calculated. There are two approaches for this:

  1. The reference response can be estimated from a dataset of studies investigating the reference treatment using meta-analysis. This dataset could be a set of observational studies that are specific to the population on which to make predictions, or it could be a subset of the study arms within the MBNMA dataset that investigate the reference treatment. The data should be provided to ref.resp as a data.frame() containing the data in long format (one row per observation). See ref.synth()

  2. Values for the reference treatment response can be assigned to different time-course parameters within the model that have been modelled using consistency relative effects (pool="rel"). These are given as a list, in which each named element corresponds to a time-course parameter modelled in mbnma, specified on the corresponding scale (i.e. specified on the log scale if modelled on the log scale using Ratios of Means). Their values can be either of the following:

  • numeric() A numeric value representing the deterministic value of the time-course parameter in question in individuals given the reference treatment. 0 is used as the default, which assumes no effect of time on the reference treatment (i.e. mean differences / relative effects versus the reference treatment are modeled).

  • formula() A formula representing a stochastic distribution for the value of the time-course parameter in question. This is specified as a random number generator (RNG) given as a formula, and can take any RNG distribution for which a function exists in R. For example: ~rnorm(n, -3, 0.2).

synth

A character object that can take the value "common" or "random" that specifies the the type of pooling to use for synthesis of ref.resp. Using "random" rather than "common" for synth will result in wider 95\% CrI for predictions.

lim

Specifies calculation of either 95% credible intervals (lim="cred") or 95% prediction intervals (lim="pred").

...

Arguments to be sent to R2jags for synthesis of the network reference treatment effect (using ref.synth())

Value

An S3 object of class mb.predict that contains the following elements:

  • summary A named list of data frames. Each data frame contains a summary of predicted responses at follow-up times specified in times for each treatment specified in treats

  • pred.mat 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

Details

By default the network reference treatment baseline (E0) and time-course parameter values are set to zero so that predict() estimates mean differences (/relative treatment effects) over time versus the network reference treatment.

ref.resp only needs to be specified if mbnma has been estimated using consistency relative effects (pool="rel") for any time-course parameters, as these inform the absolute values of the network reference treatment parameters which can then be added to the relative effects to calculate specific 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, times=c(0:10),
  E0=~rnorm(n, 7, 0.5),
  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
summary(preds)
#>       time     Pl_0   Ce_100   Ce_200   Ce_400    Du_90    Et_10    Et_30
#>  [1,]    0 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937
#>  [2,]    1 6.654069 6.275996 6.104299 6.040830 6.276382 6.582775 5.931677
#>  [3,]    2 6.586422 6.130572 5.923546 5.847011 6.131028 6.500485 5.715402
#>  [4,]    3 6.557222 6.067799 5.845521 5.763346 6.068283 6.464967 5.622043
#>  [5,]    4 6.540944 6.032806 5.802025 5.716706 6.033305 6.445168 5.569999
#>  [6,]    5 6.530565 6.010492 5.774291 5.686966 6.011002 6.432543 5.536814
#>  [7,]    6 6.523370 5.995024 5.755064 5.666349 5.995540 6.423792 5.513808
#>  [8,]    7 6.518089 5.983670 5.740951 5.651216 5.984191 6.417368 5.496922
#>  [9,]    8 6.514047 5.974982 5.730151 5.639635 5.975506 6.412452 5.483999
#> [10,]    9 6.510855 5.968118 5.721620 5.630487 5.968646 6.408569 5.473791
#> [11,]   10 6.508269 5.962560 5.714711 5.623079 5.963090 6.405425 5.465525
#>           Et_5    Et_60    Et_90   Lu_100   Lu_200   Lu_400    Lu_NA  Na_1000
#>  [1,] 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937
#>  [2,] 6.582101 5.542934 5.544682 6.136961 6.147721 6.026705 6.068897 5.877786
#>  [3,] 6.499679 5.246683 5.248793 5.962931 5.975891 5.829983 5.880868 5.650430
#>  [4,] 6.464104 5.118800 5.121067 5.887809 5.901717 5.745064 5.799703 5.552287
#>  [5,] 6.444273 5.047511 5.049865 5.845931 5.860368 5.697726 5.754458 5.497577
#>  [6,] 6.431629 5.002053 5.004463 5.819228 5.834001 5.667540 5.725607 5.462691
#>  [7,] 6.422864 4.970540 4.972989 5.800717 5.815723 5.646615 5.705607 5.438507
#>  [8,] 6.416430 4.947409 4.949886 5.787129 5.802307 5.631255 5.690926 5.420756
#>  [9,] 6.411506 4.929708 4.932207 5.776731 5.792040 5.619501 5.679692 5.407171
#> [10,] 6.407617 4.915726 4.918242 5.768518 5.783930 5.610216 5.670818 5.396441
#> [11,] 6.404468 4.904402 4.906932 5.761866 5.777362 5.602696 5.663631 5.387750
#>        Na_1500   Na_250   Na_750    Ox_44    Ro_12   Ro_125    Ro_25   Tr_100
#>  [1,] 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937
#>  [2,] 5.934732 6.857561 6.109581 5.898003 6.134585 5.109489 5.884169 6.529973
#>  [3,] 5.719090 6.831795 5.929916 5.674757 5.960061 4.724024 5.658113 6.436800
#>  [4,] 5.626004 6.820676 5.852362 5.578383 5.884725 4.557626 5.560531 6.396582
#>  [5,] 5.574112 6.814478 5.809128 5.524658 5.842729 4.464864 5.506132 6.374162
#>  [6,] 5.541024 6.810526 5.781560 5.490399 5.815950 4.405715 5.471445 6.359866
#>  [7,] 5.518086 6.807787 5.762450 5.466650 5.797386 4.364710 5.447399 6.349956
#>  [8,] 5.501249 6.805776 5.748422 5.449217 5.783759 4.334611 5.429748 6.342682
#>  [9,] 5.488364 6.804237 5.737687 5.435877 5.773332 4.311578 5.416241 6.337115
#> [10,] 5.478186 6.803022 5.729208 5.425339 5.765095 4.293384 5.405572 6.332718
#> [11,] 5.469944 6.802038 5.722340 5.416804 5.758424 4.278649 5.396931 6.329157
#>         Tr_200   Tr_300   Tr_400    Va_10    Va_20     Va_5
#>  [1,] 6.982937 6.982937 6.982937 6.982937 6.982937 6.982937
#>  [2,] 6.459908 6.203288 6.167036 6.190966 6.054116 6.162822
#>  [3,] 6.352314 6.042897 5.999174 6.028041 5.863029 5.994132
#>  [4,] 6.305870 5.973661 5.926713 5.957712 5.780543 5.921317
#>  [5,] 6.279980 5.935065 5.886318 5.918507 5.734560 5.880727
#>  [6,] 6.263471 5.910455 5.860560 5.893508 5.705239 5.854845
#>  [7,] 6.252026 5.893394 5.842704 5.876178 5.684913 5.836902
#>  [8,] 6.243626 5.880871 5.829597 5.863457 5.669993 5.823732
#>  [9,] 6.237197 5.871288 5.819567 5.853722 5.658575 5.813654
#> [10,] 6.232119 5.863718 5.811644 5.846033 5.649557 5.805693
#> [11,] 6.228007 5.857587 5.805228 5.839805 5.642252 5.799246

# Predict responses using the original dataset to estimate the network reference
#treatment response
paindata.ref <- osteopain[osteopain$treatname=="Placebo_0",]
preds <- predict(emax, times=c(5:15),
  E0=10,
  ref.resp=paindata.ref)
#> Data frame must contain only data from reference treatment
#> Studies reporting change from baseline automatically identified from ref.resp
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 113
#>    Unobserved stochastic nodes: 31
#>    Total graph size: 2037
#> 
#> Initializing model
#> 
summary(preds)
#>       time     Pl_0   Ce_100   Ce_200   Ce_400    Du_90    Et_10    Et_30
#>  [1,]    5 8.535464 8.015391 7.779190 7.691865 8.015901 8.437442 7.541713
#>  [2,]    6 8.512169 7.983823 7.743863 7.655148 7.984339 8.412590 7.502607
#>  [3,]    7 8.495069 7.960651 7.717932 7.628196 7.961172 8.394348 7.473902
#>  [4,]    8 8.481984 7.942918 7.698088 7.607572 7.943443 8.380389 7.451936
#>  [5,]    9 8.471648 7.928911 7.682413 7.591280 7.929439 8.369362 7.434584
#>  [6,]   10 8.463276 7.917567 7.669719 7.578086 7.918098 8.360432 7.420532
#>  [7,]   11 8.456359 7.908193 7.659228 7.567182 7.908725 8.353052 7.408919
#>  [8,]   12 8.450546 7.900316 7.650413 7.558021 7.900850 8.346851 7.399161
#>  [9,]   13 8.445593 7.893604 7.642903 7.550214 7.894139 8.341567 7.390847
#> [10,]   14 8.441323 7.887817 7.636426 7.543483 7.888353 8.337012 7.383678
#> [11,]   15 8.437603 7.882775 7.630785 7.537620 7.883313 8.333043 7.377433
#>           Et_5    Et_60    Et_90   Lu_100   Lu_200   Lu_400    Lu_NA  Na_1000
#>  [1,] 8.436528 7.006952 7.009362 7.824127 7.838900 7.672439 7.730506 7.467590
#>  [2,] 8.411662 6.959339 6.961788 7.789516 7.804522 7.635413 7.694406 7.427306
#>  [3,] 8.393410 6.924390 6.926867 7.764110 7.779287 7.608235 7.667907 7.397736
#>  [4,] 8.379443 6.897645 6.900143 7.744668 7.759977 7.587437 7.647629 7.375108
#>  [5,] 8.368410 6.876519 6.879035 7.729311 7.744723 7.571009 7.631611 7.357234
#>  [6,] 8.359475 6.859409 6.861939 7.716873 7.732369 7.557704 7.618638 7.342758
#>  [7,] 8.352091 6.845270 6.847811 7.706595 7.722160 7.546709 7.607918 7.330795
#>  [8,] 8.345887 6.833390 6.835940 7.697959 7.713582 7.537470 7.598910 7.320743
#>  [9,] 8.340600 6.823267 6.825826 7.690600 7.706273 7.529598 7.591235 7.312178
#> [10,] 8.336042 6.814538 6.817104 7.684255 7.699971 7.522810 7.584617 7.304793
#> [11,] 8.332071 6.806934 6.809507 7.678728 7.694480 7.516897 7.578852 7.298360
#>        Na_1500   Na_250   Na_750    Ox_44    Ro_12   Ro_125    Ro_25   Tr_100
#>  [1,] 7.545923 8.815425 7.786459 7.495298 7.820849 6.410613 7.476344 8.364765
#>  [2,] 7.506884 8.796585 7.751248 7.455448 7.786184 6.353509 7.436198 8.338755
#>  [3,] 7.478229 8.782756 7.725402 7.426198 7.760740 6.311592 7.406729 8.319662
#>  [4,] 7.456301 8.772174 7.705624 7.403813 7.741268 6.279515 7.384178 8.305052
#>  [5,] 7.438979 8.763815 7.690001 7.386132 7.725888 6.254177 7.366365 8.293511
#>  [6,] 7.424951 8.757045 7.677348 7.371812 7.713431 6.233656 7.351938 8.284164
#>  [7,] 7.413358 8.751450 7.666892 7.359978 7.703137 6.216698 7.340016 8.276440
#>  [8,] 7.403617 8.746750 7.658106 7.350034 7.694488 6.202449 7.329999 8.269950
#>  [9,] 7.395317 8.742744 7.650620 7.341562 7.687118 6.190308 7.321463 8.264420
#> [10,] 7.388161 8.739291 7.644165 7.334257 7.680763 6.179840 7.314103 8.259652
#> [11,] 7.381926 8.736282 7.638541 7.327892 7.675228 6.170720 7.307692 8.255498
#>         Tr_200   Tr_300   Tr_400    Va_10    Va_20     Va_5
#>  [1,] 8.268370 7.915354 7.865459 7.898407 7.710138 7.859744
#>  [2,] 8.240825 7.882193 7.831503 7.864976 7.673712 7.825701
#>  [3,] 8.220606 7.857852 7.806578 7.840437 7.646973 7.800713
#>  [4,] 8.205134 7.839225 7.787504 7.821659 7.626512 7.781591
#>  [5,] 8.192912 7.824511 7.772437 7.806826 7.610350 7.766486
#>  [6,] 8.183014 7.812595 7.760235 7.794812 7.597260 7.754253
#>  [7,] 8.174834 7.802747 7.750151 7.784885 7.586443 7.744144
#>  [8,] 8.167962 7.794473 7.741678 7.776543 7.577353 7.735650
#>  [9,] 8.162105 7.787423 7.734459 7.769436 7.569609 7.728412
#> [10,] 8.157056 7.781343 7.728234 7.763307 7.562931 7.722172
#> [11,] 8.152657 7.776048 7.722811 7.757968 7.557114 7.716735

# Repeat the above prediction but using a random effects meta-analysis of the
#network reference treatment response
preds <- predict(emax, times=c(5:15),
  E0=10,
  ref.resp=paindata.ref,
  synth="random")
#> Data frame must contain only data from reference treatment
#> Studies reporting change from baseline automatically identified from ref.resp
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 113
#>    Unobserved stochastic nodes: 61
#>    Total graph size: 2261
#> 
#> Initializing model
#> 
summary(preds)
#>       time     Pl_0   Ce_100   Ce_200   Ce_400    Du_90    Et_10    Et_30
#>  [1,]    5 8.532226 8.012154 7.775952 7.688627 8.012663 8.434204 7.538475
#>  [2,]    6 8.508869 7.980523 7.740563 7.651848 7.981039 8.409291 7.499307
#>  [3,]    7 8.491724 7.957306 7.714587 7.624851 7.957827 8.391003 7.470557
#>  [4,]    8 8.478604 7.939538 7.694708 7.604192 7.940063 8.377009 7.448556
#>  [5,]    9 8.468240 7.925503 7.679006 7.587872 7.926031 8.365954 7.431177
#>  [6,]   10 8.459846 7.914137 7.666289 7.574656 7.914667 8.357002 7.417102
#>  [7,]   11 8.452910 7.904744 7.655779 7.563734 7.905276 8.349603 7.405470
#>  [8,]   12 8.447082 7.896851 7.646949 7.554556 7.897385 8.343387 7.395697
#>  [9,]   13 8.442116 7.890126 7.639425 7.546737 7.890662 8.338090 7.387369
#> [10,]   14 8.437833 7.884328 7.632937 7.539994 7.884864 8.333522 7.380189
#> [11,]   15 8.434103 7.879276 7.627285 7.534120 7.879814 8.329544 7.373934
#>           Et_5    Et_60    Et_90   Lu_100   Lu_200   Lu_400    Lu_NA  Na_1000
#>  [1,] 8.433290 7.003714 7.006124 7.820889 7.835662 7.669201 7.727268 7.464352
#>  [2,] 8.408363 6.956039 6.958488 7.786216 7.801222 7.632114 7.691106 7.424006
#>  [3,] 8.390065 6.921045 6.923522 7.760765 7.775942 7.604890 7.664562 7.394391
#>  [4,] 8.376063 6.894265 6.896763 7.741288 7.756597 7.584057 7.644249 7.371728
#>  [5,] 8.365003 6.873111 6.875627 7.725903 7.741315 7.567601 7.628203 7.353826
#>  [6,] 8.356045 6.855979 6.858509 7.713443 7.728939 7.554273 7.615208 7.339328
#>  [7,] 8.348642 6.841821 6.844362 7.703146 7.718711 7.543260 7.604469 7.327346
#>  [8,] 8.342422 6.829925 6.832476 7.694494 7.710118 7.534005 7.595446 7.317279
#>  [9,] 8.337123 6.819789 6.822348 7.687122 7.702795 7.526120 7.587757 7.308701
#> [10,] 8.332553 6.811049 6.813615 7.680766 7.696481 7.519321 7.581128 7.301304
#> [11,] 8.328572 6.803435 6.806007 7.675228 7.690981 7.513398 7.575353 7.294861
#>        Na_1500   Na_250   Na_750    Ox_44    Ro_12   Ro_125    Ro_25   Tr_100
#>  [1,] 7.542685 8.812187 7.783222 7.492060 7.817611 6.407376 7.473106 8.361528
#>  [2,] 7.503585 8.793286 7.747949 7.452149 7.782885 6.350209 7.432898 8.335455
#>  [3,] 7.474884 8.779411 7.722057 7.422852 7.757395 6.308247 7.403384 8.316317
#>  [4,] 7.452921 8.768794 7.702244 7.400433 7.737888 6.276135 7.380798 8.301672
#>  [5,] 7.435571 8.760407 7.686593 7.382724 7.722480 6.250769 7.362957 8.290103
#>  [6,] 7.421521 8.753615 7.673918 7.368382 7.710001 6.230226 7.348508 8.280734
#>  [7,] 7.409909 8.748002 7.663443 7.356529 7.699689 6.213250 7.336567 8.272991
#>  [8,] 7.400153 8.743285 7.654641 7.346570 7.691024 6.198985 7.326534 8.266486
#>  [9,] 7.391840 8.739267 7.647142 7.338084 7.683640 6.186831 7.317985 8.260942
#> [10,] 7.384671 8.735801 7.640675 7.330767 7.677274 6.176350 7.310614 8.256162
#> [11,] 7.378427 8.732783 7.635042 7.324393 7.671728 6.167221 7.304193 8.251999
#>         Tr_200   Tr_300   Tr_400    Va_10    Va_20     Va_5
#>  [1,] 8.265132 7.912116 7.862221 7.895169 7.706900 7.856506
#>  [2,] 8.237525 7.878893 7.828203 7.861677 7.670412 7.822401
#>  [3,] 8.217261 7.854507 7.803233 7.837092 7.643628 7.797368
#>  [4,] 8.201754 7.835845 7.784124 7.818279 7.623132 7.778211
#>  [5,] 8.189505 7.821103 7.769029 7.803418 7.606942 7.763078
#>  [6,] 8.179584 7.809164 7.756805 7.791382 7.593830 7.750823
#>  [7,] 8.171386 7.799298 7.746703 7.781436 7.582994 7.740695
#>  [8,] 8.164497 7.791008 7.738214 7.773079 7.573889 7.732185
#>  [9,] 8.158628 7.783945 7.730981 7.765958 7.566131 7.724934
#> [10,] 8.153566 7.777854 7.724745 7.759818 7.559442 7.718682
#> [11,] 8.149158 7.772548 7.719312 7.754469 7.553614 7.713236
# }