Code: Select all
'meanSim.prg
'simulate sample mean
'Dick Startz
'August 2013
!sampleSize =1000
!trials = 1000 'must be greater than or equal to sample size
!mu = 12
!sigma = 2.85
workfile tryit u !trials
vector (!trials) muHat = na
smpl 1 !sampleSize
for !i=1 to !trials
series y = !mu + !sigma*nrnd ' substitute whatever DGP you want
muHat (!i) = @mean(y) ' substitute whatever estimator you want
muHat.distplot
next