Announcement

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

  • draws and from a bivariate normal distribution with condition

    Hi,
    I need to draw [IMG]file:///C:\Users\Ernesto\AppData\Local\Temp\msohtmlclip1\0 1\clip_image002.png[/IMG] and [IMG]file:///C:\Users\Ernesto\AppData\Local\Temp\msohtmlclip1\0 1\clip_image004.png[/IMG] from a bivariate normal distribution [IMG]file:///C:\Users\Ernesto\AppData\Local\Temp\msohtmlclip1\0 1\clip_image006.png[/IMG] but I must keep a draw [IMG]file:///C:\Users\Ernesto\AppData\Local\Temp\msohtmlclip1\0 1\clip_image002.png[/IMG] only if it meets a truncation condition [IMG]file:///C:\Users\Ernesto\AppData\Local\Temp\msohtmlclip1\0 1\clip_image008.png[/IMG] where this comes from a selection equation[IMG]file:///C:\Users\Ernesto\AppData\Local\Temp\msohtmlclip1\0 1\clip_image010.png[/IMG]. I tried the "drawnorm" but I don't know how to operate so that the draws meet the condition above.
    Any help will be greatly appreciated.
    Thank you very much.
    Rodriguez

  • #2
    ecarambula (as per FAQ #6, you are kindly asked to post on Statalist using your full real name.Just click on the Contact us button bottom right of the screen to re-register. Thanks):
    I can't see if you already have a bivariate normal distribution to draw from given a constraint or you are after creating a bivariate norma l distribution to draw from given a constraint. In the following example, I will assume the latter:
    Code:
    set seed 12234//Setting seed will ensure that you will obtain the same observations next time you run the code
    matrix C = (1, .5 \ .5, 1)
    drawnorm x y, n(1000) corr(C)//This code draw a sample of 1000 observations from a bivariate standard normal distribution, with correlation 0.5.​ (please, see -help drawnorm-)
    keep if x>.4 & y<=.3
    // -if- is not an option of -drawnorm-, so I put it off in this chunk of code
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you very much Carlo! I have already sent a message with my details, as you told me. Sorry I did not see FAQ6. My name is Ernesto Rodriguez and I am a PhD candidate in Applied Economics at UAB, Barcelona. In my post there was an attach in word format to be more precise. Maybe be I didn't upload it correctly. Thank you for your help! Kind regards, Ernesto

      Comment


      • #4
        Ernesto:
        welcome to this forum and thanks for re-registering.
        Unfortunately, uploading files different from those in Stata formats (usually those with .dta; .do; .smcl extensions) is seldom a good idea, mainly because there's a customary attitude on this forum, shared by most of contributors (me, too), about not to open files with other extensions, due to the risk of downloading nasty macros or contents.
        Posting pictures of your own Stata session is also discouraged, because they're usually unreadable.
        Hence, the recommended way is to post what you typed and what Stata gave you back (as per FAQ #12) via the code delimiters (# icon), that you can easily find among the Advanced editor features (just click on the A icon top right of the reply section and take a look).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X