Announcement

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

  • Performing regression analysis by ID

    Dear all,
    Sorry I'm new to the forum, although I have read many posts, I was not able to find the solution to my problem. I am pretty sure it's an easy one.
    I have a dataset with unique ID but multiple observations (Left and Right side of the same person).
    I want to run logistic on variables accounting on the results of the fellow side.
    For example, the probability that the Left side will develop the same outcome as the Right side, depending on X and Y variables.

    Code:
    clear
    input int ID byte Side float Outcome
     1 1 0
     2 1 0
     3 1 1
     4 1 0
     5 2 0
     6 1 0
     7 2 0
     8 2 0
     9 1 0
     9 2 1
     10 1 0
    11 1 0
    12 1 0
    13 1 0
    14 2 0
    end

    Sorry if this is not the correct way to post or ask a question, please let me know how to improve.

    Regards,

  • #2
    Welcome!

    Just to make sure, is this sample data reflecting the truth? Out of 14 subjects, only one (ID=9) has both sides measured. With this high magnitude of missing prevalence could you really control for the other side of the same person?

    Comment


    • #3
      Hello,

      No it's a sample because the real data is unfortunately confidential.
      But there are 5000 obs for about 3500 IDs.
      Is this a problem ?

      Comment


      • #4
        Originally posted by Simon Henry View Post
        But there are 5000 obs for about 3500 IDs.
        Is this a problem ?
        Not as bad as I originally thought. If only 1 out of 14 have both L/R measured then it'd be challenging to adjust for the other side.

        There may be more than one approach. I think it'd be easier if the data are arranged so that each line is a unique person, and the L/R data are separated into two variables. The command reshape wide may be useful.
        Code:
        help reshape
        A sample code would be like:
        Code:
        reshape wide Outcome, i(ID) j(Side)
        Then proceed with the logistic regression. For this approach only those with both L/R measurements would be considered in the regression.

        Comment


        • #5
          Thank you very much !
          I will use your method !

          Comment

          Working...
          X