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)


ROOMACCUM: Demographic Simulation

This program estimates within-period rates of population growth (or decline) for a sequence of chronological periods based on a knowledge of the number of structures that date to a specific period, the period lengths, and an estimated structure use life. The population growth rate estimates are derived by simulating the construction (due to replacement and population growth) and abandonment (due to the end of use life or population decline) of individual structures such that the observed number of rooms dating to a period matches the simulated number of rooms. The program also calculates the between-period growth rates calculated according to the standard formula. The simulated results may be notably different because the simulation more closely mimics an actual process. A discussion based on an earlier version of the program is provided in Kintigh et al. 2004 (see bibliography).

RoomAccum is a Windows program written in Delphi, an extension of Pascal as implemented in the Embarcadero RAD Studio XE. The program logic can be seen in the program source file roomaccum12.dpr. Supporting procedures not essential to the program logic are in KWKSTD.PAS and are compiled in KWKSTE.DCU.

Running the program

Important information on TFQA programs may be found at http://tfqa.com. See especially, Program Conventions and See especially Running TFQA under Windows. To run the program, copy RoomAccum.exe to a directory that includes the input data files you wish to evaluate (in CSV Format, as described below). Having navigated to that folder, when you doubleclick on RoomAccum.exe the program opens a  Windows "Run" Window . The program will prompt you for information that it needs to run. Default answers are provided in {curly braces} and can be obtained by just pressing Enter. Reply Y or N to yes or no questions.

Sample Input file

The program looks for input from a .txt file that must be saved in the same directory on your computer as the .exe file. The .txt files contains the dates and room counts and can be created using an editor such as NotePad that creates simple .txt files (or saving a Word document as plain text). The file is free format. The program is simply looking for a set of numbers separated by blanks (or commas or tabs) that describe the periods. That file needs to consist of the number of periods to be considered, the starting date for the sequence followed by, for each period, the end date of the period, and the number of rooms dated to that period. All values must be integers and must be separated by at least one space or newline. The input can be on a single line or broken up in any way. It assumes the first number read is the number of periods and the second is the start date of the initial period. Then for each period there is a pair of numbers which represent the end date of the period and the number of rooms dated to that period. In the example file below, there are 3 periods beginning in AD 200. There are 646 rooms dating to 200-550, 1215 dating to 550-1000, etc.

3
200 550 646
1000 1215
1150 4848
Sequence of Program Prompts
              ┌────────────────────────────────────────────────┐
              │                RoomAccum V12.0                 │
              │ Population Growth/Room Accumulation Simulation │
              │                                                │
              │         (C) 1986-2020 Keith W. Kintigh         │
              │              All Rights Reserved               │
              │                                                │
              │              421 Calle Kokopelli               │
              │               Santa Fe, NM 87501               │
              └────────────────────────────────────────────────┘


File with Period Data (Reply CON for Keyboard Entry) {.TXT} ? mimbresp3
File Must Have: nPeriod, Start[1], End[1], Rooms[1], End[2] Rooms[2]...

Provide the name of the file you wish to run. You need not enter the extension if it is the same as the default provided within the curly braces. If the program says it canít find the file you mistyped the name or it is in a different directory.

Display Annual Room Count on Screen {N} ?

Answering Y for yes to this question provides a very verbose output of the program progress.

Write Output Data to TXT File {N} ? Y

Answering Y to this prompt says you want, in addition to the output on the screen, a file with the results. If you answer Y it will ask you for the file name.

TXT Output File {MIMBRESP3_T.txt} ?

If you answered Y to the previous prompt Enter the file name, or if the offered default name is OK, just press Enter.

Write Period by Period Output Data to CSV File {N} ?
Write Annual Output Data to CSV File {N} ?

Similarly, the program asks whether you want other sorts of program output saved to a .csv file by the program. This is useful if you want to plot the results, for example in R.

Random Generator Seed (0 to set from clock) {0} ?
Random Seed: -581923690

You can set a random number generator seed if you wish to be able to reproduce a run exactly (rare). Setting from the clock (the default) is what you will almost always want to do. The program reports the random seed that it uses in case you want to reproduce a run exactly.

Compound Interest Formula Implied Growth Calculation
Period Start   End Implied Growth
 1 - 2   375   775          0.095
 2 - 3   775  1075          0.831

The program uses the standard formula to calculate the implied between-period growth rates, the first of which may be useful in selecting the number of initial rooms. These amount to average growth rates from the midpoint of one period to the midpoint of the next with structure counts standardized to period length.

 [I]terate Growth Rate or [U]ser Control {I} ?

Normally you would iterate the growth date, which means the program will iterate through possible rates for each until it finds the rate the produces the observed number of dated rooms. If you say N it will simply run the program for your supplied rate and tell you the results. Reply Enter or I unless you have a specific reason not to. Under User control (reply U) it will prompt for a growth rate and then run the simulation under user control, allowing multiple runs for a single period, of which only the final run for the period is saved.

Structure Use Life {25} ?
S.D of Structure Use Life (reply 0 for Not Randomized) {0.0} ? 5
Use Lives are Normally Distributed Around 25 with S.D. of 5.0
Use Life Distribution Truncated to: Min=1; Max=2*Structure Life

You first enter the nominal structure use-life. You then have the option to answer 0 (the default) to the next question to use that fixed use-life or to have normally distributed use-lives around your number with a standard deviation that you provide.

Randomly Age Period 1 Structures (Rec. Unless Uselife<<period 1 lengthy) {Y} ?

Ordinarily you would want to randomly age the structures in the initial period unless you believe that there was no previous occupation.

Scale Factor to Improve Estimates {100} ?

In order to make the computations more accurate, the program will scale up all of the room numbers by a factor for its internal computations. This scaling is removed in the results. This basically reduces the sampling error due to ransom processes in the analyses.

Initial Number of Period 1 Rooms {0} ? 30

Here you supply the initial number of period 1 rooms. You will want to try different values in successive runs of the program. The article recommends running the program to find the number of initial rooms that make the smallest difference between the simulated growth rate of the first two periods with the formulaís growth rate between the first two periods. This will usually (or perhaps always be the number of rooms for which the modeled growth rates for the first two periods are closest together.

1-34
2-25
3-23

The program shows you the number of iterations for each periodís calculations (which do not matter) and then shows the program results, below.

Structure Life: 15 Initial Period 1 Ages Randomized (Uniformly Distributed)
       Start   End   Start Initial   MidPt  Ending   Dated  Target  Growth
Period  Date  Date   Rooms   Dated   Rooms   Rooms   Rooms   Rooms  Rate %
     1   200   550      23      23      27      32     646     646   0.092
     2   550  1000      32      15      40      51    1215    1215   0.104
     3  1000  1150      51      24     268    1418    4848    4848   2.246

It first provides its demographic reconstruction. Often the key number is the Growth Rate % for each period. The number of starting and ending rooms for each period is also provided along with the observed number of rooms (structures) dated to that period (the Target Rooms) and the simulated number of structures dated to the period (Dated Rooms) that should be the same. Note that rooms whose occupations span period boundaries are counted in the period with the majority of the occupation. Thus, the dated rooms would be all structures whose occupations are fully within the period plus some of the starting rooms and some of the ending rooms. (All of the starting rooms of the initial period will date to that period and all of the ending rooms in the terminal period will date to their respective periods.)

Run Again {Y} ?

Replying yes allows you to run the program again, starting from the structure use-life prompt. If you reply no, the program ends.

Program End
OK to Close Program Window {Y} ?

It provides this prompt to allow you to examine the on-screen results. One you reply with Y or Enter it will close that window and you wonít be able to recover it.

Sample Output Text File

Random Seed: -618053446

Random Seed: -618053446

Compound Interest Formula Implied Growth Calculation
Period Start   End Implied Growth
 1 - 2   375   775          0.095
 2 - 3   775  1075          0.831

Structure Life: 15 Initial Period 1 Ages Randomized (Uniformly Distributed)
       Start   End   Start   Midpt  Ending   Dated  Target  Growth
Period  Date  Date   Rooms   rooms   Rooms   Rooms   Rooms  Rate %
     1   200   550      23      27      32     646     646    0.09
     2   550  1000      32      40      51    1215    1215    0.10
     3  1000  1150      51     268    1418    4848    4848    2.25
Sample Period Output CSV File
UseLife,UseSD,InitRm,Period,PerBeg,PerEnd,PerInitRm,PerMidRm,PerEndRm,PerDatedRm,TargRm,Rate
15, 0.0, 23,1, 200, 550, 23, 27, 32, 646, 646, 0.092
15, 0.0, 23,2, 550, 1000, 32, 40, 51, 1215, 1215, 0.104
15, 0.0, 23,3, 1000, 1150, 51, 268, 1418, 4848, 4848, 2.246

Sample Yearly Output CSV File

UseLife,UseSD,InitRm,Year,OccRm
15, 0.0, 23, 200,0
15, 0.0, 23, 201,23
15, 0.0, 23, 202,23
15, 0.0, 23, 203,23
15, 0.0, 23, 204,23
15, 0.0, 23, 205,23
15, 0.0, 23, 206,23
15, 0.0, 23, 207,23
15, 0.0, 23, 208,23
15, 0.0, 23, 209,23
15, 0.0, 23, 210,23
...
15, 0.0, 23, 1145,1269
15, 0.0, 23, 1146,1297
15, 0.0, 23, 1147,1326
15, 0.0, 23, 1148,1356
15, 0.0, 23, 1149,1387
15, 0.0, 23, 1150,1418

References Cited

Kintigh, Keith W., Donna M. Glowacki, and Deborah L. Huntley. 2004 Long-term Settlement History and the Emergence of Towns in the Zuni Area. American Antiquity 69(3): 432-456.

Page Last Updated: 4 October 2020

Home Top Overview Ordering Documentation