Announcement

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

  • Gauss Error Function in Stata

    Dear All,

    I am writing to seek help on the Error function in Stata. I would like to write a survival function from the cumulative distribution function of lognormal distribution but cannot figure out how the erf (error function) can be implemented in Stata.

    Thank you very much in advance! I look forward to hearing from you!
    Long

  • #2
    I'm no expert here, but Stata does have the normal(z) function given the the cumulative normal probability. My understanding is that normal(z) = 1/2 + 1/2 * erf(-z/sqrt(2)). So, letting
    x = -z/sqrt(2), erf(x) = 2 * normal(-x*sqrt(2)) - 1

    Comment


    • #3
      Mike Lacy Just a minor correction

      normal(z) = 0.5 + 0.5*erf(z/sqrt(2)), which leads to erf(x) = 2*normal(z*sqrt(2))-1

      Comment

      Working...
      X