eventsNeeded {agpower}R Documentation

Number of events needed

Description

Function to compute number of events (L) needed to achieve power (pow) at one-sided Type I control level alpha/2 (alp/2).

Usage

eventsNeeded(bta1, thta, tau, lam0, alp = 0.05, pow = 0.8, ar = 0.5)

Arguments

bta1

log-transform of rate ratio.

thta

Variance of frailty parameter.

tau

Expected follow-up time.

lam0

Baseline rate for control.

alp

Two-sided alpha-level.

pow

Target power.

ar

Allocation ratio (Number control / Total)

Details

Assumes rate ratio < 1 is favourable to treatment.

Value

The number of events (L) needed.

Examples


eventsNeeded(bta1 = log(0.8), thta = 1, tau = 0.8, lam0 = 3.5, alp = 0.05, pow = 0.8)

if (require("dplyr") & require("tidyr")) {

  assumptions = tibble(alp = 0.05) %>%
    crossing(
      tau = c(0.8,0.9, 1.0),
      RR = c(0.6, 0.7, 0.8),
      lam0 = c(3, 3.5),
      thta = c(2, 3, 4),
      pow = 0.8
    ) %>%
    mutate(
      L = eventsNeeded(bta1 = log(RR), thta = thta, tau = tau,
                       lam0 = lam0, alp = alp, pow = pow)
    )

  assumptions %>% data.frame()

}


[Package agpower version 0.1.2 Index]