1 / 19

Macro to Automate The Covariance Structure Determination in Repeated Measures Data Analysis

Macro to Automate The Covariance Structure Determination in Repeated Measures Data Analysis Gayathridevi Kolandaivelu. Define. Repeated measure Fixed effect Random effect Covariance structure Proc MIXED and Proc GLIMMIX. 1. Definitions.

kylee
Download Presentation

Macro to Automate The Covariance Structure Determination in Repeated Measures Data Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Macro to Automate The Covariance Structure Determinationin Repeated Measures Data Analysis Gayathridevi Kolandaivelu

  2. Define • Repeated measure • Fixed effect • Random effect • Covariance structure • Proc MIXED and • Proc GLIMMIX 1

  3. Definitions • Repeated measures – multiple measurements of a response variable on the same experimental unit. example: Blood pressure measured at baseline and Weeks 1, 2, 3 and 4 after the start of treatment. • Fixed effect – if the levels in the study represent all possible levels of the factor, or at least all levels about which inference is to be made examples: treatment, visit 2

  4. Definitions • Random effect – if the levels of the factor that are used represent only a random sample of a larger set of potential levels example: subject • Covariance structure – assumed model to describe the variation over time within experimental units. (Two measurements obtained closely in time in the same subject are likely to be more highly correlated than two observations far apart in time in the subject.) examples: compound symmetry, autoregressive-1 3

  5. Introduction of the Process • The Process involves performing repeated measure analysis on data using procedures assigned by the statistician. • Check for convergence criteria and record the covariance structure. • If the results are not satisfactory or the convergence is not met then the independent variables or the interaction are modified. • Again the data is analyzed for appropriate covariance structure in hierarchical order. 4

  6. Definitions • PROC MIXED – SAS PROC that allows for analysis of continuous repeated measures data, allowing for the examination of different covariance structures example: change from baseline in blood pressure at Weeks 1, 2, 3 and 4 after the start of treatment. • PROC GLIMMIX – SAS PROC that allows for analysis of binary repeated measures data, allowing for the examination of different covariance structures example: MADRS response (Yes, No) at Weeks 2, 4, 6 and 8 after the start of treatment. 5

  7. Statistical model Proc mixed ; class trt site visit; model &var.chgbl=trt visit site trt*visit &var.blv &var.blv*visit ; repeated visit / subject = subjid type=unr; lsmeanstrt*visit / diff cl; run; Classification variables Independent variable and interaction Dependent Variable Covariant structure 6

  8. Challenge A program to speed up the process that is more automatic and flexible to analyze different covariant structure using both Proc Mixed or Proc Glimmix Without the program the number of iterations could be (n structures*x tables*y with/without variable) =n*x*y example: (6*24*2 =288) Include/Exclude independent variable (e.g. trt, visit, invid) or interaction (e.g. Visit*trt, baseline*trt) 7

  9. Covariance Structure Hierarchy More restricted analysis as it descends down the hierarchy 8

  10. Analysis report P = With investigator id, Np = Without investigator id 9

  11. Solution • Macro • Data driven conditional logic • Datastep interface tool and %IF condition %THEN %DO 10

  12. Basics of the process Analyze Repeated Measure data for 6 covariant structures Yes Add/Remove independent variables in the model statement /change the options No Convergence criteria met Yes Output the summary statistics 11

  13. The steps of the program are: • Nested Macro • Use ODS to obtain the convergence status and output the necessary statistics into datasets • Use macro parameters to define the options into the macro variables ( for type and model). • Use % if then condition within macro to repeat the modeling for each covariance structure until convergence criteria is met. • Use data _NULL_ and call symput routine to output the string of covariance structure that can be used in creating report or for further processing. 12

  14. Macro Flow RPT Macro RPTMEAS Macro Execute Procedure Macro call O/P Convergence status via ODS O/P the statistics TOEPH O/P cs String Status=1 Check Status End RPTMEAS Status=0 ARH(1) Status=1 Convergence criteria met TOEP Status=1 AR(1) End RPT 13

  15. Macro outline %Macro RPT; %Macro rptmeas(dsn= , var= , type= , model = , out1= ,out2= ); ods output ConvergenceStatus=converge; Proc Mixed or Proc Glimmix %mend rptmeas; /***UN**************************/ %rptmeas( dsn=_dsn1,var=eff , type= UN , model = trt site visit trt*visit ,out1=diff, out2=lsm); data _null_; set converge ; call symput( ‘st' , Status); if status=0 then call symput('mn', 'an unstructured'); run; %if &steq 0 %then %do; %goto quit; %end; %if &st ne 0 %then %do; /**TOEPH****/ - - - - - - Call the rptmeas macro again and check the status %mend rpt; 14

  16. Macro %Macro rpt; %macro rptmeas(dsn= , var= , type= , model = , out1= ,out2= ); ods output ConvergenceStatus=converge; proc mixed data= &dsn; class trt visit site; model &var.chgbl= &model ; repeated visit/type= &type sub=subjid; lsmeans trt*visit / diff cl; ods output diffs= &out1 lsmeans= &out2; run; %mend rptmeas; 15

  17. Contd /******** UN*********/ %rptmeas( dsn=_dsn1,var=eff , type= UN , model = trt site visit trt*visit ,out1=diff, out2=lsm); data _null_; set converge ; call symput( ‘st' , Status); if status=0 then call symput('mn', 'an unstructured'); run; %if &st eq 0 %then %do; %goto quit; %end; 16

  18. /********TOEPH*******/ %if &st ne 0 %then %do; %rptmeas(var=_dsn1 ,var=eff , type= TOEPH , model = trt site visit trt*visit, out1=diff1, out2=lsm1); data _null_; set converge ; call symput('n', Status); if status=0 then call symput('mn', ‘ a heterogeneous Toeplitz'); %end; %mend rpt; 17

  19. Questions?

More Related