Announcement

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

  • error after predictms - using the exact code by Prof Crowther (stata meeting slides)

    As you may be aware I am calculating transition probabilities using Prof Crowther slides using this website :

    Ref: Slide 49 https://www.stata.com/meeting/italy1...8_Crowther.pdf

    Code:
    clear all
    use http://fmwww.bc.edu/repec/bocode/m/multistate_example,clear
    msset, id(pid) states(rfi osi) times(rf os) covariates(age)
    mat tmat = r(transmatrix)
    
    //Declare survival data
    stset _stop, enter(_start) failure(_status=1) scale(12)
    
    qui stpm2 age sz2 sz3 nodes hormon pr_1 if _trans1==1, scale(h) df(3) tvc(sz2 sz3 pr_1) dftvc(1)
    estimates store m1
    qui streg age sz2 sz3 nodes hormon pr_1 if _trans2==1, distribution(weibull)
    estimates store m2
    qui stpm2 age sz2 sz3 nodes hormon pr_1 if _trans3==1, scale(h) df(3) tvc(pr_1) dftvc(1) nolog
    estimates store m3
    
    predictms , transmat(tmat) at1(age 45) timevar(temptime) graph models(m1 m2 m3)

    (Question 1) Why am I getting this error after -predictms-

    Code:
    predictms, transmat(tmat) at1(age 45)

    ERROR: At least one prediction type must be specified

    I don't understand, I've copied and pasted the code from Prof Crowther's slides' (slide 49-50)
    I'm sorry I can't paste the screenshot, looks like there is an error on Statalist.

    Appreciate any insight



  • #2
    Michael Crowther appreciate any input.. there have been similar posts from other users. Does -predictms- still work?

    Comment


    • #3
      Does -predictms- still work?
      https://github.com/RedDoorAnalytics/multistate
      Code:
      ssc install multistate
      help predictms

      Comment


      • #4
        from help predictms *! version 4.4.1 17jan2023 MJC
        Code:
        statistic                      Description
            ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
              probability                  calculate transition probabilities
              los                          calculate length of stay in each state
              rmst                         calculate restricted mean survival time
              visit                        probability of ever visiting each state
              hazard                       transition-specific hazard function
              survival                     transition-specific survival function
              userfunction(func_name)      user-defined Mata function for bespoke predictions; see details
            ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            At least one of the above options must be specified
        (my emphasis above)

        Comment


        • #5
          thanks for the above. But I don't understand why MJC didn't specify any of this in his slides.... I've linked his 2018 and attached a screenshot of his 2017 slides

          https://www.stata.com/meeting/italy1...8_Crowther.pdf

          Using the help above:

          Code:
          clear all
          use http://fmwww.bc.edu/repec/bocode/m/multistate_example,clear
          msset, id(pid) states(rfi osi) times(rf os) covariates(age)
          
          //Stores matrix callted tmat name, stores the values from transmatrix
          mat tmat = r(transmatrix)
          
          //Displays tmat ie the values of transmatrix
          mat list tmat
          
          //Declare survival data
          stset _stop, enter(_start) failure(_status=1) scale(12)
          streg age_trans1 age_trans2 age_trans3 _trans2 _trans3, dist(weibull)
          range temptime 0 15 100
          predictms, transmat(tmat) at1(age 45) timevar(temptime)
          
          ERROR: At least one prediction type must be specified
          r(198);
          
          
          //Following statalist help:
          predictms, transmat(tmat) probability at1(age 45) timevar(temptime)
          
          ERROR: Only merlin models are supported
          What is this merlin model? I've haven't found anyone with a similar problems. iT WOULD be great if these 2018/2017 slides are updated.

          Click image for larger version

Name:	Screenshot 2024-04-07 at 22.20.32.png
Views:	2
Size:	214.7 KB
ID:	1749188
          Attached Files
          Last edited by Denise Vella; 07 Apr 2024, 16:38.

          Comment


          • #6
            Of note, I also check the latest predictms help section


            and modified my code as recommended by the help


            Code:
            clear all
            use http://fmwww.bc.edu/repec/bocode/m/multistate_example,clear
            msset, id(pid) states(rfi osi) times(rf os) covariates(age)
            
            //Stores matrix callted tmat name, stores the values from transmatrix
            mat tmat = r(transmatrix)
            
            //Displays tmat ie the values of transmatrix
            mat list tmat
            
            //Declare survival data
            stset _stop, enter(_start) failure(_status=1) scale(12)
            
            stmerlin age if _trans1==1, distribution(weibull)
            estimate store m1
            
            stmerlin age if _trans2==1, distribution(weibull)
            estimate store m2
            
            stmerlin age if _trans3==1, distribution(weibull)
            estimate store m3
            
            ///transition probabilities for a patient with age 50  
            predictms, transmatrix(tmat) models(m1 m2 m3) probability at1(age 50)
            However I obtain the following error:

            Any thoughts? THe 2017/2018 slides looked so simple, yet there's been an. update somewhere in the process
            Click image for larger version

Name:	Screenshot 2024-04-07 at 23.18.56.png
Views:	1
Size:	102.3 KB
ID:	1749192

            Comment

            Working...
            X