Announcement

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

  • Replicating R's qnorm() function in Stata

    Hi Fellow Statalisters,

    I am trying, unsuccessfully, to replicate the results when using R's qnorm() in Stata. qnorm() is R's equivalent to Stata's invnormal(), but it takes 3 parameters qnorm(p, mean = 0, sd = 0), where p is the signficance level.

    In Stata, invnormal(p) just takes the p value.

    Here is the code in R and the resulting values:

    Code:
     
     qnorm(0.025, 0.0224111282843895, sqrt(0.0043818)) 
    [1] -0.107329
    Code:
     qnorm(0.001, 0.0224111282843895, sqrt(0.0043818)) 
    [1] -0.1821473
    Code:
     qnorm(1-0.025, 0.0224111282843895, sqrt(0.0043818)) 
    [1] 0.1521513
    Code:
     qnorm(1-0.001, 0.0224111282843895, sqrt(0.0043818)) 
    [1] 0.2269696
    I would be grateful for some help on this!

    Thanks!

    Ariel

  • #2
    Code:
    . disp 0.0224111282843895 +invnormal(.025)*sqrt(0.0043818)
    -.10732901
    
    . disp 0.0224111282843895 +invnormal(.001)*sqrt(0.0043818)
    -.18214731
    
    . disp 0.0224111282843895 +invnormal(1- .025)*sqrt(0.0043818)
    .15215127
    
    . disp 0.0224111282843895 +invnormal(1- .001)*sqrt(0.0043818)
    .22696957

    Comment


    • #3
      Wow, thank you, Scott! That certainly works like a charm!

      Comment

      Working...
      X