| untangle.specials(survival5) | R Documentation |
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.
untangle.specials(tt, special, order=1)
a list with two components:
# 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)