{"id":5535,"date":"2023-03-01T16:54:19","date_gmt":"2023-03-01T08:54:19","guid":{"rendered":"https:\/\/fanyuzhao.com\/?p=5535"},"modified":"2023-03-01T16:55:19","modified_gmt":"2023-03-01T08:55:19","slug":"value-at-risk-expected-shortfalls","status":"publish","type":"post","link":"https:\/\/fanyuzhao.com\/?p=5535","title":{"rendered":"Value at Risk &#038; Expected Shortfalls"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Value at Risk &#8211; VaR<\/h1>\n\n\n\n<p>VaR is a probability statement about the potential change in the value of a portfolio.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Notation<\/h2>\n\n\n\n<p>$$Porb(x\\leq VaR(X))= 1-c$$<\/p>\n\n\n\n<p>$$ Prob\\bigg(z \\leq \\frac{VaR(X)-\\mu}{\\sigma}\\bigg)=1-c $$<\/p>\n\n\n\n<ul><li>$c$ &#8211; confidence interval, i.e. $c=99\\%$. Then $1-c = 1\\% $<\/li><li>$\\mu$ and $\\sigma$ are for $X$.<ul><li>For Example, if <span class=\"katex math inline\">X<\/span> is yearly return, then <span class=\"katex math inline\">\\mu_{252days}=252\\cdot\\mu_{1day}<\/span>, and <span class=\"katex math inline\">\\sigma_{252days}=\\sqrt{252}\\cdot\\sigma_{1day}<\/span><\/li><\/ul><\/li><li>$x$ here is the return. So, $c$ is the confidence interval, i.e. 99%.<ul><li>VaR focus on the tail risks. If <span class=\"katex math inline\">x<\/span> stands for return, then tail risk is on the left tail, <span class=\"katex math inline\">z_{1-c}<\/span>.<\/li><\/ul><\/li><li>If <span class=\"katex math inline\">x<\/span> is the loss, the tail risk is on the right tail. <span class=\"katex math inline\">z_c<\/span><\/li><\/ul>\n\n\n\n<p>$$VaR(X) = \\mu + \\sigma\\cdot \\Phi^{-1}(1-c)$$<\/p>\n\n\n\n<p>$$VaR(X) = \\mu + \\sigma\\cdot z_{1-c}$$<\/p>\n\n\n\n<ul><li>I.E.<\/li><\/ul>\n\n\n\n<p>\u200b If <span class=\"katex math inline\">c=99\\%<\/span>, then <span class=\"katex math inline\">1-c=1\\%<\/span>, so <span class=\"katex math inline\">z_{1-c}=z_{0.01} \\approx -2.33<\/span><\/p>\n\n\n\n<p>\u200b <span class=\"katex math multi-line\">VaR(X) = \\mu &#8211; 2.33\\cdot \\sigma<\/span><\/p>\n\n\n\n<p><strong>P.S.<\/strong><\/p>\n\n\n\n<p>\u200b The unit of VaR is the amount of loss, so it should be monetary amount. For example, if the total amount of portfolio is USD 1 million, then <span class=\"katex math inline\">VaR = \\$1m \\cdot (\\mu &#8211; 2.33\\cdot \\sigma)<\/span>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Loss Distribution<\/h2>\n\n\n\n<p>Remember <span class=\"katex math inline\">X<\/span> is a distribution of loss. If we know the distribution of Portfolio Return <span class=\"katex math inline\">R<\/span>, <span class=\"katex math inline\">R\\sim N(\\mu, \\sigma^2)<\/span>, then what is the dist for <span class=\"katex math inline\">X<\/span>?<\/p>\n\n\n\n<p>$$X \\sim N(-\\mu, \\sigma^2)$$<\/p>\n\n\n\n<p>Right! Loss is just the <strong>negative<\/strong> return. Also, the volatility would not be affected by plus \/ minus.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Expected Shortfall (ES)<\/h1>\n\n\n\n<p>Expected Shortfall states the Expected Loss during time T conditional on the loss being greater than the <span class=\"katex math inline\">c^{th}<\/span> percentile of the loss distribution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Notation<\/h2>\n\n\n\n<p>$$ ES_c (X) = \\mathbb{E}\\bigg[ X|X\\leq VAR_c(X) \\bigg] $$<\/p>\n\n\n\n<ul><li>Be attention here, <span class=\"katex math inline\">X<\/span> is a <strong>r.v.<\/strong>, and <span class=\"katex math inline\">x<\/span> stands for return here! while the only variable in the <span class=\"katex math inline\">ES_c(X)<\/span> is <span class=\"katex math inline\">c<\/span>, <strong>the confidence level<\/strong>, instead of <span class=\"katex math inline\">X<\/span>.<\/li><li>$c$ is the confidence level, i.e. $c$ = 99%.<\/li><li>If <span class=\"katex math inline\">x<\/span> stands for return, then the VaR is the left-tail, <span class=\"katex math inline\">z_{1-c}<\/span>.<\/li><\/ul>\n\n\n\n<p>$$ ES_c (X) = \\mathbb{E}\\bigg[ X|X\\geq VAR_c(X) \\bigg] $$<\/p>\n\n\n\n<ul><li>If <span class=\"katex math inline\">x<\/span> stands for loss (, which is the negative of return ), then the VaR is the right-tail, <span class=\"katex math inline\">z_{c}<\/span>.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Derivation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Notation Form<\/h3>\n\n\n\n<p>Consider, <span class=\"katex math inline\">x<\/span> is the return, then <span class=\"katex math inline\">ES_c (X) = \\mathbb{E}\\bigg[ X|X\\leq VAR_c(X) \\bigg]<\/span>, and <span class=\"katex math inline\">VaR_c(x)= \\mu + z_{1-c}\\sigma<\/span>, where <span class=\"katex math inline\">c<\/span> is the confidence level <span class=\"katex math inline\">c=99\\%<\/span> for example.<\/p>\n\n\n\n<p>$$ES_c(X) = \\frac{\\int_{-\\infty}^{VaR} xf(x)dx }{\\int_{-\\infty}^{VaR} f(x)dx } = \\frac{\\int_{-\\infty}^{VaR} x \\phi(x)dx }{\\int_{-\\infty}^{VaR} \\phi(x)dx } =\\frac{\\int_{-\\infty}^{VaR} x \\phi(x)dx }{ \\Phi(VaR) &#8211; \\Phi(-\\infty)} $$<\/p>\n\n\n\n<p>$$= \\frac{1}{ \\Phi(VaR) &#8211; \\Phi(-\\infty) }\\int_{-\\infty}^{VaR}x \\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{-\\frac{(x-\\mu)^2}{2\\sigma^2}} dx $$<\/p>\n\n\n\n<p>Replace <span class=\"katex math inline\">z = \\frac{x-\\mu}{\\sigma}<\/span>, then <span class=\"katex math inline\">x = \\mu + z \\sigma<\/span>, and <span class=\"katex math inline\">dx = \\sigma dz<\/span><\/p>\n\n\n\n<p>$$ = \\frac{1}{\\Phi(VaR)} \\int_{-\\infty}^{VaR}(\\mu + z\\sigma) \\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{-\\frac{z^2}{2}}\\sigma dz $$<\/p>\n\n\n\n<p>$$ = \\frac{1}{\\Phi(VaR)}\\mu \\int_{-\\infty}^{VaR}\\frac{1}{\\sqrt{2\\pi }} e^{-\\frac{z^2}{2}} dz + \\sigma^2\\int_{-\\infty}^{VaR} z \\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{-\\frac{z^2}{2}} dz $$<\/p>\n\n\n\n<p>$$ = \\frac{1}{\\Phi(VaR)}\\mu \\Phi(VaR) &#8211; \\frac{\\sigma^2}{\\Phi(VaR)}\\int_{-\\infty}^{VaR} \\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{-\\frac{z^2}{2}} d(-\\frac{z^2}{2}) $$<\/p>\n\n\n\n<p>$$ = \\mu &#8211; \\frac{\\sigma^2}{\\Phi(VaR)} \\frac{1}{\\sqrt{2\\pi \\sigma^2}} \\int_{-\\infty}^{VaR} e^{-\\frac{z^2}{2}} d(-\\frac{z^2}{2}) $$<\/p>\n\n\n\n<p>$$ = \\mu &#8211; \\frac{\\sigma}{\\Phi(VaR)} \\frac{1}{\\sqrt{2\\pi }} e^{-\\frac{z^2}{2}} |_{-\\infty}^{VaR} $$<\/p>\n\n\n\n<p>$$ = \\mu &#8211; \\frac{\\sigma}{\\Phi(VaR)} \\frac{1}{\\sqrt{2\\pi }} e^{-\\frac{VaR^2}{2}}= \\mu &#8211; \\frac{\\sigma}{\\Phi(VaR)} \\phi(VaR)$$<\/p>\n\n\n\n<p>Recall, <span class=\"katex math inline\">VaR_c(x)= \\mu + z_{1-c}\\sigma<\/span>, so <span class=\"katex math inline\">\\phi(VaR_c(x))= \\phi(\\mu + z_{1-c}\\sigma) \\leftrightarrow \\phi(z_{1-c}) = \\phi\\bigg( \\Phi^{-1}(1-c) \\bigg)<\/span>, and <span class=\"katex math inline\">\\Phi(VaR_c(x))= \\Phi(\\mu + z_{1-c}\\sigma) \\leftrightarrow \\phi(z_{1-c}) = \\Phi\\bigg( \\Phi^{-1}(1-c) \\bigg) = 1-c<\/span>.<\/p>\n\n\n\n<p>Thus,<\/p>\n\n\n\n<p>$$ ES_c(X) =\\mu &#8211; \\frac{\\sigma}{\\Phi(VaR)} \\phi(VaR)=\\mu -\\sigma \\frac{\\phi\\big( \\Phi^{-1}(1-c) \\big)}{1-c}$$<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">VaR Form<\/h3>\n\n\n\n<p>we &#8216;sum up&#8217; (integrate) the VaR from <span class=\"katex math inline\">c<\/span> to <span class=\"katex math inline\">1<\/span>, conditional on <span class=\"katex math inline\">1-c<\/span>.<\/p>\n\n\n\n<p>$$ES_c(X) = \\frac{1}{1-c} \\int_c^1 VaR_u(X)du$$<\/p>\n\n\n\n<p>$$ ES_c(X) = \\frac{1}{1-c} \\int_c^1 \\bigg( \\mu + \\sigma\\cdot \\Phi^{-1}(1-u) \\bigg) du $$<\/p>\n\n\n\n<p>$$ =\\mu + \\frac{\\sigma}{1-c} \\int^1_c \\Phi^{-1}(1-u) du $$<\/p>\n\n\n\n<p>We let <span class=\"katex math inline\">u = \\Phi(Z)<\/span>, where <span class=\"katex math inline\">Z \\sim N(0,1)<\/span>. Then,<\/p>\n\n\n\n<ul><li>$du =d(\\Phi(z)) =\\phi(z) dz$.<\/li><li>$u\\in (c,1)$, so $z = \\Phi^{-1}(u)\\in (z_c \\ , \\infty)$<\/li><\/ul>\n\n\n\n<p>Thus,<\/p>\n\n\n\n<p>$$ ES_c(X) =\\mu + \\frac{\\sigma}{1-c} \\int^{\\infty}_{z_c} \\Phi^{-1}\\big(1-\\Phi(z)\\big)\\phi(z) dz $$<\/p>\n\n\n\n<p>As <span class=\"katex math inline\">1-\\Phi(z) = \\Phi(-z)<\/span><\/p>\n\n\n\n<p>$$ ES_c(X) =\\mu + \\frac{\\sigma}{1-c} \\int^{\\infty}_{z_c} \\Phi^{-1}(\\Phi(-z))\\phi(z) dz = \\mu &#8211; \\frac{\\sigma}{1-c} \\int^{\\infty}_{z_c} z\\phi(z) dz $$<\/p>\n\n\n\n<p>$ \\int_{z_c}^{\\infty} z \\phi(z)dz = \\int_{z_c}^{\\infty} z \\frac{1}{\\sqrt{2\\pi}}e^{-\\frac{z^2}{2}}dz = -\\frac{1}{\\sqrt{2\\pi}} \\int_{z_c}^{\\infty} -e^{\\frac{z^2}{2}}d(e^{-\\frac{z^2}{2}})$<\/p>\n\n\n\n<p>$=\\frac{1}{\\sqrt{2\\pi}}e^{-\\frac{z_c^2}{2}}=\\phi(z_c)=\\phi\\big(\\Phi^{-1}(c)\\big)$, bring it back to $ES_c(X)$<\/p>\n\n\n\n<p>$$ES_c(X) = \\mu &#8211; \\sigma\\frac{ \\phi\\big(\\Phi^{-1}(c)\\big)}{1-c}$$<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Morden Portfolio Theory<\/h2>\n\n\n\n<ul><li>$x$ &#8211; vector weights<\/li><li>$R$ &#8211; vector of all assets&#8217; returns<\/li><li>$\\mu = \\mathbb{E}(R)$ &#8211; mean return of all assets<\/li><li>$\\Sigma = \\mathbb{E}\\bigg[ (R-\\mu)(R-\\mu)^T \\bigg]$ &#8211; var-cov matrix of all assets<\/li><\/ul>\n\n\n\n<p>So,<\/p>\n\n\n\n<ul><li>$\\mu_x = x^T \\mu$ &#8211; becomes a scalar now<\/li><li>$\\sigma^2 = x^T \\Sigma x$ &#8211; collapse to be a scalar<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Optimisation<\/h3>\n\n\n\n<ul><li>Maximise Expected Return s.t. volatility constraint.<\/li><\/ul>\n\n\n\n<p>$$ \\max_{x} \\mu_x \\quad s.t. \\quad \\sigma_x \\leq \\sigma^* $$<\/p>\n\n\n\n<ul><li>Minimise Volatility s.t. return constraint.<\/li><\/ul>\n\n\n\n<p>$$ \\min_{x} \\sigma_x \\quad s.t. \\quad \\mu_x \\geq \\mu^* $$<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Portfolio Risk Measures<\/h2>\n\n\n\n<p>By definition, the loss of a portfolio is the negative of return, <span class=\"katex math inline\">L(x) = -R(x)<\/span>.<\/p>\n\n\n\n<p>The Loss distribution becomes the same normal distribution with x-axis reversed.<\/p>\n\n\n\n<ul><li>Volatility of Loss: <span class=\"katex math inline\">\\sigma(L(x)) = \\sigma_x<\/span>, the minus does not matter in the s.d.<\/li><li>Standard Deviation-based risk measure: <span class=\"katex math inline\">=\\mathbb{E}(L(x)) + cz_{c}\\sigma(L(x))<\/span>, x-axis is revered, so <span class=\"katex math inline\">z_{1-c}<\/span> for return becomes <span class=\"katex math inline\">z_c<\/span> for loss.<\/li><li>VaR: <span class=\"katex math inline\">VaR_{\\alpha}(x)=inf\\bigg{ \\mathscr{l}:Prob\\big[ L(x)\\leq \\mathscr{l} \\geq\\big] \\alpha \\bigg}<\/span><\/li><li>Expected Shortfall: <span class=\"katex math inline\">ES_{\\alpha}(x) = \\frac{1}{1-\\alpha} \\int_{\\alpha}^1 VaR_u(x) du<\/span>. In other form, <span class=\"katex math inline\">ES_{\\alpha}(x)=\\mathbb{E}\\bigg( L(x)| L(x)\\geq VaR_{\\alpha}(x) \\bigg)<\/span><\/li><\/ul>\n\n\n\n<p>As <span class=\"katex math inline\">R \\sim N(\\mu, \\Sigma)<\/span>,<\/p>\n\n\n\n<ul><li>for our portfolio with weights <span class=\"katex math inline\">x<\/span>, <span class=\"katex math inline\">mean = \\mu<\/span>, and <span class=\"katex math inline\">\\sigma_x = \\sqrt{x^T \\Sigma x}<\/span>.<\/li><li>for the loss, <span class=\"katex math inline\">mean = -\\mu<\/span>, and <span class=\"katex math inline\">\\sigma_x = \\sqrt{x^T \\Sigma x}<\/span>.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Value at Risk &#8211; VaR VaR is a probability statement about the potential change in the value of a portfolio. Notation $$Porb(x\\leq VaR(X))= 1-c$$ $$ Prob\\bigg(z \\leq \\frac{VaR(X)-\\mu}{\\sigma}\\bigg)=1-c $$ $c$ &#8211; confidence interval, i.e. $c=99\\%$. Then $1-c = 1\\% $ $\\mu$ and $\\sigma$ are for $X$. For Example, if X is yearly return, then \\mu_{252days}=252\\cdot\\mu_{1day}, &hellip; <a href=\"https:\/\/fanyuzhao.com\/?p=5535\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Value at Risk &#038; Expected Shortfalls<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6,26],"tags":[],"_links":{"self":[{"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=\/wp\/v2\/posts\/5535"}],"collection":[{"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5535"}],"version-history":[{"count":4,"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=\/wp\/v2\/posts\/5535\/revisions"}],"predecessor-version":[{"id":5539,"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=\/wp\/v2\/posts\/5535\/revisions\/5539"}],"wp:attachment":[{"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fanyuzhao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}