I created a data with 100,000 obs with uniform distribution and also created information for education and wage, but now, from this data I have to create 500 samples random (each one has to be different) but I tried with bsample and it didn't work, so I read about forvalue and foreach (to apply a loop), but I'm not sure how use it, I was trying but I really need help. This is how I created the data:
set obs 100000
set seed 20
gen x=_n
gen educ= 1 + (4-1)*uniform()
sum educ
gen error= 0.5+1*invnorm(uniform())
gen leduc=log(educ)
gen lwage=0.35*leduc+error
gen wage=(educ^0.35)*exp(error)
Related Posts with multiple random sample from a data
considering inter eyes correlation in spearman analysis(mixed model)Hi I am working on retinal thickness of 68 eyes measured by 2 devices. I calculated the spearman co…
Sum distanct values of a variable by groupHey everyone, I have a very easy question, but I am just not solving it. Let's suppose I have two d…
linear hurdle modelsDear statalists I need your help regarding hurdle models, please. Particularly I am interested on 1…
Negative values for categorical variable.Hello, I have been using R but started learning STATA recently. To briefly introduce what I have be…
how to create tempfile named according to value of a local in a loop?Hi! I have 19 files, and want Stata to create a tempfile for each one, but named differently. How m…
Subscribe to:
Post Comments (Atom)
0 Response to multiple random sample from a data
Post a Comment