Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- plot a 95% confidence interval in a logistic regre...

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-06-2018 01:40 AM

Hi there,

I would like to add 95% confidence interval bands to the following code.

**proc** **sgplot** data=AllStats noautolegend;

axis1 label = (font = 'arial');

axis2 label = (font = 'arial');

label predmupa = 'Hatching probability'

jsh = 'JSH';

series y=predmupa x=jsh;

scatter y=predmupa x=jsh;

Does anyone know how to do this? I used proc glimmix to produce the predicted probabilities.

Thanks in advance!

Bob

**run**;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to boban

04-06-2018 01:47 AM

Axis statements do no apply to SG procedures, use XAXIS instead, but the syntax is different.

Do you have the upper and lower estimates for your band? I know that PROC LOGISTIC generates these but not sure about GLIMMIX. If you have the values, a BAND statement is what you’re looking for to create a band. Order does matter here, make sure it’s before the SERIES statement.

Do you have the upper and lower estimates for your band? I know that PROC LOGISTIC generates these but not sure about GLIMMIX. If you have the values, a BAND statement is what you’re looking for to create a band. Order does matter here, make sure it’s before the SERIES statement.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

04-06-2018 03:03 AM

Thank you for your reply!

I don't have the estimates for the bands, and don't know how to get them. Is there a way of obtaining these bands, or plot in any other way?

Best,

Bob

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to boban

04-06-2018 04:27 AM

You can get confidence intervals from a number of procedures depending on what you need - not really an expert, a statistician would be best to ask (proc ttest, means etc.). You may be able to do it directly in the graph:

http://support.sas.com/documentation/cdl/en/grstatproc/62603/HTML/default/viewer.htm#a003155517.htm

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-06-2018 09:10 AM

Thanks!

I tried this but it doesn't seem to work. l'll keep looking.

Cheers,

Bob

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to boban

04-06-2018 10:33 AM

I think I solved it!

I used this code:

**proc** **sgplot** data=AllStats noautolegend;

axis1 label = (font = 'arial');

axis2 label = (font = 'arial');

label predmupa = 'Hatching probability'

jsh = 'JSH';

band x = jsh lower = lclmupa upper = uclmupa/legendlabel = "95% clm" name ="band1";

series y=predmupa x=jsh;

scatter y=predmupa x=jsh;

keylegend "band1"/ location = inside position = bottomright;

title;

**run**;

I guess this will plot a 95% confidence interval around the predicted mean. Is that right?

Bob

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to boban

04-06-2018 11:12 AM

That depends on how lclmupa and uclmupa were calcualted in the dataset allstats. If you used proc means, then there is an option called alpha which you can set to be most values, but 0.05 from memory give 95% CI.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-06-2018 11:14 AM

In this respect, the bands need to be calculated from the GLIMMIX procedure and then you use the BAND statement.

@boban only you can know if its correct. We can't see your data or log or graph or Glimmix code or know what you're trying to do beyond what's posted here.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

04-07-2018 07:42 AM

I didn't calculate the bands. I simply requested all stats to be computed from my original data set, and used the out option to save them under the new data set (named all stats).

I then used predmupa to get the predicted probabilities ploted in proc sgplot.

Thanks for your help!

Bob