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
Related Posts with Monte Carlo - Simulations: random samples, record means
rollregHi. I'm using rollreg. There are a number of important (mutually exclusive) parameters to set: move…
Outreg2 titles and panelsDear Stata wizards, I am replicating stata results from a paper and I am unsure how to add "sub col…
Create new Variable: Migration flowsHi, I have a dataset in long form with the variables country of origin, destination country, stock …
estpost ttest with multiple conditions and columnsDear Statalist Community, I'm looking to make a summary statistics table for some of my key variabl…
Controlling for time vs. clustered/robust SEConducting a regression on panel data using xtreg... can someone help me out with the theory behind …
Subscribe to:
Post Comments (Atom)
0 Response to Monte Carlo - Simulations: random samples, record means
Post a Comment