One of the msfit strata-related temporary fixes from 09f421f isn't working as it should. Specifically, when vartype=="aalen", the trans.new object will contain a scalar instead of a vector of values. As a consequence, msfit will return an incomplete list of transition-specific cumulative hazards in Haz.
ifelse is returning a result that's the same length as its first argument (test in the ifelse() documentation). is.null(sf0$strata) has length 1, meaning as.numeric(sf0$strata)'s contents will be truncated to length 1, regardless of its true length.
Looks like the issue's resolved if you switch the line in question to:
R: 4.3.0 64-bit, mstate: dev release @ 09f421f, survival: 3.5.5, Win11
Problem
One of the
msfit
strata-related temporary fixes from 09f421f isn't working as it should. Specifically, whenvartype=="aalen"
, thetrans.new
object will contain a scalar instead of a vector of values. As a consequence,msfit
will return an incomplete list of transition-specific cumulative hazards inHaz
.Problem's Source
msfit()
(lines 159–160):ifelse
is returning a result that's the same length as its first argument (test
in theifelse()
documentation).is.null(sf0$strata)
has length 1, meaningas.numeric(sf0$strata)
's contents will be truncated to length 1, regardless of its true length.Looks like the issue's resolved if you switch the line in question to:
MWE