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.
mplotoffset legend symbolsI want to generate a plot using mplotoffset with a legend that includes line segments and symbols. T…
overlaying two hazard rate plotsDear All, Suppose that I compute the following hazard rates (unfortunately I cannot share the real d…
Dealing with log-binomial convergence problemHi everyone I am looking for a way to change the "weight function of pi" [1/(1-Pi)] in the GLM mode…
Ordinal regression with random factorsI'm try to run an ordinal regression with random factors. I'm using the meologit command. My depende…
When choosing between random and fixed effects models for logistic regressionI understand the assumption for using a random effects model is that the unobserved group-level effe…
Subscribe to:
Post Comments (Atom)
0 Response to Question about using one seed to draw sample from multiple data set.
Post a Comment