If you have a table and want to separate some data into columns according to certain conditions:
Let's assume we have the following table:
fr = Subscript[x, 1] Subscript[x, 2] +
Subscript[x, 1] Subscript[x, 3] -
Subscript[x, 1] Subscript[x, 2] Subscript[x, 3] ;
(data = Tuples[{0, 1}, 3]) // MatrixForm; LLR1 = {Block[{Subscript},
Do[Subscript[x, j] = Transpose[data][[j]], {j, 3}];
fr]}/(Binomial[2, {data[[All, 1]] + data[[All, 2]]}] Binomial[
1, {data[[All, 3]]}]);
(table = Prepend[
Transpose@
Join[{Range@Length@data},
Transpose@
data, {data[[All, 1]] + data[[All, 2]]}, {data[[All, 3]]},
LLR1], Flatten[{"order", Subscript["x", #] & /@ Range[3], "l1",
"l2", "f", "h0", "h1", "h2"}]]) // Grid[#, Frame -> All] &
We set the condition to form column h2:
(If $x_1x_2=1$ take the value of f)
We set the condition to form column h1:
(h1=f-h2)
We set the condition to form column h0:
(h0 is the complement of f)
The result should be as follows
Thanks for the help