Friday, August 13, 2010

Finite sampling demonstator

This is a mirror of an article in our extreme-solvers.blogspot.com

Given a finite population S with N elements which may not be unique (some elements are repeated),
we extract a finite sample X with n elements where n < N. The way we extract the n elements may be done in the following manner:

  1. Permutions without replacement.
  2. The ordering of the sample elements is important and a sample element once chosen in the sample may NOT be chosen again.
  3. Permutations with replacement.
  4. The ordering of the sample elements is important and a sample element once chosen in the sample may be chosen again.
  5. Combinations without replacement
  6. The ordering of the sample elements is NOT important and a sample element once chosen to be in the sample is not available again.
  7. Combinations with replacement
  8. The ordering of the sample elements is NOT important and an element chosen to be in the sample may still be chosen again.

The total number of samples for each type of finite sampling above is given in the following table:


Number of Samples
sampling CombinationsPermutations
without replacement $$\frac{N!}{n! (N-n)!}$$ $$\frac{N!}{(N-n)!}$$
with replacement \frac{(N+n-1)}{n!(N-1)!} $$N^n$$



Let $$S = [s_0, s_1, s_2, ....,s_{N-1}]$$. Our generated sample X is actually X = $$[s_{i_0}, s_{i_1}, ...., s_{i_{n-1}}]$$
where the indices $$i_0 to i_{n-1}$$ is sequentially generated by a combinatorial algorithm.

We may be interested in one the following statistic which is a random variable for the totality of all samples:


  1. sample mean
  2. sample sum or total
  3. sample s.d.(standard deviation) (divisor is n-1)
  4. populaton s.d(divisor is n)
  5. sample var (sample variance)(divisor is n-1)
  6. population variance(population variance) (divisor is n)
  7. sample vaiance(sample variance) (divisor is n-1)
  8. sample max (maximum value)
  9. sample min (minimum value)
  10. range (max - min )


We wish to gather data on ALL possible finite samples for the desire statistic,
the mean and standard deviation and of course the distribution table for the statistic which contain the
Columns for statistic, frequency, (rf) relative frequency, (crf) cumulative relative frequency. x rf

Here is a complete example for the sum of the numbers which show up in a throw of three dice:
The population consists of [1,2,3,4,5,6].
The population size is 6.
The sample size is 3.
The ordering is considered important, for example [1,3,2] will be considered different from [3,1,2]. Thus it
is a permutation with replacement.
The "first" sample is [1,1,1] with a total of 3 and the "last" sample is [6,6,6] with a total of 18.
To help with our computations, we use our solvers hosted at www.extreme. to do it for us!

We will only show the generated frequency distribution table as the 216 generated samples is too long for this page.




Sampling Statistic Frequency Distribution Table
xfrf crfx rf(x-mu)^2 rf
3.010.004629629629630.004629629629630.01388888888890.260416666667
4.030.01388888888890.01851851851850.05555555555560.586805555556
5.060.02777777777780.04629629629630.1388888888890.840277777778
6.0100.04629629629630.09259259259260.2777777777780.9375
7.0150.06944444444440.1620370370370.4861111111110.850694444444
8.0210.09722222222220.2592592592590.7777777777780.607638888889
9.0250.1157407407410.3751.041666666670.260416666667
10.0270.1250.51.250.03125
11.0270.1250.6251.3750.03125
12.0250.1157407407410.7407407407411.388888888890.260416666667
13.0210.09722222222220.8379629629631.263888888890.607638888889
14.0150.06944444444440.9074074074070.9722222222220.850694444444
15.0100.04629629629630.9537037037040.6944444444440.9375
16.060.02777777777780.9814814814810.4444444444440.840277777778
17.030.01388888888890.995370370370.2361111111110.586805555556
18.010.004629629629631.00.08333333333330.260416666667
Sum2161.0mean=10.5variance=8.75
std.dev=2.95803989155
Finite Population Parameters, Correction factor=0.774596669241
(N,n)MeanPvarPstdSvarSstd
(6, 3) 3.5 2.91666666667 1.70782512766 3.5 1.87082869339

Visit the solver Extreme Solvers: Stats sampling

Be sure to specify the right parameters for the solver for the above example, see the screen below:

No comments:

Post a Comment