Announcement

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

  • t distribution in STATA

    Hi. I am trying to figure out how to generate in stata a random draw of 10,000 observations from all the t-distributions mentioned in an exercise I have been doing. After that am I gpong to provide the code and a histogram for each one of them.
    I am quite new to stata and am kind of lost. Any suggestions?

  • #2
    The following will generate you 10k observations from t distribution on 5 degrees of freedom:

    Code:
    set obs 10000
    gen t =  rt(5)

    Comment


    • #3
      Hello Wch Kng. Adding to what Joro said, type the following command to see what other random number functions are available to you:

      Code:
      help random_number_functions
      See also these Stata Blog posts: HTH.
      --
      Bruce Weaver
      Email: [email protected]
      Version: Stata/MP 18.5 (Windows)

      Comment


      • #4
        Thanks a lot, guys. It really helps. When I first have started, can I do the same with chi2 command?

        Comment


        • #5
          Yes. From the help for random number functions:
          Code:
              rchi2(df)
                 Description:  chi-squared, with df degrees of freedom, random variates
                 Domain df:    2e-4 to 2e+8
                 Range:        0 to c(maxdouble)

          --
          Bruce Weaver
          Email: [email protected]
          Version: Stata/MP 18.5 (Windows)

          Comment

          Working...
          X