BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

How to test in SAS whether CI95 around incidence rate (arate) before adjustment to covariate ( ci95up and ci95low ) is statistically significantly different from CI 95 around incidence rate (arate2) after adjustment (ci95up2 and ci95low2 ). I'll appreciate your help, hints or any suggestions.

 

data rate; 
input counties arate	ci95up	ci95low	arate2	ci95up2	ci95low2;
cards;
1 0.0049248307	0.0051575772	0.0046920842	0.0012312077	0.0011862427	0.0011261002
2 0.0046188674	0.0051729008	0.004064834	0.0011547169	0.0011897672	0.0009755602
3 0.0044704179	0.004586433	0.0043544028	0.0011176045	0.0010548796	0.0010450567
4 0.0050796534	0.0053595804	0.0047997263	0.0012699133	0.0012327035	0.0011519343
5 0.0049783924	0.0054169662	0.0045398187	0.0012445981	0.0012459022	0.0010895565
6 0.0048053275	0.0052370211	0.0043736339	0.0012013319	0.0012045148	0.0010496721
7 0.0055029619	0.0058532686	0.0051526552	0.0013757405	0.0013462518	0.0012366373
8 0.0051496166	0.0055738675	0.0047253657	0.0012874041	0.0012819895	0.0011340878
9 0.0034690852	0.0039164533	0.0030217171	0.0008672713	0.0009007843	0.0007252121
10 0.0038353754	0.0042293908	0.0034413599	0.0009588438	0.0009727599	0.0008259264
;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Perhaps you meant "compare" or "visualize" instead of "test"?  If so, look at my article on the Regression Coefficient Plot, which enables you to compare estimates from different models. For your data, it looks like this:

/* transpose data from wide to long */
data Want;
set Rate(rename=(arate=Estimate ci95low=LowerCL ci95up=UpperCL)
         drop=arate2 ci95up2 ci95low2 in=A)
    Rate(rename=(arate2=Estimate ci95low2=LowerCL ci95up2=UpperCL)
         drop=arate ci95up ci95low);

if A then Type = "Before Adjustment";
else      Type = "After Adjustment ";
run;

proc sgplot data=Want;
   scatter y=Counties x=Estimate / xerrorlower=LowerCL xerrorupper=UpperCL
           markerattrs=(symbol=diamondfilled)
           group=Type groupdisplay=cluster; /* display side-by-side estimates */
   refline 0 / axis=x;
   xaxis grid min=0 ;
   yaxis grid colorbands=odd discreteorder=data type=discrete;
   label Estimate = "Rate";
run;

SGPlot30.png

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@Cruise wrote:

How to test in SAS whether CI95 around incidence rate (arate) before adjustment to covariate ( ci95up and ci95low ) is statistically significantly different from CI 95 around incidence rate (arate2) after adjustment (ci95up2 and ci95low2 ). I'll appreciate your help, hints or any suggestions.


You can't do a statistical test to compare confidence intervals — there is no such thing. You can do a statistic test to compare arate to arate2, in which case you'd have to specify exactly what you want to compare ... do you want to compare the means, or the variances, or something else.

--
Paige Miller
Rick_SAS
SAS Super FREQ

Perhaps you meant "compare" or "visualize" instead of "test"?  If so, look at my article on the Regression Coefficient Plot, which enables you to compare estimates from different models. For your data, it looks like this:

/* transpose data from wide to long */
data Want;
set Rate(rename=(arate=Estimate ci95low=LowerCL ci95up=UpperCL)
         drop=arate2 ci95up2 ci95low2 in=A)
    Rate(rename=(arate2=Estimate ci95low2=LowerCL ci95up2=UpperCL)
         drop=arate ci95up ci95low);

if A then Type = "Before Adjustment";
else      Type = "After Adjustment ";
run;

proc sgplot data=Want;
   scatter y=Counties x=Estimate / xerrorlower=LowerCL xerrorupper=UpperCL
           markerattrs=(symbol=diamondfilled)
           group=Type groupdisplay=cluster; /* display side-by-side estimates */
   refline 0 / axis=x;
   xaxis grid min=0 ;
   yaxis grid colorbands=odd discreteorder=data type=discrete;
   label Estimate = "Rate";
run;

SGPlot30.png

Cruise
Ammonite | Level 13

Hi @Rick_SAS,

Excellent idea to present the story by visuals. In my real data, I have 12 different rates by all 62 counties. Do you think creating chart like below is possible in SAS? Also, if I put all rate1-rate12  in same visual, would plot be still informative? rate1=crude, rate2=adjusted, rate3-rate12 different and reflected on the third variable.

 

ci.pngreference: https://surveillance.cancer.gov/cirank/query/

 

Rick_SAS
SAS Super FREQ

Sure. Plotting the difference between rates is a standard technique, although I'm not sure how you plan to obtain the CIs. Do you have the standard errors?

 

For how to create similar graphs in SAS, see the last two graphs in the article "Coverage probability of confidence intervals".

To get the vertical stripes, use the BLOCK statement, as shown in this blog post.

 

If you run into problems, post to the SAS Graphics Support Community.  Good luck!

Cruise
Ammonite | Level 13
You rock. Thanks a lot.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1160 views
  • 5 likes
  • 3 in conversation