Turn on suggestions

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

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- proc model optimization

Options

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 08-20-2022 03:39 PM
(305 views)

Hi All,

Overall i want to optimize my equations using Nelson Siegel to build Hazard Rate Curves through proc model. I have a problem to define the following equation:

HAZARDRate = Spread / (1 - RecoveryRate);

because i cannot calculate directly HAZARDRate, i don't have a formula, so i calculate it like implied HazardRate as you can see here

```
PROC model data=input MAXITER=&Maxiter CONVERGE=0.0000001 SINGULAR=0.0000001 MAXSUBIT=&Maxsubit NOITPRINT noprint ;
Price=sum(%hr(n=65));
PARMS HazardRate;
BOUNDS HazardRate<=1;
fit PredictedPrice start=(HazardRate=0.01) / OUTPREDICT OUTEST=predictedhr;
run;
quit;
```

and hr defined like

```
%global j;
%macro hr(n);
%do i=1 %to &n;
%let j=%eval(&i-1);
%if &j=0 %then %do;
(real_amount&i*exp(-HazardRate*tm_d&i/365)+remainingprincipal&i*((1-exp(-HazardRate*tm_d&i/365))*RecoveryRate))*df&i,
%end;
%else %do;
(real_amount&i*exp(-HazardRate*tm_d&i/365)+remainingprincipal&i*((exp(-HazardRate*tm_d&j/365)-exp(-HazardRate*tm_d&i/365)))*RecoveryRate)*df&i,
%end;
%end;
0
%mend;
```

So how can i define this equation? Is there any way?

RecoveryRate - parameter

Spread - fixed

Thank you,

Alexey

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If you want to estimate unknown parameters in PROC MODEL using nonlinear regression, you need to have an equation in the form:

y = f(x,theta) + epsilon

where y is the dependent variable, x's are the exogenous variables, theta is vector of parameters to be estimated, epsilon is the error term. Your input data should contain columns of y and x's, and you write out the equation for f(x,theta) explicitly, then specify the y variable on the FIT statement.

I am afraid it is not clear to me what your equation y = f(x, theta) + epsilon is. If you can first write out the functional form y = f(x,theta) + epsilon explicitly mathematically, then you can write out the f(x, theta) explicitly in PROC MODEL. If your goal is not to estimate parameters from nonlinear regression, then please clarify on what your objective is.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Alexey,

If you're new to PROC MODEL it can be difficult to know the best syntax to express your model. I'd be happy to help if you could clarify what data you have and what you are trying to estimate. If your data consists of many contract prices (price) then your FIT statement (ignoring extraneous options) would just be

`fit price;`

How you write out the right hand side of your price model depends on how time, discount factors, amounts (remaining and real) are represented in your INUPUT data set (e.g. what are the rows and columns in your INPUT data set). If you can specify these details it should be possible estimate your model.

Marc

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.