Announcement

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

  • How to Write codes to Draw a Sample Mean from Uniform distribution with Sample Size of 500

    Dear all,


    I am using Stata 16, on mac. I need help writing codes to draw a sample mean from a uniform distribution with sample size of 500

    Thank you in advance for your help


    Jason Browen

  • #2
    What do you mean by this? You can't "draw" a sample mean. You can draw a sample from a uniform distribution and then calculate its mean. If that's what you want:

    Code:
    set seed 1234 // OR YOUR PREFERRED RANDOM NUMBER SEED
    set obs 500
    gen x = runiform()
    sum
    Note: Assumes that by "uniform distribution" you mean the uniform distribution from 0 to 1. If you have different upper and lower limits, use the runiform(lb, ub) function, specifying your lower and upper bounds. See -help runiform()-.

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X