untangle.specials {survival5}R Documentation

Help Process the `specials' Argument of the `terms' Function.

Description

Given a terms structure and a desired special name, this returns an index appropriate for subscripting the terms structure and another appropriate for the data frame.

Usage

untangle.specials(tt, special, order=1)

Value

a list with two components:

Examples

# This is code from within the coxph program, m is the data frame and TT
#  the terms structure for the formula.  We wish to exclude first order
#  strata() terms from the final X matrix, and also to extract these terms
#  to a second data frame
TT <- terms(formula, specials='strata')
temp <- untangle.specials(TT, 'strata')
if (length(temp$vars)) {
    X <- model.matrix( TT[-temp$terms], m)
    m.strat <- m[temp$vars]
    }
else X <- model.matrix(TT, m)