TFQA: Tools for Quantitative Archaeology - Statistical Analysis Software for Archaeology TFQA
TFQA Logo

TFQA: Tools for Quantitative Archaeology
     kintigh@tfqa.com   +1 (505) 395-7979

TFQA Home
TFQA Documentation
TFQA Orders
Kintigh (ASU Directory)


SAMPMEAN: Learn About Sampling

      This simple program is included as a useful tool for teaching about sampling.  It has two views.  A histogram of the current random sample's values, and a histogram of the sample mean values for the samples thus far selected.  When prompted, One toggles between the two views with a "T".

      The program computes a population mean and asks for a sample size and a number of trials. It then picks a random sample (with replacement) of the specified size from the population. It displays on a histogram the location of the population mean with > and with a s for the location of the current sample's mean. Each time "N" is pressed, another sample is selected and its sample mean value is included in the histogram of the sample means. If, at any time, "F" is pressed, the remainder of the trials samples are selected, one by one, and you see all the resulting sample means on the histogram us sample means. Throughout the program execution, running statistics of the samples are listed.


SEQUENCE OF PROGRAM PROMPTS

Name of File with Population Distribution {.TXT} ?

      File with list of integer values. Alternately, enter “CON” and type in any number of values followed by <Ctrl>Z.  The population to be sampled is described in an ASCII text file. The program expects a list of integers separated by blanks, commas, or carriage returns  (or one can answer CON to the request for the file name and type any number of numbers from the keyboard (including carriage returns) followed by a <Ctrl>Z). Either the file or the keyboard-entered list constitutes the (finite) population of integer values under consideration.  A population can be generated by the ADFUTIL program.  But the ADF file must be edited with a plain text editor (like notepad) to remove the header and number of rows and columns.

Sample Size

      Size of the sample drawn with replacement from the population.

Number of Trials ?

      Number of different random samples to be selected.

Histogram Lower Limit {xxx.xx} ?
Histogram Upper Limit {xxx.xx} ?
Histogram Interval {xxx.xx} ?

      This gives the user some control over the histogram of sample values selected and the histogram of the sample means. The defaults should often work, but a neater histogram can be produced is you supply these values. Generally, pick a number for the interval width at least as large as the default value to keep the histogram fitting on the screen. 

[T]oggle Current View, [N]ext Sample, [F]ast ? T

      Hitting T toggles between the sample view and the cumulative view of the sample means.  N goes to the next sample. Hitting F runs through the rest of the samples creating a histogram of the sample means. In the histograms the population mean is shown by a >, the current sample mean by a s, and the grand mean of the sample means as a S.

SAMPLE RUN

File with Any Number of Integer Population Values {.TXT} ? test
Population Values Read: 40
Population Mean:   147.3000
Sample Size ? 10
Number of Trials ? 100
Data Values Range from 6 to 272
Histogram Lower Limit {6} ? 0
Histogram Upper Limit {272} ? 300
Histogram Interval {16.0000} ? 15
Random Generator Seed (0 to set from clock) {0} ?
SampleNo SampMean Cur Mean Std Err Pop Mean Outside 1 154.7000 154.7000 0.0000 147.3000 0 Sample Values (P=Population Mean, s=Current Sample Mean 0.0000 1 |* 15.0000 0 | 30.0000 0 | 45.0000 1 |* 60.0000 0 | 75.0000 1 |* 90.0000 0 | 105.0000 0 | 120.0000 2 |** 135.0000 1 P* 150.0000 0 s| 165.0000 0 | 180.0000 0 | 195.0000 0 | 210.0000 0 | 225.0000 1 |* 240.0000 1 |* 255.0000 1 |* 270.0000 1 |* 285.0000 0 | 300.0000 0 | [T]oggle Current View, [N]ext Sample, [F]ast ? T SampleNo SampMean Cur Mean Std Err Pop Mean Outside 1 154.7000 154.7000 0.0000 147.3000 0 Means of Samples (P=Population Mean, s=Current Sample Mean, S=Mean of Sample Means) 0.0000 0 | 15.0000 0 | 30.0000 0 | 45.0000 0 | 60.0000 0 | 75.0000 0 | 90.0000 0 | 105.0000 0 | 120.0000 0 | 135.0000 0 P 150.0000 1 S|s 165.0000 0 | 180.0000 0 | 195.0000 0 | 210.0000 0 | 225.0000 0 | 240.0000 0 | 255.0000 0 | 270.0000 0 | 285.0000 0 | 300.0000 0 |
[T]oggle Current View, [N]ext Sample, [F]ast ? f
SampleNo  SampMean  Cur Mean   Std Err Pop Mean    Outside
  1  154.7000  154.7000    0.0000 147.3000       0

[T]oggle Current View, [N]ext Sample, [F]ast ? f SampleNo SampMean Cur Mean Std Err Pop Mean Outside 100 126.0000 146.0940 24.9743 147.3000 0 Final Means of Samples (P=Population Mean, s=Current Sample Mean, S=Mean of Sample Means) 0.0000 0 | 15.0000 0 | 30.0000 0 | 45.0000 0 | 60.0000 1 |X 75.0000 2 |XX 90.0000 3 |XXX 105.0000 5 |XXXXX 120.0000 18 |XXXXXXXXXXXXXXXXXs 135.0000 28 SPXXXXXXXXXXXXXXXXXXXXXXXXXXXX 150.0000 24 |XXXXXXXXXXXXXXXXXXXXXXXX 165.0000 13 |XXXXXXXXXXXXX 180.0000 4 |XXXX 195.0000 0 | 210.0000 2 |XX 225.0000 0 | 240.0000 0 | 255.0000 0 | 270.0000 0 | 285.0000 0 | 300.0000 0 | Program End OK to Close Program Window {Y} ?

Test Data

6, 151, 217, 121, 13, 272, 68, 250, 193, 229, 16, 216, 83,
62, 241, 199, 201, 24, 120, 168, 127, 247, 54, 147, 222, 54, 33,
83, 105, 196, 226, 210, 237, 264, 243, 205, 167, 100, 113, 9 
              
              

Page Last Updated: 25 August 2023

Home Top Overview Ordering Documentation