From 03424a93def5da4535267cf5f84f43ddc9dca37d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 3 Oct 2010 23:05:41 +0000 Subject: pst-func 0.70 (2oct10) git-svn-id: svn://tug.org/texlive/trunk@19988 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-func/Changes | 2 ++ .../doc/generic/pst-func/pst-func-doc.pdf | Bin 2943905 -> 2962203 bytes .../doc/generic/pst-func/pst-func-doc.tex | 33 ++++++++++++++++++++- Master/texmf-dist/dvips/pst-func/pst-func.pro | 28 ++++++++++++++++- .../texmf-dist/tex/generic/pst-func/pst-func.tex | 18 +++++++++-- 5 files changed, 76 insertions(+), 5 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes index d902d748bf7..73eee83f7a1 100644 --- a/Master/texmf-dist/doc/generic/pst-func/Changes +++ b/Master/texmf-dist/doc/generic/pst-func/Changes @@ -1,4 +1,6 @@ ..... pst-func.tex +0.70 2010-10-02 - moved vasicek as \psvasicek from pst-math + to pst-func 0.69 2010-06-21 - fix bug with markZeros 0.68 2010-02-11 - add Weibull distribution 0.67 2010-02-09 - fix bug with arrows in \psPolynomial diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf index a9a0cb99b1b..b4522751363 100644 Binary files a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf and b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex index d08f8bedaad..5051ed450c5 100644 --- a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex @@ -1,4 +1,4 @@ -%% $Id: pst-func-doc.tex 285 2010-02-11 09:40:27Z herbert $ +%% $Id: pst-func-doc.tex 391 2010-10-02 16:43:32Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false, smallheadings, headexclude,footexclude,oneside]{pst-doc} \usepackage[utf8]{inputenc} @@ -1470,6 +1470,37 @@ The starting value for $x$ should always be 0 or greater, if it is less than 0 then the macro draws a line from (\#1,0) to (0,0) and starts \Lcs{psWeinbull} with 0. +\clearpage +\subsection{Vasicek distribution} + +The model specifies that the instantaneous interest rate follows the stochastic differential equation: + +\begin{align} +\mathrm{d}r_t = a(b-r_t)\, \mathrm{d}t + \sigma \, \mathrm{d}W_t +\end{align} +with the solution: + +\begin{align} + r(t) = r(0) e^{-a t} + b \left(1- e^{-a t}\right) + \sigma e^{-a t}\int_0^t e^{a s}\,dW_s +\end{align} + +Possible parameters are \Lkeyword{pd} for the probability of the defualt portfolio +and \Lkeyword{R2}, the R$_\mathrm{squared}$ of the portfolio. They are preset to 0.22 and 0.11 +and can be overwritten in the usual way. The macro uses the PostScript function \Lps{norminv} +from the package \LPack{pst-math} which is loaded by default and also shown in the following example. + +\begin{LTXexample}[pos=t] +\psset{xunit=5} +\begin{pspicture}(-0.1,-3)(1.1,4) +\psaxes{->}(0,0)(0,-3)(1.1,4) +\psVasicek[plotpoints=200,linecolor=blue]{0}{0.9999} +\psVasicek[plotpoints=200,linecolor=red,pd=0.2,R2=0.3]{0}{0.9999} +\psplot[plotpoints=200,algebraic,linestyle=dashed]{0}{0.9999}{norminv(x)} +\end{pspicture} +\end{LTXexample} + + + \clearpage \section{The Lorenz curve} diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro index f1f274dc54c..c190e16fb78 100644 --- a/Master/texmf-dist/dvips/pst-func/pst-func.pro +++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro @@ -1,4 +1,4 @@ -%% $Id: pst-func.pro 355 2010-06-21 10:02:44Z herbert $ +%% $Id: pst-func.pro 391 2010-10-02 16:43:32Z herbert $ %% %% This is file `pst-func.pro', %% @@ -313,6 +313,32 @@ tx@FuncDict begin end } def % +/vasicek{ %density=sqrt((1-R2)/R2)*exp(1/2*(norminv(x)2 - (1/sqrt(R2)*((sqrt(1-R2)*norminv(x)-norminv(pd)))2)) + 2 dict begin + /pd where { pop }{ /pd 0.22 def } ifelse % element of (0,1) probability of default of portfolio + /R2 where { pop }{ /R2 0.11 def } ifelse % element of (0,1) R_Squared of portfolio + dup % x x + norminv % x norminv(x) + dup mul % x norminv(x)^2 + exch % norminv(x)2 x + norminv % norminv(x)2 norminv(x) + 1 R2 sub sqrt mul % norminv(x)2 sqrt(1-R2)*norminv(x) + pd norminv 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) + ENeperian 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)) + end +} def +%end{vasicek density} +% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % subroutines for complex numbers, given as an array [a b] % which is a+bi = Real+i Imag % diff --git a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex index d508a247ee6..a10b9c025b1 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -1,4 +1,4 @@ -%% $Id: pst-func.tex 355 2010-06-21 10:02:44Z herbert $ +%% $Id: pst-func.tex 391 2010-10-02 16:43:32Z herbert $ %% %% This is file `pst-func.tex', %% @@ -30,8 +30,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} % -\def\fileversion{0.69} -\def\filedate{2010/06/21} +\def\fileversion{0.70} +\def\filedate{2010/10/2} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -768,6 +768,18 @@ \ignorespaces% } % +\define@key[psset]{pst-func}{pd}[0.22]{\pst@checknum{#1}\psk@probability } +\define@key[psset]{pst-func}{R2}[0.11]{\pst@checknum{#1}\psk@portfolio } +\psset[pst-func]{pd=0.22,R2=0.11} +% +\def\psVasicek{\pst@object{psVasicek}} +\def\psVasicek@i#1#2{% + \addbefore@par{plotpoints=500}% + \begin@OpenObj + \psplot{#1}{#2}[/pd \psk@probability\space def /R2 \psk@portfolio\space def ]{x tx@FuncDict begin vasicek end} + \end@OpenObj% + \ignorespaces% +} \define@boolkey[psset]{pst-func}[Pst@]{Gini}[true]{} \psset[pst-func]{Gini=false} % -- cgit v1.2.3