Announcement

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

  • lr test likely invalid for models with robust vce

    Why does stata give me this error following:
    Click image for larger version

Name:	Screenshot 2023-11-14 at 03.30.17.png
Views:	1
Size:	14.5 KB
ID:	1733789


    Code:
    stset survt [pw=weight], fail(status==1) scale(12) exit(time 120)
    
    // estimate the time-varying hazard ratio using flexible parametric models
    stcox var1 var2 var3, tvc(var3) texp(_t) 
    estimates store nonph1
    
    // estimate the time-varying hazard ratio using flexible parametric models
    stpm2 var1 var2 var3, scale(h) df(5) eform tvc(var3) dftvc(3)
    
    estimates store stpm2_nonph
    lrtest nonph1 stpm2
    Question 2 if I may
    Also, all tests above since including [pw=weight] due to IPTW take at least 3hr to load as I have 600,000 observations, 16,000 failures.
    Is this normal? there are 74000 iterations if it makes sense to anyone

  • #2
    Hi,

    Stata gives that error warning message because when clustering both likelihoods need iid observations. I would suggest using a wald test. (More on this here https://www.stata.com/support/faqs/s...od-ratio-test/)

    Regarding question 2, you did not provide much info. I don't think is normal but I believe it should be okay as long as there are not many backed up iterations. Try simplifying the model and see if something improves.

    Comment


    • #3
      Thanks Luca

      the thing is , as mentioned I have a large dataset with weights
      with 600,000 observations

      A stcox model with 2 Tvc variables

      and

      stpm2 with 2 tvc variables

      take a total of 3hr to run

      i tried

      Code:
      stcox var1 var2 var3, tvc(var1 var2) texp(ln(_t)) hr
      Estinates store m1
      
      stpm2 var1 var2 var3,scale(n) df(5) eform tvc(var1 var2) dtvc(3) 
      estimates store m2
      
      test m2 m1
      lrtest m2 m1
      the lrtest gives me the result above in post1

      the wald test gives me - stata error:
      ​​​​​​​
      m2 not found
      r(111)

      Does this have to do with memory capacity perhaps ?

      Comment


      • #4
        That is not the way to use test with different estimating equations. I intended something like this https://www.stata.com/support/faqs/s...-coefficients/ but this does not work in your case.

        Currently, I don't know if there is an easily implementable way to test your hypothesis on Stata and any suggestion/correction from other members could be more meaningful.
        If this has not to be a formal test but just a check you could:
        1. use lrtest without vce and pweights (not a formal test but just a way to see which test works better with stronger assumptions)
        2. run models on a sample and predict results on an other sample and see which model predicts better
        3. compare the models testing "by hand" that your coefficients are not statistically different (using coefplot to show it visually may help).

        Comment

        Working...
        X