Can anyone help me with how seed works in Stata for drawing sample from multiple data sets?
I have two data sets A and B, each contains 400 observations and each data set is divided into 4 groups (100 observations in each group). I would like to draw 30 observations from each group for each data set and make sure it is reproducible.
I tried two methods:
1. I load data set A, set seed 12345, sample 30, count by(group). Then I load data set B, sample 30, count by(group). At the end of sample data set A and begin of sample data set B, I use command display c(seed) to make sure the seed displayed are the same.
2. I append data set B to data set A (label data set with A and B), then set seed 12345, sample 30, by(group data).
My question is: how come the result sample using these two methods are different? Actually, the result sample for data set A is the same between two methods and for B are different. Can anyone please explain to me how seed works in Stata sampling?
Thank you very much for your help!
Related Posts with Question about using one seed to draw sample from multiple data set.
Users of SEM: Updated command: swainHi: For those who uses SEM models, you may be aware that the chi-square test of fit is not properly…
Is this the proper use of theTwo-Stage Least Squares (2SLS) Regression AnalysisHello, I can't show my data or real variable names but I have a question about whether what I want …
capture the trend in variable constructionI would like to write the code to construct the following variable. Cost stickiness it = 𝑙𝑜𝑔(ΔCo…
How to place significant stars infront of standard errors but still maintain the wide formatHi, I'm trying to get an esttab table that looks like table 1 attached. specifically, i want the sta…
vector of control variables for panel datai want to know the command to get vector of control variable. I want to get vector of country level …
Subscribe to:
Post Comments (Atom)
0 Response to Question about using one seed to draw sample from multiple data set.
Post a Comment