Announcement

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

  • No observations when executing pksumm command

    Good day,

    I am new to Stata and figuring out how to do perform AUC analysis.

    My dataset has 4 variables, I already destringed them:

    Observations: 530
    Variables: 4 15 Aug 2022 18:00
    --------------------------------------------------------------------------------------------------------------------------------------------------
    Variable Storage Display Value
    name type format label Variable label
    --------------------------------------------------------------------------------------------------------------------------------------------------
    participantid byte %8.0g ParticipantID
    group byte %10.0g Group
    time int %8.0g Time
    parasitaemia float %8.0g Parasitaemia
    -

    The summary of my data looks like this:

    Variable | Obs Mean Std. dev. Min Max
    -------------+---------------------------------------------------------
    participan~d | 530 53.76226 27.38109 4 97
    group | 530 3.89434 1.145455 1 5
    time | 530 63.21509 49.63187 0 168
    parasitaemia | 530 887.6236 2390.913 0 21506

    .

    But when I want to perform pksumm or pkexamine commands, the following shows:
    .no observations
    r(2000);

    There are no missing values in my dataset. Some time or parasitaemia values are 0, but there are also observations without a value of 0.

    What can I do to advance with my pk analyses?

  • #2
    You have 169 time periods and only 530 observations?

    time | 530 63.21509 49.63187 0 168

    I do not use the command but I guess that it requires a common time period across the person identifiers, e.g., 1,2, 3 and 4 for pid=1; 1, 2, 3 and 4 for pid=2; and so on.
    Last edited by Andrew Musau; 16 Aug 2022, 04:58.

    Comment


    • #3
      Dear Andrew,

      Each participant has parastiaemia values for time points 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 96, 120, 144, 168 (hours). Is that what You have been referring to?

      Comment


      • #4
        Yes. I wonder if you can share the data for at least 2 participants using dataex? For example, you can copy and paste the result of:

        Code:
        dataex participantid group time parasitaemia if participantid<10

        Comment


        • #5
          Dear Andrew,

          That would give this:


          Code:
          * Example generated by -dataex-. For more info, type help dataex
          clear
          input byte(participantid group) int time float parasitaemia
          4 1   0 352
          4 1   8   6
          4 1  16  51
          4 1  24 152
          4 1  32 200
          4 1  40 116
          4 1  48   0
          4 1  56   0
          4 1  64   0
          4 1  72   0
          4 1  96   0
          4 1 120   0
          4 1 144   0
          4 1 168   0
          8 1   0 295
          8 1   8   0
          8 1  16   0
          8 1  24   0
          8 1  32   0
          8 1  40   0
          8 1  48   0
          8 1  56   0
          8 1  64   0
          8 1  72   0
          8 1  96   0
          8 1 120   0
          8 1 144   0
          8 1 168   0
          9 2   0 314
          9 2   8   0
          9 2  16   0
          9 2  24   0
          9 2  32   0
          9 2  40   0
          9 2  48   0
          9 2  56   0
          9 2  64   0
          9 2  72   0
          9 2  96   0
          9 2 120   0
          9 2 144   0
          9 2 168   0
          end
          I also just tried using pkexamine on a dataset only containing one participant (pid 29), and it worked:
          . pkexamine time parasitaemia

          Maximum concentration = 4558
          Time of maximum concentration = 0
          Time of last observation (Tmax) = 168
          Elimination rate = .
          Half life = .

          Area under the curve
          -----------------------------------------------------------------------
          | AUC [0, inf.) | AUC [0, inf.) | AUC [0, inf.)
          AUC [0, Tmax] | Linear of log conc. | Linear fit | Exponential fit
          ----------------+---------------------+---------------+----------------
          51570.35 | . | . | .
          -----------------------------------------------------------------------
          Fit based on last 3 points.

          So I need to get Stata to do this for every participant. Do You have an idea?

          Comment


          • #6
            Originally posted by Dorothea Ekoka Mbassi View Post
            So I need to get Stata to do this for every participant. Do You have an idea?
            You can't.

            The terminal half-life is estimated by linear regression of logarithmically transformed values of the last three observations' concentration data on the time variable.

            With zeroes, these are all missing and so you get the error message that you do for participants who have all zero values for that time span.

            Comment


            • #7
              I think I am starting to understand. It still does not work if I make sure that at least one of the last three observations per participant is >0, though
              Do You know another way feasible way to calculate the Area under the time-parasitaemia curve? ( = time concentration curve if You want)

              Comment


              • #8
                PS: Even in a dataset with only parasitaemia >0, I still get the same error

                pkexamine time parasitaemia, trapezoid graph
                time variable takes on repeated values
                r(459);

                ...

                Comment


                • #9
                  Originally posted by Dorothea Ekoka Mbassi View Post
                  Do You know another way feasible way to calculate the Area under the time-parasitaemia curve? ( = time concentration curve if You want)
                  You could look into integ. I've illustrated one possibility of its use below (begin at the "Begin here" comment).

                  .ÿ
                  .ÿversionÿ17.0

                  .ÿ
                  .ÿclearÿ*

                  .ÿ
                  .ÿquietlyÿinputÿbyte(participantidÿgroup)ÿint(timeÿparasitaemia)

                  .ÿ
                  .ÿ*
                  .ÿ*ÿBeginÿhere
                  .ÿ*
                  .ÿframeÿcreateÿIntegralsÿbyte(pidÿgrp)ÿdoubleÿauc

                  .ÿ
                  .ÿquietlyÿlevelsofÿparticipantidÿ,ÿlocal(pids)

                  .ÿforeachÿpidÿofÿlocalÿpidsÿ{
                  ÿÿ2.ÿÿÿÿÿÿÿÿÿsummarizeÿgroupÿifÿparticipantidÿ==ÿ`pid',ÿmeanonly
                  ÿÿ3.ÿÿÿÿÿÿÿÿÿlocalÿgrpÿ`r(min)'
                  ÿÿ4.ÿÿÿÿÿÿÿÿÿquietlyÿintegÿparasitaemiaÿtimÿifÿparticipantidÿ==ÿ`pid'ÿ//ÿ,ÿtrapezoid
                  ÿÿ5.ÿÿÿÿÿÿÿÿÿframeÿpostÿIntegralsÿ(`pid')ÿ(`grp')ÿ(r(integral))
                  ÿÿ6.ÿ}

                  .ÿframeÿIntegrals:ÿlist,ÿnoobs

                  ÿÿ+-----------------------+
                  ÿÿ|ÿpidÿÿÿgrpÿÿÿÿÿÿÿÿÿaucÿ|
                  ÿÿ|-----------------------|
                  ÿÿ|ÿÿÿ4ÿÿÿÿÿ1ÿÿÿ5255.9242ÿ|
                  ÿÿ|ÿÿÿ8ÿÿÿÿÿ1ÿÿÿÿ884.9748ÿ|
                  ÿÿ|ÿÿÿ9ÿÿÿÿÿ2ÿÿÿ941.97317ÿ|
                  ÿÿ+-----------------------+

                  .ÿ
                  .ÿexit

                  endÿofÿdo-file


                  .


                  PS: Even in a dataset with only parasitaemia >0, I still get the same error
                  You need to restrict the command to a single participant each time. I illustrate how to do that, too, above.

                  Comment


                  • #10
                    Thanks for the data example. I see that the issue is the spells of zero values. Across each participant and for a given time period, the command expects some variance. The error arises as the command runs a regression internally. You can see this by setting trace on.

                    Code:
                    set trace on
                    pksumm participantid time parasitaemia
                    Res.:

                    Code:
                    ------------------------------------------------------------------------------------------------------------- end _get_diopts --- - if _by() { `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster' } - else { - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster' = version 7, missing : _regress __00000F time if __00000G [], no observations } ---------------------

                    PS: Even in a dataset with only parasitaemia >0, I still get the same error

                    pkexamine time parasitaemia, trapezoid graph
                    time variable takes on repeated values
                    r(459);


                    pkexamine expects a single series, e.g., observations of a single participant. Furthermore, these must be varying over time. So the first code will work for participant with id 4, but the second will not.

                    Code:
                    * Example generated by -dataex-. For more info, type help dataex
                    clear
                    input byte(participantid group) int time float parasitaemia
                    4 1   0 352
                    4 1   8   6
                    4 1  16  51
                    4 1  24 152
                    4 1  32 200
                    4 1  40 116
                    4 1  48   0
                    4 1  56   0
                    4 1  64   0
                    4 1  72   0
                    4 1  96   0
                    4 1 120   0
                    4 1 144   0
                    4 1 168   0
                    8 1   0 295
                    8 1   8   0
                    8 1  16   0
                    8 1  24   0
                    8 1  32   0
                    8 1  40   0
                    8 1  48   0
                    8 1  56   0
                    8 1  64   0
                    8 1  72   0
                    8 1  96   0
                    8 1 120   0
                    8 1 144   0
                    8 1 168   0
                    9 2   0 314
                    9 2   8   0
                    9 2  16   0
                    9 2  24   0
                    9 2  32   0
                    9 2  40   0
                    9 2  48   0
                    9 2  56   0
                    9 2  64   0
                    9 2  72   0
                    9 2  96   0
                    9 2 120   0
                    9 2 144   0
                    9 2 168   0
                    end
                    
                    pkexamine time parasitaemia if participantid==4
                    pkexamine time parasitaemia if participantid==4 & time<48

                    Res.:

                    Code:
                    . pkexamine time parasitaemia if participantid==4
                    no observations
                    r(2000);
                    
                    .
                    . pkexamine time parasitaemia if participantid==4 & time<48
                    
                                                              Maximum concentration =       352
                                                      Time of maximum concentration =         0
                                                    Time of last observation (Tmax) =        40
                                                                   Elimination rate =    0.0169
                                                                          Half life =   41.0313
                    
                        Area under the curve
                        -----------------------------------------------------------------------
                                        |    AUC [0, inf.)    | AUC [0, inf.) |  AUC [0, inf.)
                         AUC [0, Tmax]  | Linear of log conc. |   Linear fit  | Exponential fit
                        ----------------+---------------------+---------------+----------------
                           4883.00      |      11749.690      |   8440.333    |   12908.303
                        -----------------------------------------------------------------------
                        Fit based on last 3 points.
                    This is not my area, but I recommend that you read the PDF manual entry of these commands to see how pharmacokinetic data should look like. Data with continuous spells of zero values do not appear to be it.

                    Comment


                    • #11
                      Thank You for all Your effort.

                      The "foreach pids [...]" commands returns "_b not allowed when e(b) is not present", now I am trying to find out why so I can finally see those AUCs I am searching for.

                      Comment


                      • #12
                        Originally posted by Dorothea Ekoka Mbassi View Post
                        The "foreach pids [...]" commands returns "_b not allowed when e(b) is not present"
                        Here, just copy and paste this into your do-file editor (with your dataset loaded in Stata) and run it.
                        Code:
                        *
                        * Begin here
                        *
                        
                        frame create Integrals byte(pid grp) double auc
                        
                        quietly levelsof participantid , local(pids)
                        
                        foreach pid of local pids {
                        
                            summarize group if participantid == `pid', meanonly
                            local grp `r(min)'
                        
                            quietly integ parasitaemia time if participantid == `pid' // , trapezoid
                            frame post Integrals (`pid') (`grp') (r(integral))
                        }
                        
                        frame Integrals: list, noobs
                        
                        exit

                        Comment


                        • #13
                          Originally posted by Andrew Musau View Post
                          This is not my area, but I recommend that you read the PDF manual entry of these commands to see how pharmacokinetic data should look like. Data with continuous spells of zero values do not appear to be it.
                          Thank You for elaborating the issue for me! I will probably look into other commands, as my dataset is already formatted according to the pkexamine manual.

                          Comment


                          • #14
                            Originally posted by Joseph Coveney View Post
                            Here, just copy and paste this into your do-file editor (with your dataset loaded in Stata) and run it.
                            I appreciate the effort You do for me, thank You!
                            I still get back the same error "_b not allowed when e(b) is not present r(111);" though - and I feel my level of Stata skills is not yet up to understanding that error code. Some variable not correctly defined somewhere?


                            Comment


                            • #15
                              Originally posted by Dorothea Ekoka Mbassi View Post

                              I still get back the same error "_b not allowed when e(b) is not present r(111);"
                              That is an unusual error to get from levelsof. You need to show the exact Stata output including the command that you ran. Copy directly from the Results window and paste here within CODE delimiters.

                              Comment

                              Working...
                              X