BookmarkSubscribeRSS Feed
Recep
Quartz | Level 8

Hello all,

 

I was wondering if anybody can help me calculating the relative risks of datasets produced by PROC MI and later combined by PROC MIANALYZE?

 

I know that PROC MIANALYZE does not have an option for producing this and the following link is a great example of how to calculate odds ratios in the data step after PROC MIANALYZE but I could not figure out the relative risks.

 

https://communities.sas.com/t5/Statistical-Procedures/calculation-of-odds-ratio-in-proc-mianalyse/td...

 

Best,

 

Recep 

4 REPLIES 4
Rick_SAS
SAS Super FREQ

You don't provide details, but if you want the relative risks as calculated by PROC LOGISTIC, you can take the averaged parameter estimates from PROC MIANALYZE and pass them to PROC LOGISTIC. For details and an example, see "How to score a logistic regression model that was not fit by PROC LOGISTIC."

StatDave
SAS Super FREQ

This can be done using the NLEstimate macro as described, for non-imputed data, in this note. Using the FISH2 data used in the logistic regression example in the MIANALYZE documentation, and adding to it a binary variable, BIG, as big=(length>20);, the following fits the logistic model and then uses the NLEstimate macro to estimate the relative risk, Pr(big=1)/Pr(big=0). Note that the combined parameter estimates and covariance matrix are needed from MIANALYZE. Since the macro always tests that the estimated quantity equals zero, to test that the relative risk equals 1, 1 is subtracted from the definition of the relative risk in the the f= parameter of the macro.

proc mi data=Fish2 seed=1305417 out=outfish2;
   class Species big;
   monotone logistic(Species=big);
   var big Species;
run;
ods select none;
proc logistic data=outfish2 outest=out1 covout;
   class  big / param=glm;
   model Species= big / covb;
   by _Imputation_;
run;
ods select all;
proc mianalyze data=out1 tcov;
   modeleffects Intercept big0;
   ods output parameterestimates=pe tcov=cov;
run;
%nlest(inest=pe, incovb=cov, f=logistic(b_p1)/logistic(b_p1+b_p2)-1 )
Recep
Quartz | Level 8

Thanks a lot for your response @StatDave! I'm having a bit of hard time understanding the relative risk calculation within the %nlest macro.
What is b_p1 and b_p2? When I replicate the code you provided above, neither "out1" nor "pe" dataset does not include those variables.

StatDave
SAS Super FREQ

If you use the link I provided to the macro's documentation, you will see that the b_px values are the names the macro uses to refer to the model parameter estimates. So, the numerator expression, logistic(b_p1), computes the probability that big=1 by applying the inverse logit to the b_p1 parameter which is the intercept. Similarly for the denominator expression. The function, logistic(x), applies the inverse of the logit, 1/(1+exp(-x)).

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1395 views
  • 2 likes
  • 3 in conversation