Dear all,
I am using Stata 16, on mac. The following program I included selects a particular number of observations from a Chi-Square distribution.
cap program drop randdraw
program define randdraw
clear
args N distribution
set obs `N'
gen x = `distribution'
sum
end
simulate mean_x =r(mean), reps(1000): randdraw 50 "rchi2(2)"
If I I wanted to write a nested loop that will simulate drawing a sample mean from a uniform distribution, poisson distribution, and beta distribution from with sample sizes of 3, 40, 500, and 1,000, replicate each 500 times and plot a histogram of the resulting distribution of the sample means. So that the first histogram will have 500 observations of sample means taken from 3 observations drawn according to the underlying distribution, the second will have 500 observations of sample means taken from 50 observations, etc. Am I able to use the program that I listed previously?
Thank you in advance for your help
Jason Browen
I am using Stata 16, on mac. The following program I included selects a particular number of observations from a Chi-Square distribution.
cap program drop randdraw
program define randdraw
clear
args N distribution
set obs `N'
gen x = `distribution'
sum
end
simulate mean_x =r(mean), reps(1000): randdraw 50 "rchi2(2)"
If I I wanted to write a nested loop that will simulate drawing a sample mean from a uniform distribution, poisson distribution, and beta distribution from with sample sizes of 3, 40, 500, and 1,000, replicate each 500 times and plot a histogram of the resulting distribution of the sample means. So that the first histogram will have 500 observations of sample means taken from 3 observations drawn according to the underlying distribution, the second will have 500 observations of sample means taken from 50 observations, etc. Am I able to use the program that I listed previously?
Thank you in advance for your help
Jason Browen
Comment