Skip to content

simsurv_msm: Missing Start Stage Value Behavior #1

@MetzgerSK

Description

@MetzgerSK

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) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions