Skip to contents

This function calculates the cumulative distribution function (CDF) of the difference between two independent t-distributed random variables using the Integrated Nested Laplace Approximation (INLA) with power prior for external data. Specifically, it computes P(T1 - T2 > q) where T1 and T2 follow t-distributions estimated from current and external data.

Usage

pINLAdifft(
  nINLAsample,
  q,
  mu.n1,
  mu.n2,
  sd.n1,
  sd.n2,
  n1,
  n2,
  ne1,
  ne2,
  alpha01,
  alpha02
)

Arguments

nINLAsample

A positive integer representing the number of iterations for INLA sampling.

q

A numeric value representing the quantile threshold.

mu.n1

A numeric value representing the mean value of normal distribution for group 1 in PoC and external trials.

mu.n2

A numeric value representing the mean value of normal distribution for group 2 in PoC and external trials.

sd.n1

A positive numeric value representing the standard deviation of normal distribution for group 1 in PoC and external trials.

sd.n2

A positive numeric value representing the standard deviation of normal distribution for group 2 in PoC and external trials.

n1

A positive integer representing the sample size for group 1 in PoC trial.

n2

A positive integer representing the sample size for group 2 in PoC trial.

ne1

A positive integer representing the sample size for group 1 in external trial (can be NULL if no external treatment data).

ne2

A positive integer representing the sample size for group 2 in external trial (can be NULL if no external control data).

alpha01

A positive numeric value representing the scale parameter of the power prior for group 1 (can be NULL if no external treatment data).

alpha02

A positive numeric value representing the scale parameter of the power prior for group 2 (can be NULL if no external control data).

Value

A numeric value representing P(T1 - T2 > q), the probability that the difference between the two t-distributed variables exceeds the quantile q.

Details

This function uses the Integrated Nested Laplace Approximation (INLA) to estimate posterior distributions when external data are available. The method involves:

  • Incorporating external data through power priors with scaling parameters α01 and α02

  • Using INLA for fast approximate Bayesian inference

  • Generating posterior samples to compute the probability of interest

  • Supporting flexible combinations of external treatment and/or control data

The power prior approach allows borrowing strength from historical data while controlling the degree of borrowing through the power parameters. INLA provides computationally efficient approximations compared to full MCMC approaches.

Examples

if (FALSE) { # \dontrun{
# Both external treatment and control data
pINLAdifft(nINLAsample = 1e+4, q = 4, mu.n1 = 5, mu.n2 = 0, sd.n1 = 1, sd.n2 = 1,
          n1 = 12, n2 = 12, ne1 = 24, ne2 = 24, alpha01 = 0.5, alpha02 = 0.5)

# External control data only
pINLAdifft(nINLAsample = 1e+4, q = 4, mu.n1 = 5, mu.n2 = 0, sd.n1 = 1, sd.n2 = 1,
          n1 = 12, n2 = 12, ne1 = NULL, ne2 = 24, alpha01 = NULL, alpha02 = 0.5)
} # }