Announcement

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

  • Unsure about my methods

    Hello everybody, I plan to analyze the relationship between drug exposures to my interest outcome. Due to the fact that I obtain data every 6 months, I would like to analyse my model as cox proportional hazard with drug exposure as time varying exposure. I learned from STATA manual guide and it said that you would do by stsplit or expand. However, there are many drugs in this study so let's say exposure to A B C D and I think that taking any combination of this might impact the results so I would like to create multivariable model by adjusting with all drug exposure in this study, sex and age. But I'm not certain if my methods were right. So I would like you guys to check whether it is okay.
    Here is my table.(this is preliminary table so I have not put all information in my original table yet. All I would like to know is just to check if my idea is correct) Supposing that code is personal id, sex = 1 means female, 2 means male, event = 0 means censor, 1 means event occured, t = observed time( counted from the beginning to when event happened or was censored.), A means drug A exposure; A = 0 means never use, A = 1 means ever use, same definition are applied for B,C,D. In addition, supposing that the effect of exposure will remain constant after exposure.

    n code sex age event t A B C D

    1 101 1 45 0 6 1 0 0 0
    2 101 1 45 0 8 0 1 1 0
    3 102 1 51 0 6 1 0 0 0
    4 102 1 51 1 13 1 0 0 0
    5 103 2 52 1 4 0 1 0 1
    6 104 2 57 0 3 1 0 0 0
    7 105 2 43 0 5 0 0 0 1
    8 106 2 38 0 2 0 0 0 0
    9 107 2 45 0 6 0 1 0 0
    10 107 2 45 1 11 0 0 1 0

    From this table I do command " stset t, id(n), failure(event) scale(1) "

    Then I use command " stcox A B C D age sex".

    What I just want to know if my process is right as I would like to find the association between each drug and event?

    P.S. I am very newbie to this program

    Many thanks

    Piere





  • #2
    Close, but not quite.

    First, there are two variables in your table that you do not explain: n and code. It appears that code is the variable that identifies individual subjects who have multiple observations, whereas n appears to be just an observation counter (and actually serves no apparent purpose here.) If I have that right, then the -id()- option shold be specified as -id(code)-, not -id(n)-. Also, the comma following the -id()- option is a syntax error. In standard Stata syntax, the comma separates the main part of the command from the options--but commas are not allowed between options. The -scale(1)- option is perfectly OK, but it also does nothing and you might just as well omit it.

    If you fix up the -stset- command, you should be OK. The -stcox- command looks syntactically correct.

    One possible issue in your data: the variable age does not change within person even as time progresses. So presumably age represents age at the time of study entry. That's legal, but it might be more informative to use current age in each observation. That's a science question, not a statistical one--but I just want to be sure you're aware of the difference and that you intentionally choose whichever is appropriate here. Similarly, be sure you understand that what your -stset- command tells Stata is that everyone in the study becomes at risk when t = 0. Again that is fine, if it is true. But sometimes in real situations, particularly in observational studies, people may be at risk before they are observed, or may not become at risk until after they are observed. That is why -stset- has -origin()- and -enter()- options. So, again, just ask yourself whether it is really true that time t=0 always corresponds precisely to the onset of risk.

    In the future, please post example data using the -dataex- command. Run -ssc install dataex- to install it, and then run -help dataex- to read the simple directions for using it. As it happens, the example data you showed was not particularly difficult to import to Stata, but this kind of layout sometimes is, and that deters people from trying to help you if it looks like they will need to experiment with your data to develop a solution to your problem. When you use -dataex-, those who want to help can import your data to Stata with a simple copy/paste operation, and the resulting imported data is guaranteed to be a completely faithful replica of what you are facing (including storage types, labeling, etc.) So, going forward, always use -dataex- to show example data.

    Comment


    • #3
      Dear Clyde,

      Thanks you so much for your crystal clear explanation. I apologize for forgetting to delineate what code and n are, but what you understood is exactly right. Regarding t, all person here, I assumed that every person were at risk since t = 0 so I omit to use -origin()- and -enter()-.

      Also, next time I will post my example data as your suggestion. Again, I would like to thank so much.

      Piere

      Comment

      Working...
      X