[pstricks] inverse standard normal

Matthias Ruess matthias.ruess at db.com
Wed Sep 29 13:12:12 CEST 2010


Michael, Herbert,
Sorry for my late reply.

@Michael: Thank you for your help. The precision is good enough for my 
intention

@Herbert: I think I have solved the problem. The plot looks pretty nice 
:-) 
Is it possible for you to include a norminv operator/function in some of 
your pstricks packages? I think there are lots of users who would like to 
use this function

%begin{norminv by Michael Sharpe}
\pstVerb{ /c0 2.515517 def /c1 .802853 def /c2 .010328 def /d1 1.432788 
def /d2 .189269 def /d3 .001308 def /inversenl {neg 1 add 1 exch div ln 2 
mul sqrt /t exch def /t2 t dup mul def /t3 t2 t mul def c0 c1 t mul add c2 
t2 mul add 1 d1 t mul add d2 t2 mul add d3 t3 mul add div neg t add} def }
%end{norminv Michael Sharpe}

%begin{vasicek density}
\pstVerb{
/pd 0.22 def            %(0,1) probability of default of portfolio
/R2 0.11 def         %(0,1) R_Squared of portfolio
/e 2.718282 def
/vasicek{               %density=sqrt((1-R2)/R2)*exp(1/2*(norminv(x)^2 - 
(1/sqrt(R2)*((sqrt(1-R2)*norminv(x)-norminv(pd)))^2))
dup                     %x   x
inversenl exec          %x   norminv(x)
dup mul                 %x   norminv(x)^2
exch                    %norminv(x)^2   x
inversenl exec          %norminv(x)^2   norminv(x)
1 R2 sub sqrt mul       %norminv(x)^2   sqrt(1-R2)*norminv(x)
pd inversenl exec sub   %norminv(x)^2   sqrt(1-R2)*norminv(x)-norminv(pd)
R2 sqrt div             %norminv(x)^2 
1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd))
dup mul                 %norminv(x)^2 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2
sub                     %norminv(x)^2 - 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2
2 div                   %1/2*(norminv(x)^2 - 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2)
e exch exp              %exp(1/2*(norminv(x)^2 - 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2)
1 R2 sub                %exp(1/2*(norminv(x)^2 - 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2)   1-R2
R2 div                  %exp(1/2*(norminv(x)^2 - 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2)   (1-R2)/R2
sqrt                    %exp(1/2*(norminv(x)^2 - 
(1/sqrt(R2)*(sqrt(1-R2)*norminv(x)-norminv(pd)))^2)   sqrt((1-R2)/R2)
mul                     %sqrt((1-R2)/R2)*exp(1/2*(norminv(x)^2 - 
(1/sqrt(R2)*((sqrt(1-R2)*norminv(x)-norminv(pd)))^2))
}def}
%end{vasicek density}

\psplot[plotpoints=200]{0}{0.9999}{x vasicek exec}

Kind regards,
Matt

-- 

Informationen (einschließlich Pflichtangaben) zu einzelnen, innerhalb der EU tätigen Gesellschaften und Zweigniederlassungen des Konzerns Deutsche Bank finden Sie unter http://www.deutsche-bank.de/de/content/pflichtangaben.htm. Diese E-Mail enthält vertrauliche und/ oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for information (including mandatory corporate particulars) on selected Deutsche Bank branches and group companies registered or incorporated in the European Union. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20100929/e2d51f7d/attachment.html>


More information about the PSTricks mailing list