SI Workshop: July 15, 200 5 1 SAS Macro Coding for Jackknife Repeated Replication • Jackknife Repeated Replication is well-suited to macro coding due to iterative and flexible abilities with SAS macro language • This presentation will demonstrate how to use a general JRR macro to correctly calculate variance estimates for means and regression coefficients (logistic and OLS models)
27
Embed
SAS Macro Coding for Jackknife Repeated Replication
SAS Macro Coding for Jackknife Repeated Replication. Jackknife Repeated Replication is well-suited to macro coding due to iterative and flexible abilities with SAS macro language - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
SI Workshop: July 15, 2005 1
SAS Macro Coding for Jackknife Repeated Replication
• Jackknife Repeated Replication is well-suited to macro coding due to iterative and flexible abilities with SAS macro language
• This presentation will demonstrate how to use a general JRR macro to correctly calculate variance estimates for means and regression coefficients (logistic and OLS models)
SI Workshop: July 15, 2005 2
Analysis of Complex Sample Survey Data
• Data from complex sample surveys must be analyzed using techniques which adjust for the clustering of the sample design
• SAS, SPSS, and Stata assume a simple random sample and do not correctly calculate variances and standard errors within the standard procedures
SI Workshop: July 15, 2005 3
Analysis of Complex Survey Data
• SAS and Stata offer survey and svy procedures which use the Taylor Series Linearization approach
• JRR is another widely used replication approach, offers an alternative to the Taylor Series method
• JRR is flexible and can be adapted to many different types of statistics such as means, regression coefficients, and other statistics of interest
SI Workshop: July 15, 2005 4
Visual Representation of JRR process
• JRR systematically removes a small portion of the sample and statistics of interest are computed repeated for each sub-sample
• In this example, str=42 and secu=2 is deleted and str=42 and secu=1 is doubled.
• This process is followed for each strata until entire dataset is covered
SI Workshop: July 15, 2005 5
SI Workshop: July 15, 2005 6
SI Workshop: July 15, 2005 7
SAS JRR Macro: Logistic Regression
*Logistic Regression Jackknife for Analysis of Complex Survey Data****************** ;
*Pat Berglund, July 2003 for Summer Institute Workshop ;
libname d 'd:\sumclass' ;options compress=yes nofmterr symbolgen ;options macrogen mprint;
*create outer jackknife macro with parameters ;*Parameters to fill in:*ncluster=number of clusters, in the NCS I dataset this is 42 ;*weight=case weight ;*depend=dependent variable for the logistic model ;*preds=predictor variables entered with a space between each one ;*indata=input dataset* ;
*section 1: jackknife using strata and secu variables to do 42 jackknife selections* ;*each iteration of do loop selects one strata*secu combination and doubles the contribution of strata=x and secu=1 while setting strata=x and secu=2 to zero ;*all other combinations stay the same* ;
%let nclust=%eval(&ncluster);data one; set &indata;
%macro wgtcal ; %do i=1 %to &nclust ; pwt&i=&weight; if str=&i and secu=1 then pwt&i=pwt&i*2 ; if str=&i and secu=2 then pwt&i=0 ; %end; %mend;%wgtcal ;
SI Workshop: July 15, 2005 9
**section 2: run base model/statistic of interest for entire sample using full weight* ;