Announcement

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

  • inverse error function

    Are there any implementations of the inverse error function for Stata?

  • #2
    Does this help?

    Comment


    • #3
      Thanks, daniel klein . The earlier thread discussed the error function, while I want the inverse error function. But the basic strategy is similar. I can just transform the results of the invnormal() function. For example, here is the inverse normal function of 0.2:

      Code:
      display invnormal((.2 + 1) / 2) / sqrt(2)
      Bonus round: is is possible to define a new function that calculates the inverse normal function for any argument (not just 0.2).

      Comment


      • #4
        Originally posted by paulvonhippel View Post
        Bonus round: is is possible to define a new function that calculates the inverse normal function for any argument (not just 0.2).
        No. You cannot implement new Stata functions. It's straightforward in Mata, though:

        Code:
        . mata : real matrix inverror(real matrix x) return( invnormal((x:+1)/2)/sqrt(2) )
        
        . mata : inverror((.2,.42,.73))
                         1             2             3
            +-------------------------------------------+
          1 |  .1791434546   .3913020878   .7799830136  |
            +-------------------------------------------+

        Comment


        • #5
          What you can also do is map a variable to a variable:

          Code:
          gen wanted = invnormal((x + 1) / 2) / sqrt(2)

          Comment

          Working...
          X