Hello,
I have a dataset with the variable "LeadLevels" (continuous numerical variable, cannot be a negative number, 1104 observations). From this column, I would like to select 10 random samples (without replacement during selection), take the mean of these 10 samples, and then repeat many times (let's say 1000 times). I would like the output means saved in a new document.
So far, Monte Carlo simulation appears to be the best choice. However, I am struggling with coding the command portion (select 10 random samples, average, record result).
. simulate mean, LeadLevel, reps(1000) saving(/Users/caitlynbest/Desktop/Stata output.dta, replace): sample 10, count
invalid 'reps'
r(198);
Any assistance is much appreciated.
Thank you,
Caitlyn
I have a dataset with the variable "LeadLevels" (continuous numerical variable, cannot be a negative number, 1104 observations). From this column, I would like to select 10 random samples (without replacement during selection), take the mean of these 10 samples, and then repeat many times (let's say 1000 times). I would like the output means saved in a new document.
So far, Monte Carlo simulation appears to be the best choice. However, I am struggling with coding the command portion (select 10 random samples, average, record result).
. simulate mean, LeadLevel, reps(1000) saving(/Users/caitlynbest/Desktop/Stata output.dta, replace): sample 10, count
invalid 'reps'
r(198);
Any assistance is much appreciated.
Thank you,
Caitlyn
Comment