Announcement

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

  • pkcollapse suddenly not working as expected - problem with stat()?

    Hello,

    I use pkcollapse quite often to generate area under the curve and calculate incremental area under the curve. I have used it in recent days with the same code setup as always and it was functioning, however I've just gone to run the same code again and have gotten an error. Specifically, I received an error that a particular variable was already defined, and this seems to be stemming from stat() not functioning as expected; that is to say, when I run the code, more variables are being added to my dataset than what I am specifying.

    I have some of my example data below, and the code I'm using is as follows:

    Code:
    pkcollapse time glucose, id(id) keep(fasting_glucose visit) stat(auc) trapezoid
    Instead of just giving me auc as I've indicated with stat(auc), it is giving me aucline, aucexp, etc. (as if I did not specify stat() at all, so am getting all variables by default).

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int id float(visit time glucose fasting_glucose)
    3 0  0  75.5     74.2
    3 0 10  76.8     74.2
    3 0 15  79.6     74.2
    3 0 20  88.1     74.2
    3 0 30   104     74.2
    4 0  0 113.5      114
    4 0 10 110.5      114
    4 0 15   119      114
    4 0 20 135.5      114
    4 0 30   174      114
    5 0  0  91.6   90.625
    5 0 10  92.5   90.625
    5 0 15   108   90.625
    5 0 20 128.9   90.625
    5 0 30 159.5   90.625
    6 0  0  83.1 83.52499
    6 0 10 84.75 83.52499
    6 0 15  87.5 83.52499
    6 0 20    98 83.52499
    6 0 30   129 83.52499
    8 0  0 100.5   99.675
    8 0 10  97.6   99.675
    8 0 15 103.4   99.675
    8 0 20 105.6   99.675
    8 0 30   143   99.675
    9 0  0  88.7     89.6
    9 0 10  90.6     89.6
    9 0 15    92     89.6
    9 0 20  98.4     89.6
    9 0 30   121     89.6
    end

    Any help anyone can provide would be much appreciated! Apologies in advance if this is a very silly question and I'm missing something obvious.


    -Meghan


  • #2
    I cannot replicate your difficulty on my setup (Windows, Stata 19.5 MP4):

    Code:
    . * Example generated by -dataex-. For more info, type help dataex
    . clear
    
    . input int id float(visit time glucose fasting_glucose)
    
               id      visit       time    glucose  fasting~e
      1. 3 0  0  75.5     74.2
      2. 3 0 10  76.8     74.2
      3. 3 0 15  79.6     74.2
      4. 3 0 20  88.1     74.2
      5. 3 0 30   104     74.2
      6. 4 0  0 113.5      114
      7. 4 0 10 110.5      114
      8. 4 0 15   119      114
      9. 4 0 20 135.5      114
     10. 4 0 30   174      114
     11. 5 0  0  91.6   90.625
     12. 5 0 10  92.5   90.625
     13. 5 0 15   108   90.625
     14. 5 0 20 128.9   90.625
     15. 5 0 30 159.5   90.625
     16. 6 0  0  83.1 83.52499
     17. 6 0 10 84.75 83.52499
     18. 6 0 15  87.5 83.52499
     19. 6 0 20    98 83.52499
     20. 6 0 30   129 83.52499
     21. 8 0  0 100.5   99.675
     22. 8 0 10  97.6   99.675
     23. 8 0 15 103.4   99.675
     24. 8 0 20 105.6   99.675
     25. 8 0 30   143   99.675
     26. 9 0  0  88.7     89.6
     27. 9 0 10  90.6     89.6
     28. 9 0 15    92     89.6
     29. 9 0 20  98.4     89.6
     30. 9 0 30   121     89.6
     31. end
    
    . 
    . pkcollapse time glucose, id(id) keep(fasting_glucose visit) stat(auc) trapezoid
    ......
    . 
    . list, noobs clean
    
        id   visit   fastin~e   auc_gl~e  
         3       0       74.2    2532.25  
         4       0        114     3877.5  
         5       0     90.625       3456  
         6       0   83.52499   2868.625  
         8       0     99.675     3258.5  
         9       0       89.6       2926
    I would suggest doing the usual things in a circumstance were you are getting a result that others cannot replicate:

    1. -update all, force- to make sure that you have the most recent version of everything in Stata, and that the various resources used are all mutually compatible. Then try again.

    2. Reboot your computer and try again.

    3. Uninstall and re-install Stata, then -update all, force-, and try again.

    If none of that works, contact Stata technical support.

    Comment

    Working...
    X