gen.tailwin {stepp}R Documentation

Utility function to generate tail-oriented window

Description

Utility function to generate tail-oriented windows inputs given the approximate number of subpopulations desired.

Usage

  gen.tailwin(covariate, nsub, dir="LE")

Arguments

covariate

covariate values

nsub

number of tail-oriented subpopulations to be generated

dir

"LE" (default) or "GE" - subpopulations with covariate values less than or equal/greater than or equal to the generated values

Details

Use this together with the constructor, stepp.win, to generate tail-oriented windows.

Value

It returns a list with fields: $v - vector of covariate values to be used in the constructor stepp.win. $np - vector of subpopulation size associate with each tail-oriented window defined by $v.

Author(s)

Wai-ki Yip

See Also

stwin, stepp.win

Examples

data(bigKM)

rxgroup <- bigKM$trt
time    <- bigKM$time
evt     <- bigKM$event
cov     <- bigKM$ki67

# analyze using Kaplan-Meier method with tail-oriented window
#
nsubpop_tmp <- 10
win_tmp <- gen.tailwin(cov, nsub = nsubpop_tmp, dir = "LE")
nsubpop <- length(win_tmp$v)
# create a tail-oriented window
swin <- new("stwin", type = "tail-oriented", r1 = win_tmp$v, r2 = rep(min(cov), nsubpop))
subp <- new("stsubpop")                             # create subpopulation object
subp <- generate(subp, win = swin, covariate = cov) # generate the subpopulations
summary(subp)                             # summary of the subpopulations

# create a stepp model using Kaplan Meier Method to analyze the data
#
smodel  <- new("stmodelKM", coltrt=rxgroup, trts=c(1,2), survTime=time, censor=evt, timePoint=4)

statKM  <- new("steppes")     # create a test object based on subpopulation and window
statKM  <- estimate(statKM, subp, smodel) # estimate the subpopulation results
# Warning: IT IS RECOMMEND TO USE AT LEAST 2500 PERMUTATIONS TO  PROVIDE STABLE RESULTS.
statKM <- test(statKM, nperm = 10)       # permutation test with 10 iterations

print(statKM)         # print the estimates and test statistics
plot(statKM, ncex=0.65, legendy=30, pline=-15.5, color=c("blue","gold"),
     pointwise=FALSE, 
     xlabel="Median Ki-67 LI in Subpopulation (% immunoreactivity)",
     ylabel="4-year Disease Free Survival", 
     tlegend=c("Letrozole", "Tamoxifen"), nlas=3)

[Package stepp version 3.2.7 Index]