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

Hi, I would appreciate a help with creating a caterpillar plot from the generalized linear mixed (binomial distribution) models with random intercepts output. I came across with an article on creating a caterpillar plot from proc mcmc output using the cater macro:

 

ods graphics on;
%CATER(data=postout, var=delta: );
ods graphics off;

 

I want to do a similar plot but with the proc glimmix output (SolutionR=random effect estimates

and plotting the ‘wiskers’ as +/- 1.96 x the standard errors).

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Great. Glad you solved your problem. If you have other questions, please post them. Otherwise, please mark the thread as solved.

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

If you post your code, we can be more helpful. What statistic are you trying the plot? The parameter estimates and their standard errors?

If so, see this article about regression coefficient plots.

 

As shown in the article, the basic idea is to output the information you want to plot (estimates and stderrs) to a SAS data set. then use a DATA step to create two variables: Lower=Estimate-1.96*StdErr and Upper=Estimate-+.96*StdErr.

Use the SCATTER statement in PROC SGPLOT and the XERRRORLOW= and XERRORUPPER= options to display the 1.96*StdErr intervals.

 

Other articles that cerate similar plots are 

"Coverage probability of confidence intervals"

and

"Odds ratio plots"

 

jeff_b
Fluorite | Level 6

Thank you Rick! Your response is extremely helpful.

 

Posting my code below:
 
data temp;
set SolutionR;
 Lower=Estimate-1.96*StdErrPred;
 Upper=Estimate+1.96*StdErrPred;
run;
 
proc sort data=temp;  by descending Estimate;  run;
proc sgplot data=temp noautolegend;
   scatter y=Estimate x=Subject  / yerrorlower=Lower yerrorupper=Upper  markerattrs=(symbol=diamondfilled);
   refline 0 / axis=y;
   xaxis grid;
   yaxis grid display=(nolabel) discreteorder=data reverse;
run;
Rick_SAS
SAS Super FREQ

Great. Glad you solved your problem. If you have other questions, please post them. Otherwise, please mark the thread as solved.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 3 replies
  • 1057 views
  • 0 likes
  • 2 in conversation