Macro - Pearsoncmg

advertisement
Macro
Centlimit n1,n2,Dist,Samp,Xbar
# Dr.William L. Carlson
# Professor of Economics
# St Olaf College
# Northfield MN
55057
# Carlson@Stolaf.edu
# To Execute this Macro in Minitab Type
# %Centlimit "sample size" "Number of Samples" C1 C2 C3
#
#The output includes a histogram and a normal probability plot for the original
#distribution and a histogram and normal probability plot for the sampling
#distribution of sample means
#Macro is Stored as a text file in C:\program files\mtbwin\macros\centlimit.mac
#
#Definition of Variables
#
# n1 Sample size obtained from probability distribution
# n2 Number of samples of size n1 obtained in this simulation
# Dist
Column that contains an empirical distribution from which the random
#
sample is obtained.
# Xbar
Column that contains the sample means from each of the n2 samples
#
obtained in the simulation
# Samp
Column that will be used to generate each of the samples.
#
#
Mconstant n1 n2 k1 k2
Mcolumn Dist Xbar Samp c11 c12 c13 c14
Name Dist 'Random Variable' Xbar 'Mean'
Let c11="Sample Size"
Let c12=n1
Let c13="Number of Samples in Simulation"
Let c14=n2
Note Welcome to the Monte Carlo Sampling Simulation
Note Your simulation will have the parameters
Write 'Terminal' c11-c14
Note If this is not correct type "Exit"
Note and enter the correct parameters
Pause
Brief 0
Do k1=1:n2
Sample n1 Dist Samp;
Replace.
Mean Samp k2
Let xbar(k1)=k2
Enddo
Brief
Describe Dist Xbar;
GNHist.
#Let c11="Sample Size"
#Let c12= n1
#Let c13="Number of Samples in Simulation"
#Let c14=n2
#Write 'Terminal' c11-c14
Endmacro
Download