wlr {simtrial}R Documentation

Weighted logrank test

Description

Weighted logrank test

Usage

wlr(data, weight, return_variance = FALSE)

Arguments

data

Dataset that has been cut, generated by sim_pw_surv().

weight

Weighting functions, such as fh(), mb(), and early_zero().

return_variance

A logical flag that, if TRUE, adds columns estimated variance for weighted sum of observed minus expected; see details; Default: FALSE.

Details

Value

A list containing the test method (method), parameters of this test method (parameter), point estimation of the treatment effect (estimation), standardized error of the treatment effect (se), Z-score (z), p-values (p_value).

Examples

x <- sim_pw_surv(n = 200) |> cut_data_by_event(100)

# Example 1: WLR test with FH wights
x |> wlr(weight = fh(rho = 0, gamma = 1))
x |> wlr(weight = fh(rho = 0, gamma = 1), return_variance = TRUE)

# Example 2: WLR test with MB wights
x |> wlr(weight = mb(delay = 4, w_max = 2))

# Example 3: WLR test with early zero wights
x |> wlr(weight = early_zero(early_period = 4))

[Package simtrial version 0.4.1 Index]