Sometimes certain transitions are not of interest. This function removes these and assigns the risk time in the target state of the transitions to the originating state.
rm.tr(obj, from, to)
Character; name of the state from which the transition to be purged
originates. Must be a valid state name for
Character; name of the state to which the transition to be purged
targets. Must be a valid state name for
The function removes all transitions from
assigns all risk time in the
to state after the transition
lex.dur) to the
from state. This is only done for risk
to occurring directly after
from. Risk time in
to occurring after a transition from states different from
from is not affected. Transitions from
to to another
other, say, will be changed to transitions from
Lexis object with the indicated transition removed.
Bendix Carstensen, BendixCarstensen.com.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
data(DMlate) dml <- Lexis( entry = list(Per=dodm, Age=dodm-dobth, DMdur=0 ), exit = list(Per=dox), exit.status = factor(!is.na(dodth),labels=c("DM","Dead")), data = DMlate ) # A small subset for illustration dml <- subset( dml, lex.id %in% c(13,15,20,28,40) ) # Cut the follow-up at start of insulin therapy dmi <- cutLexis( dml, cut = dml$doins, pre = "DM", new.state = "Ins" )[,1:10] # How does it look? dmi # Remove all transitions DM -> Ins rm.tr( dmi, "DM", "Ins" )