eventsNeeded2 {agpower} | R Documentation |
Number events needed (fixed sample size)
Description
Function to compute number events (L) needed to achieve given power with fixed sample size N.
Usage
eventsNeeded2(N, bta1, thta, alp = 0.05, pow = 0.8, ar = 0.5, Lmessage = FALSE)
Arguments
N |
Sample size. |
bta1 |
log-transform of rate ratio. |
thta |
Variance of frailty parameter. |
alp |
Two-sided alpha-level. |
pow |
Target power. |
ar |
Allocation ratio (Number control / Total). |
Lmessage |
If TRUE indicates how many estimates of L were negative before setting to Inf. Default FALSE. |
Details
Assumes rate ratio < 1 is favourable to treatment. A negative estimated number of events indicates no number of events is sufficient under the input assumptions.
Value
The number of events (L) needed to achieve target power at one-sided Type I control level alpha/2, given the input assumptions.
Examples
eventsNeeded2(N = 500, bta1 = log(0.8), thta = 2, alp = 0.05, pow = 0.8)
eventsNeeded2(N = 500, bta1 = log(0.8), thta = 3, alp = 0.05, pow = 0.8)
if (require("dplyr") & require("tidyr")) {
assumptions = tibble(alp = 0.05) %>%
crossing(
RR = c(0.6, 0.7, 0.8),
thta = c(2, 3, 4),
pow = 0.8,
N = c(500, 1000)
) %>%
mutate(L = eventsNeeded2(N = N, bta1 = log(RR), thta = thta, alp, pow))
assumptions %>% data.frame()
}
[Package agpower version 0.1.2 Index]