BookmarkSubscribeRSS Feed
AlexeyS
Pyrite | Level 9

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
SASCom1
SAS Employee

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.

kessler
SAS Employee

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

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!

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.

Discussion stats
  • 2 replies
  • 738 views
  • 0 likes
  • 3 in conversation