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.984807 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807
#>  [2,]    1 6.655136 6.276957 6.105393 6.042534 6.276892 6.579927 5.932888
#>  [3,]    2 6.587340 6.131375 5.924533 5.848728 6.131314 6.496675 5.716548
#>  [4,]    3 6.558078 6.068536 5.846468 5.765073 6.068478 6.460742 5.623168
#>  [5,]    4 6.541766 6.033507 5.802951 5.718439 6.033452 6.440712 5.571114
#>  [6,]    5 6.531365 6.011171 5.775203 5.688704 6.011117 6.427940 5.537923
#>  [7,]    6 6.524155 5.995687 5.755968 5.668091 5.995635 6.419087 5.514914
#>  [8,]    7 6.518863 5.984322 5.741849 5.652960 5.984270 6.412588 5.498025
#>  [9,]    8 6.514813 5.975625 5.731044 5.641382 5.975574 6.407615 5.485100
#> [10,]    9 6.511613 5.968754 5.722509 5.632236 5.968704 6.403687 5.474891
#> [11,]   10 6.509023 5.963191 5.715597 5.624829 5.963141 6.400505 5.466623
#>           Et_5    Et_60    Et_90   Lu_100   Lu_200   Lu_400    Lu_NA  Na_1000
#>  [1,] 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807
#>  [2,] 6.579991 5.544040 5.542247 6.137838 6.147685 6.027365 6.069255 5.879238
#>  [3,] 6.496747 5.247711 5.245544 5.963648 5.975535 5.830468 5.880960 5.651855
#>  [4,] 6.460817 5.119803 5.117474 5.888461 5.901230 5.745481 5.799685 5.553707
#>  [5,] 6.440789 5.048501 5.046082 5.846548 5.859810 5.698106 5.754380 5.498995
#>  [6,] 6.428018 5.003036 5.000559 5.819823 5.833399 5.667898 5.725491 5.464108
#>  [7,] 6.419165 4.971519 4.969002 5.801297 5.815090 5.646958 5.705465 5.439924
#>  [8,] 6.412667 4.948385 4.945838 5.787698 5.801652 5.631587 5.690765 5.422172
#>  [9,] 6.407694 4.930681 4.928112 5.777292 5.791368 5.619824 5.679516 5.408588
#> [10,] 6.403766 4.916697 4.914110 5.769072 5.783244 5.610533 5.670630 5.397858
#> [11,] 6.400585 4.905372 4.902770 5.762415 5.776665 5.603008 5.663434 5.389167
#>        Na_1500   Na_250   Na_750    Ox_44    Ro_12   Ro_125    Ro_25   Tr_100
#>  [1,] 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807
#>  [2,] 5.936443 6.860463 6.111341 5.900197 6.136701 5.107231 5.886408 6.530741
#>  [3,] 5.720829 6.834911 5.931700 5.677131 5.962291 4.721054 5.660509 6.437366
#>  [4,] 5.627761 6.823884 5.854160 5.580848 5.887010 4.554362 5.563003 6.397063
#>  [5,] 5.575881 6.817737 5.810936 5.527176 5.845046 4.461440 5.508649 6.374597
#>  [6,] 5.542801 6.813818 5.783375 5.492952 5.818289 4.402190 5.473990 6.360271
#>  [7,] 5.519868 6.811101 5.764269 5.469228 5.799740 4.361116 5.449965 6.350341
#>  [8,] 5.503036 6.809107 5.750245 5.451814 5.786124 4.330966 5.432329 6.343052
#>  [9,] 5.490154 6.807582 5.739513 5.438488 5.775705 4.307895 5.418834 6.337474
#> [10,] 5.479979 6.806376 5.731036 5.427961 5.767475 4.289670 5.408174 6.333067
#> [11,] 5.471739 6.805400 5.724170 5.419436 5.760810 4.274911 5.399540 6.329499
#>         Tr_200   Tr_300   Tr_400    Va_10    Va_20     Va_5
#>  [1,] 6.984807 6.984807 6.984807 6.984807 6.984807 6.984807
#>  [2,] 6.459840 6.204371 6.166443 6.189741 6.052276 6.163569
#>  [3,] 6.351885 6.043863 5.998152 6.026227 5.860494 5.994665
#>  [4,] 6.305289 5.974581 5.925513 5.955649 5.777714 5.921759
#>  [5,] 6.279315 5.935961 5.885021 5.916306 5.731570 5.881118
#>  [6,] 6.262753 5.911335 5.859202 5.891220 5.702146 5.855204
#>  [7,] 6.251272 5.894264 5.841304 5.873829 5.681749 5.837240
#>  [8,] 6.242845 5.881733 5.828167 5.861064 5.666777 5.824054
#>  [9,] 6.236396 5.872144 5.818113 5.851296 5.655320 5.813963
#> [10,] 6.231302 5.864570 5.810172 5.843580 5.646270 5.805992
#> [11,] 6.227176 5.858436 5.803741 5.837331 5.638941 5.799537

# 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.534425 8.014230 7.778263 7.691764 8.014177 8.431000 7.540982
#>  [2,]    6 8.511121 7.982653 7.742933 7.655057 7.982600 8.406052 7.501879
#>  [3,]    7 8.494015 7.959474 7.717001 7.628113 7.959423 8.387740 7.473177
#>  [4,]    8 8.480925 7.941737 7.697156 7.607494 7.941686 8.373727 7.451213
#>  [5,]    9 8.470585 7.927726 7.681481 7.591208 7.927676 8.362658 7.433863
#>  [6,]   10 8.462211 7.916379 7.668786 7.578017 7.916330 8.353694 7.419812
#>  [7,]   11 8.455291 7.907002 7.658295 7.567117 7.906953 8.346286 7.408200
#>  [8,]   12 8.449476 7.899123 7.649480 7.557958 7.899074 8.340061 7.398444
#>  [9,]   13 8.444522 7.892410 7.641969 7.550154 7.892361 8.334757 7.390130
#> [10,]   14 8.440250 7.886621 7.635492 7.543425 7.886573 8.330184 7.382962
#> [11,]   15 8.436529 7.881578 7.629850 7.537563 7.881530 8.326200 7.376718
#>           Et_5    Et_60    Et_90   Lu_100   Lu_200   Lu_400    Lu_NA  Na_1000
#>  [1,] 8.431078 7.006096 7.003619 7.822883 7.836458 7.670958 7.728550 7.467168
#>  [2,] 8.406131 6.958485 6.955967 7.788263 7.802056 7.633923 7.692430 7.426890
#>  [3,] 8.387819 6.923537 6.920990 7.762851 7.776804 7.606739 7.665917 7.397325
#>  [4,] 8.373807 6.896794 6.894224 7.743404 7.757480 7.585937 7.645628 7.374700
#>  [5,] 8.362738 6.875669 6.873082 7.728044 7.742216 7.569505 7.629602 7.356829
#>  [6,] 8.353774 6.858560 6.855959 7.715603 7.729854 7.556197 7.616623 7.342356
#>  [7,] 8.346366 6.844422 6.841809 7.705323 7.719638 7.545200 7.605897 7.330395
#>  [8,] 8.340141 6.832543 6.829919 7.696685 7.711055 7.535959 7.596885 7.320345
#>  [9,] 8.334838 6.822420 6.819788 7.689324 7.703741 7.528085 7.589205 7.311782
#> [10,] 8.330265 6.813692 6.811053 7.682978 7.697434 7.521296 7.582584 7.304399
#> [11,] 8.326281 6.806089 6.803443 7.677449 7.691940 7.515382 7.576816 7.297967
#>        Na_1500   Na_250   Na_750    Ox_44    Ro_12   Ro_125    Ro_25   Tr_100
#>  [1,] 7.545860 8.816878 7.786435 7.496012 7.821348 6.405249 7.477050 8.363331
#>  [2,] 7.506834 8.798067 7.751235 7.456194 7.786705 6.348081 7.436930 8.337306
#>  [3,] 7.478188 8.784260 7.725397 7.426966 7.761277 6.306119 7.407482 8.318204
#>  [4,] 7.456267 8.773694 7.705625 7.404600 7.741818 6.274007 7.384946 8.303586
#>  [5,] 7.438951 8.765348 7.690007 7.386933 7.726447 6.248642 7.367145 8.292039
#>  [6,] 7.424928 8.758589 7.677359 7.372625 7.713998 6.228099 7.352729 8.282688
#>  [7,] 7.413339 8.753003 7.666906 7.360801 7.703711 6.211123 7.340815 8.274960
#>  [8,] 7.403601 8.748310 7.658123 7.350866 7.695067 6.196859 7.330805 8.268466
#>  [9,] 7.395304 8.744311 7.650640 7.342400 7.687702 6.184705 7.322275 8.262934
#> [10,] 7.388150 8.740862 7.644187 7.335101 7.681352 6.174225 7.314921 8.258163
#> [11,] 7.381918 8.737859 7.638566 7.328742 7.675820 6.165096 7.308514 8.254007
#>         Tr_200   Tr_300   Tr_400    Va_10    Va_20     Va_5
#>  [1,] 8.265813 7.914395 7.862262 7.894279 7.705206 7.858264
#>  [2,] 8.238238 7.881230 7.828270 7.860795 7.668715 7.824205
#>  [3,] 8.217997 7.856886 7.803319 7.836216 7.641930 7.799206
#>  [4,] 8.202508 7.838257 7.784226 7.817408 7.621433 7.780075
#>  [5,] 8.190274 7.823542 7.769144 7.802551 7.605242 7.764964
#>  [6,] 8.180365 7.811624 7.756929 7.790519 7.592129 7.752726
#>  [7,] 8.172177 7.801776 7.746835 7.780576 7.581293 7.742612
#>  [8,] 8.165296 7.793501 7.738354 7.772221 7.572189 7.734114
#>  [9,] 8.159434 7.786450 7.731127 7.765102 7.564431 7.726873
#> [10,] 8.154379 7.780370 7.724896 7.758964 7.557741 7.720630
#> [11,] 8.149976 7.775074 7.719468 7.753617 7.551914 7.715191

# 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.527357 8.007163 7.771195 7.684696 8.007109 8.423932 7.533915
#>  [2,]    6 8.503954 7.975487 7.735767 7.647891 7.975434 8.398886 7.494713
#>  [3,]    7 8.486777 7.952236 7.709763 7.620875 7.952185 8.380502 7.465939
#>  [4,]    8 8.473632 7.934444 7.689863 7.600201 7.934393 8.366434 7.443920
#>  [5,]    9 8.463249 7.920390 7.674144 7.583871 7.920340 8.355322 7.426527
#>  [6,]   10 8.454840 7.909008 7.661414 7.570646 7.908958 8.346322 7.412440
#>  [7,]   11 8.447891 7.899602 7.650894 7.559717 7.899553 8.338885 7.400800
#>  [8,]   12 8.442052 7.891698 7.642055 7.550533 7.891650 8.332636 7.391019
#>  [9,]   13 8.437077 7.884964 7.634523 7.542709 7.884916 8.327312 7.382685
#> [10,]   14 8.432787 7.879158 7.628029 7.535962 7.879110 8.322721 7.375499
#> [11,]   15 8.429050 7.874100 7.622372 7.530085 7.874052 8.318722 7.369239
#>           Et_5    Et_60    Et_90   Lu_100   Lu_200   Lu_400    Lu_NA  Na_1000
#>  [1,] 8.424010 6.999028 6.996551 7.815815 7.829391 7.663890 7.721483 7.460100
#>  [2,] 8.398965 6.951319 6.948801 7.781097 7.794890 7.626757 7.685264 7.419724
#>  [3,] 8.380581 6.916299 6.913752 7.755613 7.769566 7.599501 7.658679 7.390087
#>  [4,] 8.366514 6.889501 6.886931 7.736111 7.750187 7.578644 7.638335 7.367407
#>  [5,] 8.355402 6.868332 6.865745 7.720707 7.734880 7.562168 7.622266 7.349493
#>  [6,] 8.346402 6.851189 6.848587 7.708232 7.722482 7.548825 7.609251 7.334984
#>  [7,] 8.338965 6.837022 6.834408 7.697922 7.712238 7.537799 7.598496 7.322995
#>  [8,] 8.332717 6.825118 6.822494 7.689260 7.703630 7.528534 7.589460 7.312921
#>  [9,] 8.327392 6.814975 6.812343 7.681879 7.696295 7.520640 7.581760 7.304337
#> [10,] 8.322801 6.806229 6.803590 7.675515 7.689971 7.513833 7.575121 7.296935
#> [11,] 8.318802 6.798611 6.795965 7.669971 7.684462 7.507904 7.569337 7.290488
#>        Na_1500   Na_250   Na_750    Ox_44    Ro_12   Ro_125    Ro_25   Tr_100
#>  [1,] 7.538792 8.809810 7.779367 7.488944 7.814280 6.398182 7.469982 8.356263
#>  [2,] 7.499668 8.790901 7.744069 7.449028 7.779539 6.340915 7.429764 8.330140
#>  [3,] 7.470950 8.777022 7.718159 7.419728 7.754038 6.298881 7.400243 8.310966
#>  [4,] 7.448974 8.766401 7.698332 7.397307 7.734524 6.266714 7.377653 8.296293
#>  [5,] 7.431615 8.758011 7.682671 7.379596 7.719110 6.241305 7.359809 8.284703
#>  [6,] 7.417556 8.751217 7.669987 7.365253 7.706627 6.220728 7.345357 8.275316
#>  [7,] 7.405938 8.745603 7.659506 7.353400 7.696311 6.203723 7.333415 8.267559
#>  [8,] 7.396177 8.740885 7.650698 7.343441 7.687643 6.189434 7.323380 8.261042
#>  [9,] 7.387859 8.736865 7.643194 7.334955 7.680257 6.177259 7.314830 8.255488
#> [10,] 7.380687 8.733399 7.636724 7.327638 7.673889 6.166762 7.307458 8.250700
#> [11,] 7.374439 8.730380 7.631087 7.321263 7.668341 6.157617 7.301035 8.246528
#>         Tr_200   Tr_300   Tr_400    Va_10    Va_20     Va_5
#>  [1,] 8.258745 7.907327 7.855194 7.887211 7.698138 7.851196
#>  [2,] 8.231072 7.874063 7.821104 7.853629 7.661549 7.817039
#>  [3,] 8.210759 7.849648 7.796081 7.828978 7.634692 7.791968
#>  [4,] 8.195215 7.830964 7.776933 7.810115 7.614139 7.772782
#>  [5,] 8.182937 7.816205 7.761807 7.795215 7.597905 7.757627
#>  [6,] 8.172993 7.804253 7.749558 7.783148 7.584758 7.745354
#>  [7,] 8.164776 7.794375 7.739435 7.773176 7.573893 7.735211
#>  [8,] 8.157872 7.786076 7.730929 7.764797 7.564764 7.726689
#>  [9,] 8.151989 7.779005 7.723682 7.757657 7.556985 7.719428
#> [10,] 8.146916 7.772907 7.717433 7.751501 7.550278 7.713167
#> [11,] 8.142497 7.767595 7.711989 7.746138 7.544435 7.707712
# }