Package 'BayesOrdDesign'

Title: Bayesian Group Sequential Design for Ordinal Data
Description: The proposed group-sequential trial design is based on Bayesian methods for ordinal endpoints, including three methods, the proportional-odds-model (PO)-based, non-proportional-odds-model (NPO)-based, and PO/NPO switch-model-based designs, which makes our proposed methods generic to be able to deal with various scenarios. Richard J. Barker, William A. Link (2013) <doi:10.1080/00031305.2013.791644>. Thomas A. Murray, Ying Yuan, Peter F. Thall, Joan H. Elizondo, Wayne L.Hofstetter (2018) <doi:10.1111/biom.12842>. Chengxue Zhong, Haitao Pan, Hongyu Miao (2021) <arXiv:2108.06568>.
Authors: Chengxue Zhong [aut, cre], Haitao Pan [aut], Hongyu Miao [aut]
Maintainer: Chengxue Zhong <[email protected]>
License: GPL-2
Version: 0.1.2
Built: 2024-11-18 06:30:21 UTC
Source: CRAN

Help Index


Bayesian ordinal regression analysis Estimate the correlation coefficients of treatment variable, with and without the proportional odds assumption

Description

Bayesian ordinal regression based on cumulative likelihood function Estimate the correlation coefficients of treatment variable, with or without the proportional odds assumption

Usage

Bayes_ord(formula, data, structure, U)

Arguments

formula

a formula expression as for regression models, of the form response ~ predictors. The response should be a factor (preferably an ordered factor), which will be interpreted as an ordinal response with levels ordered as in the factor.

data

a data frame in which to interpret the variables occurring in the formula.

structure

the data structure. i.e., structure = "PO" or structure = "NPO".

U

the desirability of each outcome level

Details

This function estimates the coefficients and threshold coefficients. Specifically, the numerical utilities U reflect the desirability of each outcome level. To do this, in our example, we first set U[1] = 100 and U[5] = 0, and then asked physicians to specify numerical values for the intermediate levels, that reflect their desirability relative to the best and worst levels.

Value

Bayes_ord() returns the regression coefficients, including: (1) estimator coefficients (2) thresholds coefficients

Examples

### Example One: PO data structure
fm1 = Bayes_ord(response~treatment, example.data, "PO")

### Example Two: NPO data structure
fm2 = Bayes_ord(response~treatment, example.data, "NPO", U = c(100,80,65,25,10,0))

Clinical ordinal endpoints and treatments assignment for 200 patient

Description

A dataset containing the ordinal outcomes and corresponding groups.

Usage

example.data

Format

A data frame with 200 rows and 2 variables:

response

outcome

treatment

0 denotes control, 1 denotes treatment

...


Generate operating characteristics for Bayesian two-stage trial design of ordinal endpoints without proportional odds assumption

Description

Obtain operating characteristics (OC) of the Bayesian two-stage trial design with ordinal endpoints while the proportional odds assumption are violated.

Usage

get_oc_NPO(alpha, pro_ctr, U, fixed_ss, ors, nmax, fixed_es, ntrial, method)

Arguments

alpha

the desired type I error to be controlled

pro_ctr

distribution of clinical categories for the control group

U

the desirability of each outcome level

fixed_ss

fixed sample size when simulates the OC for various effect size

ors

a user-defined matrix, each row denotes the various scenarios, the number of columns depend on the number of outcome scales.

nmax

the maximum sample size when simulates the OC for different sample size, the increment is 50 and the initial sample size is 50 for each arm each stage.

fixed_es

fixed effect size when simulate the OC for various sample size

ntrial

the number of simulated trials

method

whether the statistical test for interim/final analysis is Bayesian or Frequentist. method = "Frequentist" for Frequentist approach; method = "Bayesian" for Bayesian approach

Details

Grid search of sample size is used for guarantee a desirable type I error rate. The upper limitation is 400, and lower limitation default is sample size 50 for the control and treatment groups at each stage. Default increment of the sequence is 50.

For the parameter estimation section, we have two options, and can be selected using the method argument.Two following options are available: (i) method = "Frequentist", (ii) method = "Bayesian". If method = "Frequentist", parameters are estimated via package ordinal, which is based on frequentist method, while method = "Bayesian", parameters are estimated through Bayesian model.

Specifically, the numerical utilities U reflect the desirability of each outcome level. To do this, in our example, we first set U[1] = 100 and U[5] = 0, and then asked physicians to specify numerical values for the intermediate levels, that reflect their desirability relative to the best and worst levels.

Function provides two types of operating characteristics via simulation. If user specifies the value of ors and fixed_ss, function will calculate the design's power in terms of effect size. If user specifies the value of nmax and fixed_es, function will calculate the design's power in terms of sample size, and nmax is the upper limitation of sample size for the treatment and control groups at each stage, the lower limitation is 50, the default increment of the sequence is 10.

Please note, in our example, argument ntrial = 5 is for the time saving purpose.

Value

get_oc_NPO() returns the operating characteristics of design as a table, including (1) user-defined value, either sample size or effect size (2) corresponding power (3) average sample size

Examples

ors = matrix(c(1.5,1.5,1,1,1,1.5,1.5,1.1,1.1,1.1), nrow=2, ncol=5, byrow=TRUE)

get_oc_NPO(alpha = 0.05, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
           U = c(100,80,65,25,10,0), fixed_ss = 200, ors, ntrial = 5,
           method = "Frequentist")

set.seed(123)
get_oc_NPO(alpha = 0.05, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
           U = c(100,80,65,25,10,0), nmax = 100, fixed_es = c(1.5,1.3,1,1,1),
           ntrial = 5, method = "Frequentist")

Generate operating characteristics for Bayesian two-stage trial design of ordinal endpoints with proportional odds assumption

Description

Obtain operating characteristics (OC) of the Bayesian two-stage trial design of ordinal endpoints with proportional odds assumption.

Usage

get_oc_PO(alpha, pro_ctr, nmax, fixed_es, ormax, fixed_ss, ntrial, method)

Arguments

alpha

the desirable type I error rate to be controlled

pro_ctr

distribution of clinical categories for the control group

nmax

the maximum sample size for operating characteristics

fixed_es

fixed effect size when simulate the OC for various sample size

ormax

the maximum effect size for OC

fixed_ss

fixed sample size when simulate the OC for various effect size

ntrial

the number of simulated trials

method

whether the statistical test for interim/final analysis is Bayesian or Frequentist. method = "Frequentist" for Frequentist approach; method = "Bayesian" for Bayesian approach

Details

Grid search of sample size is used for guarantee a desirable type I error rate. The upper limitation is 200, and lower limitation default is sample size 50 for the control and treatment groups at each stage. Default increment of the sequence is 10.

For the parameter estimation section, we have two options, and can be selected using the method argument.Two following options are available: (i) method = "Frequentist", (ii) method = "Bayesian". If method = "Frequentist", parameters are estimated via package ordinal, which is based on frequentist method, while method = "Bayesian", parameters are estimated through Bayesian model.

Two types of operating characteristics can be implemented through this function.

Please note, in our example, argument ntrial = 5 is for the time saving purpose.

Value

get_oc_PO() returns the operating characteristics of design as a table, including: (1) user-defined value, either sample size or effect size (2) corresponding power (3) average sample size

Examples

get_oc_PO(alpha = 0.05, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
          ormax = 1.5, fixed_ss = 150,
          ntrial = 5, method = "Frequentist")


get_oc_PO(alpha = 0.05, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
          nmax = 200, fixed_es = 1.5,
          ntrial = 5, method = "Frequentist")

Generate operating characteristics for Bayesian two-stage trial design of ordinal endpoints without proportional odds assumption.

Description

Obtain operating characteristics (OC) of the Bayesian two-stage trial design with ordinal endpoints while the proportional odds assumption are violated.

Usage

get_oc_Switch(
  alpha,
  pro_ctr,
  U,
  ors,
  n_range,
  fixed_es,
  n_po,
  n_npo,
  ntrial,
  method
)

Arguments

alpha

the desired type I error to be controlled.

pro_ctr

distribution of clinical categories for the control group.

U

the desirability of each outcome level.

ors

a user-defined matrix, each row denotes the various scenarios, the number of columns depend on the number of outcome scales.

n_range

the additional sample size for each arm each stage after n_po, n_npo.

fixed_es

fixed effect size when simulate the OC for various sample size.

n_po

sample size for the treatment and control groups, at each stage based on PO model.

n_npo

sample size for the treatment and control groups, at each stage based on NPO model.

ntrial

the number of simulated trials.

method

whether the statistical test for interim/final analysis is Bayesian or Frequentist. method = "Frequentist" for Frequentist approach; method = "Bayesian" for Bayesian approach.

Details

Grid search of sample size is used for guarantee a desirable type I error rate. The upper limitation is 200, and lower limitation default is sample size 50 for the control and treatment groups at each stage. Default increment of the sequence is 10.

For the parameter estimation section, we have two options, and can be selected using the method argument. Two following options are available: (i) method = "Frequentist", (ii) method = "Bayesian". If method = "Frequentist", parameters are estimated via package ordinal, which is based on frequentist method, while method = "Bayesian", parameters are estimated through Bayesian model.

Specifically, the numerical utilities U reflect the desirability of each outcome level. To do this, in our example, we first set U[1] = 100 and U[5] = 0, and then asked physicians to specify numerical values for the intermediate levels, that reflect their desirability relative to the best and worst levels.

Function provides two types of operating characteristics via simulation. If user specifies the value of ors and fixed_ss, function will calculate the design's power in terms of effect size. If user specifies the value of n_range and fixed_es, function will calculate the design's power in terms of sample size, and n_range is the upper limitation of sample size for the treatment and control groups at each stage, the lower limitation is 50, the default increment of the sequence is 10.

Arguments n_po and n_npo are the estimated sample size for the treatment and control groups at each stage based on PO model and NPO model respectively. Users can obtained them through function ss_po and ss_npo.

Value

get_oc_NPO() returns the operating characteristics of design as a table, including (1) user-defined value, either sample size or effect size (2) corresponding power (3) average sample size

Examples

get_oc_Switch(alpha = 0.05, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
             U = c(100,80,65,25,10,0), n_range = 10, fixed_es = c(1.5,1.5,1,1,1),
             n_po = 475,n_npo = 75, ntrial = 5, method = "Frequentist")


or2 = matrix(rep(seq(1,1.3, by=0.1), times=1, each=3),ncol = 3,byrow = TRUE)
or1 = matrix(rep(1.5, dim(or2)[1]*2), ncol = 2, byrow = TRUE)
ors = cbind(or1, or2)

get_oc_Switch(alpha = 0.05, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
              U = c(100,80,65,25,10,0), ors, n_po = 475, n_npo = 75,
              ntrial = 5, method = "Frequentist")

Perform reversible-jump MCMC post-process to select appropriate model between proportional odds (PO) model and non-proportional odds (NPO) model

Description

Performs Bayesian multi-model inference, estimating posterior model probabilities for 2 candidate models.

Usage

rjmcmc_func(g1, ginv1, g2, ginv2, or_alt, sd, pro_ctr, n, U)

Arguments

g1

specify the bi-jections from the universal parameter psi to PO model parameter set

ginv1

specify the bi-jections from the PO model parameter set to psi. It is the inverse transformation of g1.

g2

specify the bi-jections from the universal parameter psi to NPO model parameter set

ginv2

specify the bi-jections from the NPO model parameter set to psi. It is the inverse transformation of g2.

or_alt

effect size to be detected (under H_1) in terms of odds ratio

sd

the standard error

pro_ctr

distribution of clinical categories for the control group

n

sample size for each group and each interim look

U

the desirability of each outcome level

Value

rjmcmc_func() returns the selection probabilities for PO and NPO model

Examples

g1 = function(psi){
  w = sum(psi[6:10])/5
  theta = c(psi[1], psi[2], psi[3], psi[4], psi[5],
            w, w-psi[7], w-psi[8], w-psi[9], w-psi[10])
  return(theta)
}

ginv1 = function(theta){

  w = sum(theta[6:10])
  psi = c(theta[1], theta[2], theta[3], theta[4], theta[5],
          w, theta[6]-theta[7], theta[6]-theta[8],
          theta[6]-theta[9], theta[6]-theta[10])
  return(psi)
}


g2 = function(psi){
  theta = psi
  return(theta)
}
ginv2 = function(theta){
  psi = theta
  return(psi)
}

out = rjmcmc_func(g1, ginv1, g2, ginv2, or_alt = c(1.4,1.4,1.4,1.4,1.4), sd = 0.2,
                  pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
                  n = 100, U = c(100,80,65,25,10,0))

Determine the sample size for Bayesian two-stage trial design of ordinal endpoints without proportional odds assumption

Description

Obtain estimated sample size based on user-specified type I error, power and effect size defined by the odds ratio between the treatment and control groups, without the proportional odds (PO) assumption.

Usage

ss_npo(nmax, or_alt, pro_ctr, U, alpha, power, ntrial, method)

Arguments

nmax

the maximum sample size for searching to get the desirable power

or_alt

effect size to be detected (under H_1) in terms of odds ratio

pro_ctr

distribution of clinical categories for the control group

U

the desirability of each outcome level

alpha

the desirable type I error rate to be controlled

power

the desirable power to be achieved

ntrial

the number of simulated trials

method

whether the statistical test for interim/final analysis is Bayesian or Frequentist. method = "Frequentist" for Frequentist approach; method = "Bayesian" for Bayesian approach

Details

Grid search of sample size is used for guarantee a desirable type I error rate. The upper limitation is 200, and lower limitation default is sample size 50 for the control and treatment groups at each stage. Default increment of the sequence is 50.

For the parameter estimation section, we have two options, and can be selected using the method argument.Two following options are available: (i) method = "Frequentist", (ii) method = "Bayesian". If method = "Frequentist", parameters are estimated via package ordinal, which is based on frequentist method, while method = "Bayesian", parameters are estimated through Bayesian model.

Specifically, the numerical utilities U reflect the desirability of each outcome level. To do this, in our example, we first set U[1] = 100 and U[5] = 0, and then asked physicians to specify numerical values for the intermediate levels, that reflect their desirability relative to the best and worst levels.

Please note, in our example, argument ntrial = 5 is for the time saving purpose.

Value

ss_npo() returns recommended sample size for each of two groups for the interim and final stages, by assuming 1:1 equal randomization for the two groups at each stage; and corresponding power.

Examples

set.seed(123)
ss_npo(nmax = 200, or_alt = c(1.6,1.5,1.5,1.4,1.4),
       pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13), U = c(100,80,65,25,10,0),
       alpha = 0.05, power = 0.8, ntrial = 5, method = "Frequentist")

Determine the sample size for Bayesian two-stage trial design of ordinal endpoints with proportional odds assumption

Description

Obtain estimated sample size based on user-specified type I error, power and effect size defined by the odds ratio between the treatment and control groups, under the proportional odds (PO) assumption.

Usage

ss_po(or_alt, pro_ctr, alpha, power, nmax, ntrial, method)

Arguments

or_alt

effect size to be detected (under H_1) in terms of odds ratio

pro_ctr

distribution of clinical categories for the control group

alpha

the desirable type I error rate to be controlled

power

the desirable power to be achieved

nmax

the maximum sample size for searching to get the desirable power

ntrial

the number of simulated trials

method

whether the statistical test for interim/final analysis is Bayesian or Frequentist. method = "Frequentist" for Frequentist approach; method = "Bayesian" for Bayesian approach

Details

Grid search of sample size is used for guarantee a desirable type I error rate. The upper limitation is 200, and lower limitation default is sample size 50 for the control and treatment groups at each stage. Default increment of the sequence is 50.

For the parameter estimation section, we have two options, and can be selected using the method argument.Two following options are available: (i) method = "Frequentist", (ii) method = "Bayesian". If method = "Frequentist", parameters are estimated via package ordinal, which is based on frequentist method, while method = "Bayesian", parameters are estimated through Bayesian model.

Please note, in our example, argument ntrial = 5 is for the time saving purpose.

Value

ss_po() returns recommended sample size for each of two groups for the interim and final stages, by assuming 1:1 equal randomization for the two groups at each stage; and the corresponding power.

Examples

ss_po(or_alt = 1.5, pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13), alpha = 0.05,
      power = 0.8, nmax = 100, ntrial = 5, method ="Frequentist")

Determine the sample size for Bayesian two-stage trial design for ordinal endpoints based on switch model

Description

When there lacks of sufficient information to determine which of these two models (PO or NPO) is more appropriate, PO/NPO switch model-based design is utilized to obtain estimated sample size based on user specified type I error, power and expected effect.

Usage

ss_switch(
  alpha,
  power,
  n_po,
  n_npo,
  or_alt,
  pro_ctr,
  U,
  ntrial,
  method,
  n_range
)

Arguments

alpha

the desirable type I error rate to be controlled

power

the desirable power to be achieved

n_po

sample size for the treatment and control groups, at each stage based on PO model

n_npo

sample size for the treatment and control groups, at each stage based on NPO model

or_alt

expected treatment efficacy effect size to be detected (under H_1) in terms of odds ratio

pro_ctr

distribution of clinical categories for the control group

U

the desirability of each outcome level

ntrial

the number of simulated trials

method

whether the statistical test for interim/final analysis is Bayesian or Frequentist. method = "Frequentist" for Frequentist approach; method = "Bayesian" for Bayesian approach

n_range

the additional sample size for each arm each stage after n_po, n_npo.

Details

Grid search of sample size is used for guarantee a desirable type I error rate. The upper limitation is 200, and lower limitation default is sample size 50 for the control and treatment groups at each stage. Default increment of the sequence is 10.

For the parameter estimation section, we have two options, and can be selected using the method argument.Two following options are available: (i) method = "Frequentist", (ii) method = "Bayesian". If method = "Frequentist", parameters are estimated via package ordinal, which is based on frequentist method, while method = "Bayesian", parameters are estimated through Bayesian model.

Specifically, the numerical utilities U reflect the desirability of each outcome level. To do this, in our example, we first set U[1] = 100 and U[5] = 0, and then asked physicians to specify numerical values for the intermediate levels, that reflect their desirability relative to the best and worst levels.

Arguments n_po and n_npo are the estimated sample size for the treatment and control groups at each stage based on PO model and NPO model respectively. Users can obtained them through function ss_po and ss_npo.

Value

ss_switch() returns recommended sample size for each group at every interim look, with assumption that the sample size in the control arm of the study is same as in the treatment arm, and the sample size at each interim look is same.

Examples

ss_switch(alpha = 0.05, power=0.8, n_po = 475, n_npo = 75, n_range = 10,
          or_alt = c(1.5,1.5,1.5,1.5,1.5), pro_ctr = c(0.58,0.05,0.17,0.03,0.04,0.13),
          U = c(100,80,65,25,10,0), ntrial = 5, method = "Frequentist")