post.infer: Posterior Inference for Simulated Basket Trial Data

View source: R/post.infer.R

post.inferR Documentation

Posterior Inference for Simulated Basket Trial Data

Description

It generates posterior probabilities P(p_j > pnull) after all interim analysis and calculates rates for early stopping, number of patients and estimated ORR.

Usage

post.infer(
  object,
  pnull,
  stopbounds = NULL,
  clusterk = NULL,
  nperclust = NULL,
  beta.a0 = pnull,
  beta.b0 = 1 - pnull,
  seed = 987897,
  ModelFit,
  ...
)

Arguments

object

returned from generate.data.

pnull

B by 1 vector of null response rates, where B is the number of baskets.

stopbounds

B by (stage-1) matrix: stopping boundaries for each basket at each interim.

clusterk

only needed for parallel computing.

nperclust

only needed for parallel computing.

beta.a0

a vector of length B for beta prior parameter a0 in each basket.

beta.b0

a vector of length B for beta prior parameter b0 in each basket.

seed

random seed for reproducibility.

ModelFit

the method function, e.g., localPP, JSD, and other user defined methods.

...

additional arguments passed to the method function defined by ModelFit.

Value

It returns a list including data, N, and ORRs, where data is an array with dim=c(nS, ntrial, B, stage).

Examples

N <- rbind(
c(10, 25),
c(10, 25),
c(10, 25)) # interim sample size and total sample size for each indication
scenarios <- rbind( c(0.15, 0.15, 0.15), c(0.3, 0.3, 0.3) )
res <- generate.data(N = N, ORRs = scenarios, ntrial = 20, seed = 2024)
post <- post.infer(res, pnull = rep(0.15,3), stopbounds = cbind(c(1,1,1)),
ModelFit = "localPP", method = "PEB")
apply(post$earlystop, c(1,3), mean) # early stopping for each basket in each scenario
apply(post$npts, c(1,3), mean) # average number of pts for each basket in each scenario
apply(post$est, c(1,3), mean) # average ORR estimate for each basket in each scenario

BasketTrial documentation built on June 18, 2025, 5:08 p.m.