Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
selecting numbers without repetition at similar probability

Subject: selecting numbers without repetition at similar probability

From: Veda

Date: 2 Feb, 2012 15:41:11

Message: 1 of 5

Deae matlab experts,

I would to create a list as follows:
   p1,p2,p3,p4,p5
A: U,U,U,U,H
B1: U,U,U,U,H
B2 :U,U,U,U,U
C1 :U,U,U,U,H
C2 :U,U,U,U,H
D : U,U,U,U,H
The list are created by the following rules:
1, number of each condition (A~D): A=2*B1=2*B2=2*C1=2*C2=D=40, that is I want 40 of As, 40 of Ds and 20 of B1s, B2s, C1s, C2s.
2. ‘U’ could be a, b, c, d, e, f, g, h. But, a~h cannot be selected twice or more in each condition (e.g., in A: ‘aecdH’ is allowed but ‘accdH’ is not allowed.
3. Most importantly, the occurrences of a (or b, or c, or d, or e, or f, or g, or h) are equal across condition A to D. That is, the chances of ‘a’ appears in condition A, B1, B2, C1, C2, D are equal regardless of the positions (i.e., p1~p5). If not possible, the difference of the occurrence of a (or b, or c, or d, or e, or f, or g, or h) between any of two conditions (e.g., A and D) should be within 5%.
I wonder how I could do that. Any advice is appreciated. Thanks!

Sincerely,
Veda

Subject: selecting numbers without repetition at similar probability

From: Roger Stafford

Date: 2 Feb, 2012 19:10:10

Message: 2 of 5

"Veda" wrote in message <jgeaqn$q5q$1@newscl01ah.mathworks.com>...
> 2. ‘U’ could be a, b, c, d, e, f, g, h. But, a~h cannot be selected twice or more in each condition (e.g., in A: ‘aecdH’ is allowed but ‘accdH’ is not allowed.
> 3. Most importantly, the occurrences of a (or b, or c, or d, or e, or f, or g, or h) are equal across condition A to D. That is, the chances of ‘a’ appears in condition A, B1, B2, C1, C2, D are equal regardless of the positions (i.e., p1~p5). ......
- - - - - - - - -
  Your description lacks clarity but your use of the phrase "the chances of" hints that 'randperm' might be useful to you.

Roger Stafford

Subject: selecting numbers without repetition at similar probability

From: Veda

Date: 3 Feb, 2012 09:03:09

Message: 3 of 5

Dear matlab experts,

Allow me to clarify my question:

I would to create a list as follows:
      p1,p2,p3,p4,p5
A: U, U, U, U, H
B1: U, U, U, U, H
B2 :U, U, U, U, U
C1 :U, U, U, U, H
C2 :U, U, U, U, H
D : U, U, U, U, H
A~D: condition names
P1~p5: positions within each condition
U, H: elements in each condition

The list are created by the following rules:
1, number of each condition (A~D): A=2*B1=2*B2=2*C1=2*C2=D=40, that is I want 40 of As, 40 of Ds and 20 of B1s, B2s, C1s, C2s.

2. a, b, c, d, e, f, g, h are selected randomly and are inserted in U and forms a list in condition A like ‘a,d,c,e,H’ and in B2 like ‘b,d,c,e,a,f’. But, a~h cannot be selected twice in each condition (e.g., in A: ?aecdH' is allowed but ?’cecdH’ is not allowed.

3. Most importantly, the occurrences of a (or b, or c, or d, or e, or f, or g, or h) are equal across condition A to D. For example, ‘a’ appears in condition A 14 times, the chance is 14/(40 x 4) where 40 is the condition number and 4 is the possible position of U). then, ‘a’ appears in condition A, B1, B2, C1, C2, D should be equal regardless of the positions (i.e., p1~p5). If not possible, the difference of the occurrence of ‘a’ (or b, or c, or d, or e, or f, or g, or h) between any of two conditions (e.g., A and D) should be within 5%.
Hope this time is clearer!

Sincerely,
Veda



"Roger Stafford" wrote in message <jgen2i$9mj$1@newscl01ah.mathworks.com>...
> "Veda" wrote in message <jgeaqn$q5q$1@newscl01ah.mathworks.com>...
> > 2. ?U' could be a, b, c, d, e, f, g, h. But, a~h cannot be selected twice or more in each condition (e.g., in A: ?aecdH' is allowed but ?accdH' is not allowed.
> > 3. Most importantly, the occurrences of a (or b, or c, or d, or e, or f, or g, or h) are equal across condition A to D. That is, the chances of ?a' appears in condition A, B1, B2, C1, C2, D are equal regardless of the positions (i.e., p1~p5). ......
> - - - - - - - - -
> Your description lacks clarity but your use of the phrase "the chances of" hints that 'randperm' might be useful to you.
>
> Roger Stafford

Subject: selecting numbers without repetition at similar probability

From: Roger Stafford

Date: 3 Feb, 2012 09:41:22

Message: 4 of 5

"Veda" wrote in message <jgg7sd$50u$1@newscl01ah.mathworks.com>...
> Hope this time is clearer! .......
- - - - - - - -
  You still lack clarity, Veda! For example, you don't make clear the distinction between placing fixed numbers of the various letters in the collection of vectors but simply in random positions, or whether you have in mind just statistically expected numbers. To say that "‘a’ appears in condition A 14 times" is a statement about fixed quantities, not a statistical statement. (By the way, the number 14 doesn't make any sense to me. Where do you get it from?)

  Assuming you actually have the statistical meaning in mind, I repeat my advice that 'randperm' will be useful to you in placing a randomly chosen set of non-repeating letters out of seven (or is it eight?) in four (or is it five?) slots. This will not guarantee equal numbers of each throughout the whole set, but merely that their statistically expected numbers will be the same.

Roger Stafford

Subject: selecting numbers without repetition at similar probability

From: Veda

Date: 3 Feb, 2012 10:35:14

Message: 5 of 5

Dear Roger and other matlab experts,

thanks for your patience. Let’s simplify my problems:

I would to create a list as follows:

condition A: U, U, U, U, H
condition B :U, U, U, U, U
Letter a~h are inserted only in the position labeled ‘U’. EX: condition A: ‘a, f, c, r, H’; condition B: ‘a, f, c, r, b’
I want three of A and of B. EX: condition A: ‘a, f, c, r, H’ ; ‘f, e, g, a, H’ ; ‘g, c, d, b, H’ (in this case, the chance of ‘a’ in condition A is 2/(4x3) where 4 is the number of possible position 1-4 and 3 is the number of condition A )
                                                 condition B: ‘a, f, c, r, b ’; ‘f, e, g, a, h’ ; ‘g, c, a, b, d’ (in this case, the chance of a in condition A is 3/(5x3) where 5 is the number of possible position 1-5 and 3 is the number of condition B )
Critically, I want the chance of ‘a’ appearing in condition A and condition B is equal or at least did not differ more than 5% (in the example above, the probability of 'a' in condition A (0.167) and in condition B (0.2) differ by 0.033 which is acceptable).
Any ideas!?

Sincerely,
Veda




"Roger Stafford" wrote in message <jgga42$b63$1@newscl01ah.mathworks.com>...
> "Veda" wrote in message <jgg7sd$50u$1@newscl01ah.mathworks.com>...
> > Hope this time is clearer! .......
> - - - - - - - -
> You still lack clarity, Veda! For example, you don't make clear the distinction between placing fixed numbers of the various letters in the collection of vectors but simply in random positions, or whether you have in mind just statistically expected numbers. To say that "?a' appears in condition A 14 times" is a statement about fixed quantities, not a statistical statement. (By the way, the number 14 doesn't make any sense to me. Where do you get it from?)
>
> Assuming you actually have the statistical meaning in mind, I repeat my advice that 'randperm' will be useful to you in placing a randomly chosen set of non-repeating letters out of seven (or is it eight?) in four (or is it five?) slots. This will not guarantee equal numbers of each throughout the whole set, but merely that their statistically expected numbers will be the same.
>
> Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us