Win10, Stata 17.0 MP6, survsim 4.0.9
Problem
If any observation has a missing value for the startstate variable, survsim goes off the rails and repeatedly creates yObsv, state, and fail variables until the dataset in memory hits c(max_k_theory).
In the MWE below, the error gets thrown while survsim_msm's executing mata: survsim_msm(Phfs,Ptotalhfs).
MWE
clear *
set obs 2000
set seed 57
matrix tMat = (., 1, ., . \ ., ., ., . \., ., ., 2\., ., ., .)
gen grp = .
replace grp = 1 in 1/200
replace grp = 2 in 201/1800 // NOTE: 200 observations 'accidentally' left without a value for starting stage
survsim yObsv state fail, ///
hazard1(d(w) gamma(1.25) lambda(.05)) ///
hazard2(d(w) gamma(1.05) lambda(.1) ) ///
maxtime(100) startstate(grp) transmatrix(tMat)
Win10, Stata 17.0 MP6,
survsim4.0.9Problem
If any observation has a missing value for the
startstatevariable,survsimgoes off the rails and repeatedly createsyObsv,state, andfailvariables until the dataset in memory hitsc(max_k_theory).In the MWE below, the error gets thrown while
survsim_msm's executingmata: survsim_msm(Phfs,Ptotalhfs).MWE