Compute log rank test statistic on an endpoint.
Refer to this vignette for more information and examples.
Arguments
- formula
An object of class
formulathat can be used withsurvival::survdiff. Must consistarmand endpoint indata. No covariate is allowed. Stratification variables are supported and can be added usingstrata(...).- placebo
character. String of placebo in
data$arm.- data
data frame. Usually it is a locked data.
- alternative
a character string specifying the alternative hypothesis, must be one of
"greater"or"less", i.e., one-sided test is enforced. No default value."greater"means superiority of treatment over placebo is established by an hazard ratio greater than 1.- ...
subset condition that is compatible with
dplyr::filter. The log rank test (survival::survdiff) is carried out on this subset only. This argument could be useful to create a subset of data for analysis when a trial consists of more than two arms. By default it is not specified, all data will be used to fit the model. More than one conditions can be specified in..., e.g.,fitLogrank(formula, data, arm %in% c('pbo', 'low dose'), x > 0.5), which is equivalent tofitLogrank(formula, data, arm %in% c('pbo', 'low dose') & x > 0.5). Note that if more than one treatment arm are present in the data after applying filter in..., models are fitted for placebo verse each of the treatment arms.- tidy
logical.
FALSEif more information are returned. DefaultTRUE.
Value
a data frame with columns:
armname of the treatment arm.
placeboname of the placebo arm.
pone-sided p-value for log-rank test (treated vs placebo).
infothe number of events of the endpoint in the subset.
zthe z statistic of the log rank test, with the sign of the log hazard ratio of treatment vs placebo.
If the statistic is undefined because its variance is zero (e.g., no
informative event comparison in the subset), a simulation placeholder
z = 0 with the corresponding p = 0.5 is returned with a
warning rather than an error, so that a few such replicates in a large
simulation do not require error handling in action functions. The
placeholder carries no evidence either way and is not a standardized
normal statistic.