Question: replacement sampling

How generate all possible samples of size n = 2 that can be drawn with replacement from this population [0,1,2]?

It occurs to me using these commands.

 restart; with(combinat); choose([0, 0, 1, 1, 2, 2], 2);

        [[0, 0], [0, 1], [0, 2], [1, 1], [1, 2], [2, 2]]

 permute([0, 0, 1, 1, 2, 2], 2);

[[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]


But I like not having to repeat the numbers [0,0,1,1,2,2], and go from [0,1,2].

I would like general population sample as follows:

[[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]

is possible to do with the statistical package?...

 

Gracias

Please Wait...