GMACRO Sampling ########################################################## #Central Limit Theorem Simulation for a Finite Population# ########################################################## # This macro generates samples from a finite population. The macro is set up to sample # data from column C2 with replacement. To change the column sampled from or to switch # to sampling with replacement, you will need to edit the macro below. # The macro computes the sample mean for each sample and stores these means in column c10. # When the sampling is complete, it generates a histogram and descriptive statistics for # the distribution of these sample means. NOTE NOTE Sampling Distribution Simulation for a Finite Population NOTE NOTE At the 'DATA>' prompt below, enter the desired size for each sample: set c100; file "terminal"; nobs 1. copy c100 k1 NOTE NOTE How many samples do you want to generate? set c100; file "terminal"; nobs 1. copy c100 k2 erase c100 c10 name c10 'sample mean' do k3=1:k2 sample k1 c2 c100; replace. let c10(k3)=mean(c100) enddo hist c10 desc c10 ENDMACRO