[R] how to generate balanced sample from two normal distribution

gcheer3 gcheer3 at gmail.com
Sun Nov 22 22:21:01 CET 2009


Good afternoon,

I have a question on generating simple randomization data. Thanks for any
suggestions.

Two normal distribution N(0,1) and N(1,1)

A: I want to generate 20 data, 10 from N(0,1) and 10 from (1,1). each
observation's indicator (either is from N(0,1) or N(1,1) ) is randomized. I
need use the frist 10 data from the generated 20 dataset. (it is not
necessary 5 from N(0,1) and 5 from N(1,1) for these 10 data, since the
indicator for the 20 data is randomized) . For example, the 10 data's
indicator could be 0 0 0 1 0 1 1 0 0 0  (0 means the observation is from
N(0,1) and 1 indicates the observations is from N(1,1))

B: still the same 20 data generate data above. I want the indictor is forced
to be balanced in the first 10 data. That is, if I use the first 10 data, 5
are from N(0,1) and 5 are from (1,1). For example, the 10 data's indicator
could be 0 1 1 0 0 1 0 1 1 0 

How can I generate the 20 data . Sorry it is a little confusing. I want to
generate the data not the indicator. The dataset I want to generated in A is
not balanced for the frist 10, in B it is balanced in the first 10. I want
to use the same dataset, how can I use to method to randomize it.

Thanks
-- 
View this message in context: http://old.nabble.com/how-to-generate-balanced-sample-from-two-normal-distribution-tp26467900p26467900.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list