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

I would like to make plots like the ones in this post:

https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html

 

but I have 2 problems

1) I have an offset and a binomial distribution and these charts only work for Poisson.   Binomial fits better based on qic,  given my robust standard errors can I just go with poisson to get my to chart output?

 

 

2) My x variable is is not really continuous, it is a categorical time variable and SAS only wants continuous variables on the x-axis.

 

Is there a way to make a plot like with an output dataset and sgplot. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
telligent
Quartz | Level 8

I was able to make something close using output from the lsmeans and the at command.  

View solution in original post

8 REPLIES 8
Ksharp
Super User

Since it is written by Rick. Calling @Rick_SAS 

Rick_SAS
SAS Super FREQ

1. Please post the SAS code you are using.

2. The X variable does not have to be continuous, See the documentation for the EFFECTPLOT statement for examples of plotting the response versus a CLASS ....

telligent
Quartz | Level 8

proc genmod data=whatever;

class time;

model y =time a b c time*a time*b time*c/link=log dist=nb offset=log_n;

effectplot fit(x=time plotby=a) /moff ilink; *doesn't work;

effectplot slicefit(x=time sliceby=b) /moff ilink; *doesn't work;

run;

 

Could I switch to dist=poisson just to get my charts to run even though dist=nb gives me a much lower qic, given that GEE has robust standard errors? Are they robust to choice of poisson or Negative binomial?

 

I could also switch my ordinal time to continuous to make my charts output, but I have no idea what that would do statistically. 

 

 

 

 

Rick_SAS
SAS Super FREQ

Look at the table on this page of the documentation.

It shows which options and suboptions support CLASS variables.Try the INTERACTION plot, which will plot the response versus levels of the CLASS variable, as shown in this example.

telligent
Quartz | Level 8

I get this error.

I use this option because I want the y axis to be rates.   

 

ERROR: The MOFF option is only available for Poisson regression with an offset variable and the log

       link.

 

I get this error when I remove the moff option:

ERROR: Continuous variables are not allowed in the X= option.

 

These errors result from using:

effectplot interaction(x=time*a);

 

 

So, I don't think I'm asking a not reading the documentation type question.  I am asking for an alternate way to do what SAS doesn't automatically do or how to modify my data to make it do what SAS automatically does.  

telligent
Quartz | Level 8

I was able to make something close using output from the lsmeans and the at command.  

Rick_SAS
SAS Super FREQ

Great! Could you please share the code you used so that future people who have this question can find the answer?

telligent
Quartz | Level 8

ods output lsmeans=lsmeans;

lsmeans time/at a=5 exp;

lsmeans time/at a=10 exp;

lsmeans time/at a=15 exp;

etc. . . for as many values of a as needed.

Repeat for b and c.  

 

proc sgplot data=lsmeans;

vline time/response=y group=a;

run; 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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