Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with predictms for multistate modelling

    Hi, please I need help with using the predictms command to derive predictions from a multi-state model, after using stmerlin. I keep getting the error "At least one prediction type must be specified". I have read the documentation and I am not quite sure what I am not doing correctly. I am using Stata 17. My codes and outputs are below:

    Code:
     msset, id(id) states( incar ad ) times( incar_time ad_time ) covariates( age  gender )
    variables age_trans1 to age_trans3 created
    variables gender_trans1 to gender_trans3 created
    Code:
    mat tmat = r(transmatrix)
    Code:
     mat list tmat
    
    tmat[3,3]
                   to:    to:    to:
                start  incar     ad
    from:start      .      1      2
    from:incar      .      .      3
       from:ad      .      .      .

    Code:
    stset _stop, enter(_start) failure(_status=1)
    
    Survival-time data settings
    
             Failure event: _status==1
    Observed time interval: (0, _stop]
         Enter on or after: time _start
         Exit on or before: failure
    
    --------------------------------------------------------------------------
          3,818  total observations
              0  exclusions
    --------------------------------------------------------------------------
          3,818  observations remaining, representing
          1,612  failures in single-record/single-failure data
     28,706.218  total analysis time at risk and under observation
                                                    At risk from t =         0
                                         Earliest observed entry t =         0
                                              Last observed exit t =  25.10335
    Code:
    stmerlin age if _trans1==1, distribution(weibull) nolog
    
    Fitting full model:
    
    Survival model                                           Number of obs = 1,556
    Log likelihood = -2211.3467
    ------------------------------------------------------------------------------
                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    _t:          |            
             age |  -.3439441   .0202445   -16.99   0.000    -.3836226   -.3042656
           _cons |   3.423091   .2881495    11.88   0.000     2.858328    3.987854
      log(gamma) |  -.6763313    .033129   -20.42   0.000    -.7412628   -.6113997
    ------------------------------------------------------------------------------
    Code:
    estimates store m1
    Code:
    stmerlin age if _trans2==1, distribution(weibull) nolog
    
    Fitting full model:
    
    Survival model                                           Number of obs = 1,556
    Log likelihood = -1618.1694
    ------------------------------------------------------------------------------
                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    _t:          |            
             age |  -.0763549   .0322178    -2.37   0.018    -.1395007   -.0132092
           _cons |  -3.006277    .500387    -6.01   0.000    -3.987017   -2.025536
      log(gamma) |   .2422271   .0420599     5.76   0.000     .1597913     .324663
    ------------------------------------------------------------------------------

    Code:
    estimates store m2
    Code:
    stmerlin age if _trans3==1, distribution(weibull)nolog
    note; a delayed entry model is being fitted
    
    Fitting full model:
    
    Survival model                                             Number of obs = 706
    Log likelihood = -1703.1241
    ------------------------------------------------------------------------------
                 | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    _t:          |            
             age |   -.105471   .0250724    -4.21   0.000     -.154612     -.05633
           _cons |  -1.532095   .3861284    -3.97   0.000    -2.288893   -.7752976
      log(gamma) |   .2845562   .0459795     6.19   0.000     .1944381    .3746743
    ------------------------------------------------------------------------------
    Code:
    estimates store m3

    Code:
    predictms, transmatrix(tmat) models(m1 m2 m3) at1(age 10)
    At least one prediction type must be specified
    r(198);

  • #2
    Did you ever find an answer to this? Have the same issue

    Comment

    Working...
    X