pDcalc: Calculate plugin pD from a JAGS model with univariate...

Description Usage Arguments Details Value References Examples

View source: R/run.functions.R

Description

Uses results from MBNMA JAGS models to calculate pD via the plugin method \insertCitespiegelhalter2002MBNMAdose. Can only be used for models with known standard errors or covariance matrices (typically univariate likelihoods).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pDcalc(
  obs1,
  obs2,
  fups = NULL,
  narm,
  NS,
  theta.result,
  resdev.result,
  likelihood = "normal",
  type = "time"
)

Arguments

obs1

A matrix (study x arm) or array (study x arm x time point) containing observed data for y (normal likelihood) or r (binomial or poisson likelihood) in each arm of each study. This will be the same array used as data for the JAGS model.

obs2

A matrix (study x arm) or array (study x arm x time point) containing observed data for se (normal likelihood), N (binomial likelihood) or E (poisson likelihood) in each arm of each study. This will be the same array used as data for the JAGS model.

fups

A numeric vector of length equal to the number of studies, containing the number of follow-up mean responses reported in each study. Required for time-course MBNMA models (if type="time")

narm

A numeric vector of length equal to the number of studies, containing the number of arms in each study.

NS

A single number equal to the number of studies in the dataset.

theta.result

A matrix (study x arm) or array (study x arm x time point) containing the posterior mean predicted means/probabilities/rate in each arm of each study. This will be estimated by the JAGS model.

resdev.result

A matrix (study x arm) or array (study x arm x time point) containing the posterior mean residual deviance contributions in each arm of each study. This will be estimated by the JAGS model.

likelihood

A character object of any of the following likelihoods:

  • normal

  • binomial (does not work with time-course MBNMA models)

  • poisson (does not work with time-course MBNMA models)

type

The type of MBNMA model fitted. Can be either "time" or "dose"

Details

Method for calculating pD via the plugin method proposed by Spiegelhalter \insertCitespiegelhalter2002MBNMAdose. Standard errors / covariance matrices must be assumed to be known. To obtain values for theta.result and resdev.result these parameters must be monitored when running the MBNMA model (using parameters.to.save).

For non-linear time-course MBNMA models residual deviance contributions may be skewed, which can lead to non-sensical results when calculating pD via the plugin method. Alternative approaches are to use pV as an approximation or pD calculated by Kullback-Leibler divergence \insertCiteplummer2008MBNMAdose.

Value

A single numeric value for pD calculated via the plugin method.

References

\insertAllCited

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Using the triptans data
network <- mbnma.network(HF2PPITT)

# Fit a dose-response MBNMA, monitoring "psi" and "resdev"
result <- mbnma.run(network, fun="exponential", beta.1="rel", method="random",
              parameters.to.save=c("psi", "resdev"))


#### Calculate pD for binomial data ####

# Prepare data for pD calculation
r <- result$model$data()$r
N <- result$model$data()$N
narm <- result$model$data()$narm
NS <- result$model$data()$NS

psi <- result$BUGSoutput$median$psi
resdevs <- result$BUGSoutput$median$resdev

# Calculate pD via plugin method
pD <- pDcalc(obs1=r, obs2=N, narm=narm, NS=NS,
          theta.result=psi, resdev.result=resdevs,
          likelihood="binomial", type="dose")

MBNMAdose documentation built on Sept. 13, 2020, 5:08 p.m.