Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Correct syntax for cumulative probability function and standard normal density function

    Dear Statalisters,

    Perhaps a silly question, but I am trying to generate two variables: CEO delta and CEO vega using the formulas below. I am wondering if I am doing it right because some of the results I am getting are weird. For example: when I generate normal(d1) all results are 1, which seems strange to me because then the effect of varying values of d1 has no effect.
    normalden(d1) give me 0 for all variables, which makes all values of vega also zero.

    INPUTS

    Z = d1 = (ln(S/X) + T(r - d + SIGMA^2/2) / SIGMA(T)^0.5

    Stata Syntax used
    N = normal()
    N' = normalden()
    euler's e = exp()

    Option value formula definitions
    * N = cumulative probability function for the normal distribution
    * S = price of the underlying stock
    * X = exercise price of the option
    * sigma = the anticipated stock return volatility during the maturity period of the option
    * r = natural logarithm of risk-free interest rate
    * T = time to maturity of the option in years
    * e = Euler's exponential base number
    * d_w = natural logarithm of expected dividend yield over the life of the option
    * N' = the (standard) normal density function


    Code:
    gen d1 = ((ln(S/X)) + (T*(r - d_w + (sigma^2/2)))) / sigma*(T^0.5)
    
    gen delta = (exp(-d_w*T))*(normal(d1))*(S/100)
    
    gen vega = (exp(-d_w*T))*(normalden(d1))*S*(T^0.5)*0.01
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long gvkey int fyear float(S X sigma r T) double d_w float(d1 delta normal normalden)
    1004 2001 11.44     .  25.8477  .04898062         .    .0139860138297081         .         . . .
    1004 2002   4.5     . 81.84596  .04506896         .  .009770784759894013         .         . . .
    1004 2003  9.58     .  61.2466  .03931686         .  .006513856506596009         .         . . .
    1004 2004 16.04     . 41.78387   .0418135         .  .001851851896693309         .         . . .
    1004 2005 24.08     . 35.23833  .04200529         .                    0         .         . . .
    1004 2006  32.5 14.96 34.55156  .04650184  6.109589                    0 260.96475      .325 1 0
    1004 2006  32.5  23.5 34.55156  .04659728  2.589041                    0 71.989815      .325 1 0
    1004 2006  32.5 22.41 34.55156  .04650184 4.3643837                    0  157.5498      .325 1 0
    1004 2006  32.5 14.96 34.55156  .04650184 4.3643837                    0 157.57423      .325 1 0
    1004 2006  32.5 16.18 34.55156  .04650184  6.109589                    0 260.95917      .325 1 0
    1004 2006  32.5 22.41 34.55156  .04650184 4.3643837                    0  157.5498      .325 1 0
    1004 2006  32.5 17.97 34.55156  .04650184  7.142466                    0  329.8406      .325 1 0
    1004 2006  32.5 22.41 34.55156  .04640637  5.109589                    0  199.5737      .325 1 0
    1004 2006  32.5 14.96 34.55156  .04650184  7.142466                    0  329.8548      .325 1 0
    1004 2006  32.5 16.18 34.55156  .04650184  6.109589                    0 260.95917      .325 1 0
    1004 2006  32.5  23.5 34.55156  .04707441 1.5863013                    0   34.5302      .325 1 0
    1004 2007 19.28 22.41 44.82449  .04258045 3.3643835                    0 138.30652     .1928 1 0
    1004 2007 19.28 22.41 44.82449   .0429637  4.109589                    0  186.7178     .1928 1 0
    1004 2007 19.28 16.18 44.82449   .0433468  5.109589                    0 258.87964     .1928 1 0
    1004 2007 19.28     . 44.82449  .04526013         .                    0         .         . . .
    1004 2007 19.28 17.97 44.82449  .04372976  6.142466                    0  341.2112     .1928 1 0
    1004 2007 19.28 22.41 44.82449  .04258045 3.3643835                    0 138.30652     .1928 1 0
    1004 2007 19.28  23.5 44.82449  .04267627  1.589041                    0  44.89032     .1928 1 0
    1004 2007 19.28 16.18 44.82449   .0433468  5.109589                    0 258.87964     .1928 1 0
    1004 2008  14.7 16.18 78.14695 .024887715  4.106849                    0  325.1961      .147 1 0
    1004 2008  14.7 22.41 78.14695  .01990066 2.3616438                    0 141.80157      .147 1 0
    1004 2008  14.7     . 78.14695 .035946127         .                    0         .         . . .
    1004 2008  14.7 22.41 78.14695 .022152804 3.1068494                    0  213.9667      .147 1 0
    1004 2008  14.7 22.41 78.14695  .01990066 2.3616438                    0 141.80157      .147 1 0
    1004 2008  14.7 16.18 78.14695 .024887715  4.106849                    0  325.1961      .147 1 0
    1004 2008  14.7 17.97 78.14695 .027615167  5.139726                    0  455.2924      .147 1 0
    1004 2009  19.7  15.1 48.77288 .032079894 10.120548                    0  785.1919      .197 1 0
    1004 2009  19.7     . 48.77288 .032079894         .                    0         .         . . .
    1004 2009  19.7 22.41 48.77288 .009554213 2.1068494                    0  74.57269      .197 1 0
    1004 2009  19.7 16.18 48.77288 .014198719 3.1068494                    0 133.55405      .197 1 0
    1004 2009  19.7 17.97 48.77288 .018036364  4.139726                    0  205.4095      .197 1 0
    1004 2009  19.7 16.18 48.77288 .014198719 3.1068494                    0 133.55405      .197 1 0
    1004 2009  19.7 22.41 48.77288  .00468899 1.3616438                    0  38.74457      .197 1 0
    1004 2009  19.7 22.41 48.77288  .00468899 1.3616438                    0  38.74457      .197 1 0
    1004 2010 26.39 17.27 36.93339 .031692445 10.117808 .0009473285948236784  594.3813 .26138264 1 0
    1004 2010 26.39 16.18 36.93339 .006975614 2.1068494 .0009473285948236784  56.49254  .2633738 1 0
    1004 2010 26.39  15.1 36.93339  .02975296  9.120548 .0009473285948236784   508.719 .26162967 1 0
    1004 2010 26.39 16.18 36.93339 .006975614 2.1068494 .0009473285948236784  56.49254  .2633738 1 0
    1004 2010 26.39 22.41 36.93339 .003194891 1.1068493 .0009473285948236784  21.50886 .26362342 1 0
    1004 2010 26.39     . 36.93339 .031692445         . .0009473285948236784         .         . . .
    1004 2010 26.39 17.97 36.93339 .011038847  3.139726 .0009473285948236784 102.75694 .26311624 1 0
    1004 2011 12.05 17.27 46.87533 .025375307  9.117808  .009246083907783031   645.269  .1107578 1 0
    1004 2011 12.05 16.18 46.87533 .001798382 1.1068493  .009246083907783031 27.285936  .1192731 1 0
    1004 2011 12.05     . 46.87533 .027420595         .  .009246083907783031         .         . . .
    1004 2011 12.05 16.18 46.87533 .001798382 1.1068493  .009246083907783031 27.285936  .1192731 1 0
    end
    Last edited by Shaquille Wijngaarde; 06 Oct 2018, 07:11.

  • #2
    Look at the values of d1. They range between about 20 and about 800. In any event, they are light years away from the center of the standard normal distribution. You are getting zeroes and ones because there is a limit to the precision with which the results can be represented. But the actual values of normal(d1) and normalden(d1) for this range of values of d1 are equal to 1 and 0, respectively, to within at least 50 decimal places!

    My guess is either that your formula for d1 is incorrect, or you don't actually want to reference the standard normal distribution here but rather some normal distribution with a different mean or standard deviation. As I don't know your context, I can't advise more specifically.

    Comment


    • #3
      Hi Clyde Schechter,

      I have the same problem. In attached picture*, "the cumulative density function of the standard normal distribution" is the function -normal()- in Stata, isn't it?

      * Vassalou, Maria, and Yuhang Xing. "Default risk in equity returns." The journal of finance 59.2 (2004): 831-868.


      Click image for larger version

Name:	Screenshot 2019-04-08 20.46.46.png
Views:	1
Size:	328.0 KB
ID:	1492400

      Last edited by Linh Nguyen; 08 Apr 2019, 12:53.
      --------------------
      (Stata 15.1 MP)

      Comment


      • #4
        I have the same problem. In attached picture*, "the cumulative density function of the standard normal distribution" is the function -normal()- in Stata, isn't it?
        Most likely. The normal() function in Stata calculates what is correctly referred to as the (cumulative) distribution function of the standard normal distribution. Strictly speaking "cumulative density function" is a contradiction in terms, but I have commonly seen it used to mean the distribution function. So it is most likely that this is what the authors meant.

        But I cannot be 100% certain as I do not see anything on that page that elaborates or clarifies it. I cannot infer the interpretation from its context in the formula because I have no idea what the Black and Sholes formula for call options is.

        Comment

        Working...
        X