Re: [R] Combining multiple probability weights for the sample() function.

2015-06-03 Thread Daniel Nordlund
On 6/3/2015 11:26 AM, Boris Steipe wrote: If letters 1 and 2 must be equal with p=0.5, and 1 and 3 must be equal with p=0.5, then letter 1 must be the same as either 2 or 3. Therefore: Choose a letter. Make a pair of (letter, (not letter)). Reverse the pair with p = 0.5 Concatenate your letter

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-03 Thread Boris Steipe
If letters 1 and 2 must be equal with p=0.5, and 1 and 3 must be equal with p=0.5, then letter 1 must be the same as either 2 or 3. Therefore: Choose a letter. Make a pair of (letter, (not letter)). Reverse the pair with p = 0.5 Concatenate your letter and the pair. Is that what you need? B.

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-02 Thread Jim Lemon
Hi Ben, While Jean's answer looks correct, I think that there is something amiss with your specification of the problem. You have eight combinations in your "possibilities". So if you draw samples "x" where: If p(x = possibilities[1,] | possibilities[5,]) = 0.5 AND p(x = possibilities[2,] | possi

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-02 Thread Adams, Jean
Ben, Perhaps I am missing something, but couldn't you simply reduce your possibilities to: possibilities[c(1, 5, 2, 4), ] Var1 Var2 Var3 [1,] "A" "A" "C" [2,] "A" "A" "T" [3,] "C" "A" "C" [4,] "C" "G" "C" If you sample from these four rows you will have a 50% chance that Var1 and Va

[R] Combining multiple probability weights for the sample() function.

2015-06-02 Thread Benjamin Ward (ENV)
Dear R-List, I have a set of possibilities I want to sample from: bases <- list(c('A', 'C'), c('A', 'G'), c('C', 'T')) possibilities <- as.matrix(expand.grid(bases)) >possibilities Var1 Var2 Var3 [1,] "A" "A" "C" [2,] "C" "A" "C" [3,] "A" "G" "C" [4,] "C" "G" "C" [5,] "A" "A" "T" [6,]