+ Reply to Thread
Results 1 to 2 of 2

Thread: help with longitudinal analysis

  1. #1
    Points: 649, Level: 12
    Level completed: 98%, Points required for next Level: 1

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help with longitudinal analysis



    Hi I have a longtudinal data where subjects were followed over 7 years and their stress scores(RESPONSE) were recorded as wave measurements W1,W2,W3. The time in which these scores were recorded is time1,time2,time3 and are uneqaully spaced.
    I have written some codes below and would like to find out if they were correct. Hope someone would be able to help me out

    so in excel, the columns are such
    id age W1 W2 W3 time1 time2 time3
    1 23 3 5 0 02-sep-2003 05-oct-2005 09/aug/2007
    2 29 0 1 7 05-sep-2003 11-sep-2005 17/dec/2007
    .................................
    .................................

    *changing from wide to longitudinal data*
    data long_depression;
    set depression;
    array AW(1:3) W1-W3 ;
    array Atime(1:3) time1-time3;
    do visit=1 to 3;
    W=AW[visit];
    time=Atime[visit];
    output;
    end;
    drop W1-W3 time1-time3;
    run;
    proc print data=long_depression;
    run;


    *age,linear mixed effects model*
    proc mixed data=long depression;
    class id ;
    model W = time age time*age/s chisq;
    random intercept /type=un subject=ptno g v vcorr;
    run;

  2. #2
    Points: 855, Level: 15
    Level completed: 55%, Points required for next Level: 45
    d21e7x11's Avatar
    Location
    Hamilton, ON Canada
    Posts
    62
    Thanks
    7
    Thanked 9 Times in 9 Posts

    Re: help with longitudinal analysis


    Hi selvi,

    I'd think that you should not use time as a calendar time but rather time from the baseline i.e. for each subject the earliest time when the response was rrecorded . Your code appears to be correct. I see that you have variable ID in the data set so you should specify SUBJECT=ID in the RANDOM statement.

    Also, I'm not sure why you have chisq option and even if such option exists. Not sure about g v vcorr options as I never use options in the RANDOM statement.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats