Solve.beta.given.power: Function to solve for the treatment effect parameter to...

View source: R/Solve.beta.given.power.R

Solve.beta.given.powerR Documentation

Function to solve for the treatment effect parameter to achieve target power by Monte Carlo simulation.

Description

For each design scenario in params, this function solves for the treatment effect coefficient beta.trt that achieves the desired power using an iterative Monte Carlo calibration procedure. For scenarios labeled TypeI, the function sets beta.trt = 0. For scenarios labeled Power, it repeatedly simulates two-sample composites data, estimates calibration quantities (a power constant and variance) using either the generalized log-rank ("LR") or generalized-t ("GT") approach, updtaes beta.trt using find.beta.trt(), and iterates until convergence within tol.

Usage

Solve.beta.given.power(
  nsim = 1000,
  params,
  estimator,
  tol = 0.001,
  seed = NULL
)

Arguments

nsim

Integer giving the number of Monte Carlo replicates used for each iteration. Default is 1000.

params

A data frame where each rows defines a simulation/design scenario. Must include a column Type with values "TypeI" or "Power". For "Power" scenarios, the function expects the following columns: placebo.lambda_0, grp.size, recruitment, and random.censor.rate. Additional columns are carried through to the output.

estimator

Character string specifying which calibration method to use: "LR" for the generalized log-rank statistic or "GT" for the generalized-t statistic.

tol

Positive numeric value giving the convergence tolerance for the fixed-point iteration in beta.trt. The algorithm stops when abs(beta.trt.old - beta.trt.new) < tol. Default is 0.001.

seed

Seed for reproducibility.

Value

A data.frame with the same rows as params and an additional column beta.trt containing the solved treatment effect coefficient. For Type == "TypeI", beta.trt is set to 0. For Type == "Power", beta.trt is the converged solution from the Monte Carlo calibration procedure.


gsMeanFreq documentation built on Feb. 17, 2026, 1:07 a.m.