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
- /
- Plotting a Model set to 0

- Subscribe to 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-20-2014 02:19 PM

I have to plot the line 0 = alpha +beta(x)

I've only used the proc gplot a few time and am not sure if I can set a plot an equation set to zero. How can I go about doing so? Thank you

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

Posted in reply to Msjustice

12-20-2014 02:30 PM

Don't know if that helps...

You usually have y=beta(x) + e but if you want to force that to 0 you can subtract y:

0=beta(x) + e - y

And then e-y becomes your alpha.

Also,,

0=alpha+beta(x) => -alpha=beta(x)

so that's another way, but it depends on what you want for a plot I suppose.

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

Posted in reply to Reeza

12-20-2014 02:57 PM

thank you, that makes sense. How would I plot that using sas?

would it be

proc gplot data = test;

y = 0;

plot y*x; run;

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

Posted in reply to Msjustice

12-20-2014 07:33 PM

What does your data look like, can you post sample data?

What are you expecting from a graph?

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

Posted in reply to Reeza

12-20-2014 09:42 PM

Here is a small sample. It's the HIV status (1=present) and the person's age in months. I have to see if month is a predictor for HIV status.

I'm asked to plot the line 0 = alpha + month(x) + month*month(w) and compare it to the scatterplot of month by month*month. I was able to do that scatterplot but I don't know what the code would be to plot the line.

Month HIV

15 1

157 0

36 0

234 1

130 0

81 0

11 1

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

Posted in reply to Msjustice

12-20-2014 07:49 PM

If you have SAS 9.2 or more you could use the REFLINE statement within PROC SGPLOT, to obtain a horizontal line.

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

Posted in reply to Msjustice

12-22-2014 12:16 PM

Does this help?

data dataset;

input month hiv;

cards;

15 1

157 0

36 0

234 1

130 0

81 0

11 1

;

run;

proc sgplot data = dataset;

scatter x = month y = hiv;

refline 0 / axis = y;

run;