| Date: | Mon, 18 Oct 2010 16:05:57 -0200 |
| Reply-To: | Ricardo Gonçalves da Silva
<rgs.rsilva@BANCOVOTORANTIM.COM.BR> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Ricardo Gonçalves da Silva
<rgs.rsilva@BANCOVOTORANTIM.COM.BR> |
| Subject: | PROC for MLE Estimation |
| Content-Type: | text/plain; charset="iso-8859-1" |
Hi,
The code below calculates probabilities of default (PDs) by MLE using a quadrature method.
In fact, this corresponds to the Basel's II version of the Vasicek distribution.
I would like to know if there´s a SAS procedure that can do same, with the additional vantages of using a PROC.
Note that the main functions to be maximized is px and qx.
Thanks.
DATA mle_corr;
DO p = 0 TO 0.5 BY .002;
DO q = 0 TO 0.5 BY .002;
lp = LOG(p);
lp1 = LOG(1-p);
lq = LOG(q);
lq1 = LOG(1-q);
low_def = 1;
high_def = 2;
pd = 0;
rho=.12;
DO x = 0.0005 TO 1 BY .001;
argument = (PROBIT(p) + SQRT(rho) * PROBIT(x))/SQRT(1-rho);
px = CDF('normal',argument,0,1);
IF px = . THEN px = p;
argument = (PROBIT(q) + SQRT(rho) * PROBIT(x))/SQRT(1-rho);
qx = CDF('normal',argument,0,1);
IF qx = . THEN qx = q;
pd = SUM( pd , ((1-px)**(70-low_def))*(px**low_def)*((1-qx)**(30-high_def))*(qx**high_def) );
END;
pd = pd/1000; /*quadrature points*/
lpd = LOG(pd);
OUTPUT;
END;
END;
DROP lp lq lp1 lq1;
RUN;
/*LR ratio for inference*/
PROC SQL;
CREATE TABLE llratio AS
SELECT
p,q,low_def,high_def,
2*(MAX(lpd)-lpd) AS lr
FROM mle_corr
GROUP BY low_def, high_def
ORDER BY low_def, high_def, p, q
;
QUIT;
Esta mensagem e seus anexos podem conter informações confidenciais ou privilegiadas. Se você não é o destinatário dos mesmos você não está autorizado a utilizar o material para qualquer fim. Solicitamos que você apague a mensagem e avise imediatamente ao remetente. O conteúdo desta mensagem e seus anexos não representam necessariamente a opinião e a intenção da empresa, não implicando em qualquer obrigaçâo ou responsabilidade da parte da mesma.
This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. The contents of this message and its attachments do not necessarily express the opinion or the intention of the company, and do not implies any legal obligation or responsibilities from this company.
|