turn on suggestions

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
- /
- General Programming
- /
- How do predict y at different x values using Proc ...

Topic Options

- 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
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-14-2014 11:01 AM

Hi,

I'm using Y values (0, 4.495, 5.099, 6.055, 6.168, 3.449, 3.296, 0, 2.046) collected at different X values (0, 4, 7, 11, 14, 21, 28, 35, 39) in Proc Loess.

The predicted values I get (smooth = 0.75, degree= 2) are for the X values above. But, I am interested in different X values within the original. For example, what would be the predicted Y at X = 3?

I can't figure out how to obtain that from Proc Loess... Does anyone know how to do that?

Thanks, Nick

Accepted Solutions

Solution

05-14-2014
11:31 AM

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

05-14-2014 11:31 AM

Sorry about that. You must also use the SCORE statement and ODS OUTPUT to get what you want

**proc loess data=myData;**

**model...;**

**...**

**score;**

**ods output ScoreResults=myPreds;**

**run;**

Or you could use a separate dataset with only the X coordinates of the predictions you want.

PG

PG

All Replies

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

05-14-2014 11:05 AM

Add the pair X=3. Y=. to your data.

PG

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

05-14-2014 11:16 AM

PGStats, thanks for the prompt response...

That didn't work... According to the documentation, "PROC LOESS deletes any observation with missing values...".

Would you have any other idea? Thanks, Nick

Solution

05-14-2014
11:31 AM

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

05-14-2014 11:31 AM

Sorry about that. You must also use the SCORE statement and ODS OUTPUT to get what you want

**proc loess data=myData;**

**model...;**

**...**

**score;**

**ods output ScoreResults=myPreds;**

**run;**

Or you could use a separate dataset with only the X coordinates of the predictions you want.

PG

PG

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

05-14-2014 03:33 PM

PGstats, thanks for your help! That was great... I was starting to get disappointed for not being able to do that.. Thanks! Nick

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

05-14-2014 03:19 PM

PG's advice is known as "the missing value trick." See The missing value trick for scoring a regression model - The DO Loop Somewhere in the 9.3-9.3 time frame, PROC LOESS added an OUTPUT statement which enables you to get predicted values for observations which have a missing response but nonmissing values for the explanatory variable.

In general, there are five ways to score a regression model, see: Techniques for scoring a regression model in SAS - The DO Loop

Of the techniques in the second article, PROC LOESS only supports the SCORE statement, which PG has shown you how to use.