Skip to contents

This function performs analysis of continuous data using the power prior approach. The method allows for incorporating historical data by accounting for its likelihood with a power argument (weight parameter) to control the degree of borrowing.

Usage

powerprior_cont(
  data,
  arm,
  alpha = 0.025,
  a_0 = 0.9,
  opt = 2,
  check = TRUE,
  ...
)

Arguments

data

Data frame with trial data, e.g. result from the datasim_cont() function. Must contain columns named 'treatment', 'response' and 'period'.

arm

Integer. Index of the treatment arm under study to perform inference on (vector of length 1). This arm is compared to the control group.

alpha

Double. Decision boundary (one-sided). Default=0.025

a_0

Double. Power argument used for down-weighting the likelihood of the historical datasets (0 < a_0 < 1). Default=0.9.

opt

Integer (1 or 2). If opt==1, all former periods are used as one historical dataset; if opt==2, periods are treated as separate historical datasets. Default=2.

check

Logical. Indicates whether the input parameters should be checked by the function. Default=TRUE, unless the function is called by a simulation function, where the default is FALSE.

...

Further arguments passed by wrapper functions when running simulations.

Value

List containing the following elements regarding the results of comparing arm to control:

  • p-val - posterior probability that the difference in means is less than zero

  • treat_effect - posterior mean of difference in means

  • lower_ci - lower limit of the (1-2*alpha)*100% credible interval for difference in means

  • upper_ci - upper limit of the (1-2*alpha)*100% credible interval for difference in means

  • reject_h0 - indicator of whether the null hypothesis was rejected or not (p_val < alpha)

Author

Pavla Krotka

Examples


trial_data <- datasim_cont(num_arms = 3, n_arm = 100, d = c(0, 100, 250),
theta = rep(0.25, 3), lambda = rep(0.15, 4), sigma = 1, trend = "stepwise")

powerprior_cont(data = trial_data, arm = 3)
#> $p_val
#> [1] 0.00095
#> 
#> $treat_effect
#> [1] 0.4030118
#> 
#> $lower_ci
#> [1] 0.152513
#> 
#> $upper_ci
#> [1] 0.6516613
#> 
#> $reject_h0
#> [1] TRUE
#>