btaNeeded3 {agpower} | R Documentation |
Function to compute log rate ratio needed
Description
Function to compute log rate ratio needed to achieve target power at one-sided Type I control level alp/2. Useful to compute critical value (set pow = 0.5).
Usage
btaNeeded3(
thta,
L,
tau,
lam,
alp = 0.05,
pow = 0.8,
ar = 0.5,
frailty.type = c("unblind", "blind"),
lam.type = c("base", "pool"),
interval = c(log(0.5), log(1))
)
Arguments
thta |
Variance of frailty parameter. If frailty.type = "blind", assumes thta derives from pooled model; if frailty.type = "unblind" assumes thta is from correctly specified model. Default "unblind". |
L |
Number of events. |
tau |
Expected follow-up time. |
lam |
Event rate. If lam.type = "pool", assumes lam is pooled rate; if lam.type = "base", assumes lam is baseline control event rate. Default "base". |
alp |
Two-sided alpha-level. |
pow |
Target power. |
ar |
Allocation ratio (Number control / Total) |
frailty.type |
Indicates whether frailty variance is based on blinded information ("blind") or unblinded ("unblind"). Default "unblind". |
lam.type |
Indicates whether event rate is based on control rate ("base") or pooled rate ("pool"). Default "base". |
interval |
Initial search interval for bta1. |
Details
This function computes the log rate ratio bta1 as the root of the equation eventsNeeded(bta1, thta_, tau, lam0_, alp, pow, ar) - L = 0, where thta_ and lam0_ also depend on bta1 if using estimates from blinded analyses. If frailty.type = "blind": thta_ = thtap2thta(thta, bta1); otherwise if frailty = "unblind": thta_ = thta. If lam.type = "pool" then lam0_ = lam * 2 / (1 + exp(bta1)); otherwise if lam.type = "base": lam0_ = lam. Function assumes a rate ratio < 1 is favourable to treatment.
Value
The log rate ratio.
Examples
# Based on unblinded estimates
btaNeeded3(thta = 2, L = 1000, tau = 1, lam = 1.1, alp = c(0.01, 0.05), pow = c(.5))
exp(btaNeeded3(thta = 2, L = 1000, tau = 1, lam = 1.1, alp = c(0.01, 0.05), pow = c(.5)))
# Based on blinded estimates
btaNeeded3(thta = 2, L = 1000, tau = 1, lam = 0.7, alp = c(0.01, 0.05), pow = c( .5),
frailty.type = "bl", lam.type = "po")
exp(btaNeeded3(thta = 2, L = 1000, tau = 1, lam = 0.7, alp = c(0.01, 0.05), pow = c( .5),
frailty.type = "bl", lam.type = "po"))
# Based on blinded estimates
if (require("dplyr") & require("tidyr")) {
assumptions = tibble(alp = 0.05) %>%
crossing(
thta = c(2, 3, 4),
lam = 1.1,
pow = c(0.5, 0.8),
L = c(500, 1000),
tau = 1
) %>%
mutate(
bta1 = btaNeeded3(thta = thta, L = L, tau = tau, lam = lam, alp = alp, pow = pow),
RR = exp(bta1)
)
assumptions %>% data.frame()
}