Announcement

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

  • Draw from a normal distribution with truncation

    Hi,

    I am implementing a simulation procedure in Stata and will like to draw from a normal distribution N(0.6, 0.3) truncated on the left at say -0.1. I have not found any routine yet to do this. Any suggestion on how to accomplish it? Thanks in advance.
    Last edited by Eric Owusu; 18 Apr 2020, 12:04.

  • #2
    perhaps something like this:
    Code:
    . set obs 1000
    . gen r=runiform()*.9
    . gen u=invnormal(0.1+r)

    Comment


    • #3
      Thanks Fernando. Because I was not too specific in my earlier post, I'm confused with your suggestion, sorry about that. Just to clarify from your response, 0.9 will be standard deviation? and 0.1 is the truncation point or the mean? I edited my post with specific numbers now, just in case you will like to use those. Thanks.
      Last edited by Eric Owusu; 18 Apr 2020, 12:27.

      Comment


      • #4

        In my example, im drawing random numbers from a truncated standard normal distribution, but truncated at the 10th decile. So, the random variable R will only take values between 0.1-1
        If you run it, you will see it "overlaps" the standard normal distribution, but the lowest value it will take will be:
        display invnormal(0.1)= -1.2815516
        So, for your example, I will first find out what is the "standardized" lower bound (prob that X<-1).
        Draw the standard normal as I suggest gen u=invnormal(0.1+r) (instead of .1 you will use the corresponding value for your data)
        and finally, rescale u to as to be drawn from a Normal distribution with mean .6 and Sd dev 0.3.


        Comment


        • #5
          Ok, let me try it out. Thanks.

          Comment

          Working...
          X