how to generate random data (dichotomous 0-1) with normal distrubition
Ältere Kommentare anzeigen
Hello, I am a measurement and evaluation student and I want to generate [10000,10] random data with matlab. But these data includes only 0 and 1 and has a normal distrubition. First I used binornd function, but the data I generated did not have normal distrubition. Then I used normrnd function, but the datas I created has decimal points and some of them are negative. Please help me... Beril
1 Kommentar
RNTL
am 27 Mär. 2012
If your set contain only two values, namely [0,1] how can it has normal distribution?
Your set should be defined by a probability function that is nonzero only for those two values, hence it cannot be derived from normal distribution.
Antworten (3)
RNTL
am 27 Mär. 2012
1 Stimme
If your set contain only two values, namely [0,1] how can it has normal distribution? Your set should be defined by a probability function that is nonzero only for those two values, hence it cannot be derived from normal distribution
Image Analyst
am 27 Mär. 2012
Maybe you want randi
zerosAndOnes = randi(2, [1 1000]) - 1
but it's not going to be a normal distribution. That's impossible with only two values.
3 Kommentare
Andrei Bobrov
am 27 Mär. 2012
Hi Image Analyst! From randi - help: randi - Uniformly distributed pseudorandom integers...
Jonathan Sullivan
am 27 Mär. 2012
I think when he says "normally" distributed, I think he means *uniformly* distributed. That's my guess.
Image Analyst
am 27 Mär. 2012
andrei: yep. Jonathan: maybe he wants a random distribution where there are equal numbers of 1's and 0's??? Maybe if those numbers are equal he's calling *that* normal or uniform. Or maybe he just doesn't care anymore and went away. I don't know why Beril is not clearing this up.
Selin Soguksu
am 28 Mär. 2012
0 Stimmen
1 Kommentar
Daniel Shub
am 28 Mär. 2012
This cannot be a normal distribution. If I create a 1e4x30 matrix of 0 or 1, the total will always be an integer between 0 and 30. Are you sure you do not want a binomial distribution? Is the score on item i independent from the score on item j?
Kategorien
Mehr zu Noncentral t Distribution finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!