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

gcheer3 gcheer3 at gmail.com
Mon Nov 23 02:04:10 CET 2009


Thank you, Dennis.

It really helps. That is what I want, for the first 10 obs in A, it is not
necessary balanced. for the first 10 obs in B, it is balanced. 

But there is one thing I need maybe I didn't say it clear.  I generate 20
observations first, I want permutation in these 20 then select the first
ten. For the SAME 20 observation, I want permutation happens among the first
ten and also the second ten.  How can I use the same dataset (generated 20
observations) to do two kinds of permutations? Thanks a lot.



gcheer3 wrote:
> 
> 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-tp26467900p26471382.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list