Spatial microsimulation is a methodology aiming to simulate entities such as households, individuals or business in the finer possible scale. This process requires the use of micro-datasets with individual based information. The sms library presented in this work, facilitates the production of small area population micro-data by combining various other datasets. This is a parallelized implementation of random selection with thoptimization to select a micro-dataset with characteristics that mach a macro description. The sms library contains functions for preparing micro-data from census and longitudinal datasets. This process is called fiting and is the primary step in spatial microsimulation methodology. It actualy fits small area datasets to census area descriptions. There is a need for a library in Statistcal Programming Language R for preparing small area microdata. The functions of the livbrary connect various data-sources and produce small area population dataset. The functions use multi-core approaches of modern personal desktop computers in order to simulate relatively big areas in less computational time. The sms library, uses the parallel interface of R platform to divide the main simulation process into smaller simulations which then run in parallel. The R library presented in this work, use parallel processing approaches for the efficient production of small area population micro-data, which can be later used for geographical analysis.
This is an example of using sms library. It uses the default data (census, survey) and prepares fitted microdata for the areas described in the census dataset.
In order to illustrate the use of sms library, it is useful to use a simple case study. The following case study will produce micro-data of the population of Lesvos island in Greece. The data-sources used are from the census of population of Greece and from an artificial panel dataset constructed for this case study. Similar panel datasets can be found from Eurostat.
library(sms)
data(survey)
head(survey)
pid he female agemature car_owner house_owner working
1 6501 0 1 0 0 1 1
2 6502 0 1 1 1 1 0
3 6503 1 0 0 0 0 1
4 6504 1 0 1 1 1 1
5 6505 0 0 0 1 0 1
6 6506 0 1 0 0 1 1
data(census)
census
areaid population he females
1 8300 7 11 1
2 8301 20 8 8
3 8302 8 15 2
4 8303 20 3 9
5 8304 10 8 12
6 8305 3 5 4
7 8306 6 5 7
8 8307 10 6 1
9 8308 5 11 11
10 8309 13 7 6
Now both datasets have been loaded as data.frames. We need another data.frame which will hold the associations between the census and the survey data.frames. It will hold the names of the columns from both datasets. This is called “data lexicon” and is just holding column names (Strings)
in.lexicon = createLexicon()
in.lexicon = addDataAssociation(in.lexicon, c("he", "he"))
in.lexicon = addDataAssociation(in.lexicon, c("females", "female"))
in.lexicon
con_1 con_2
census_row he females
survey_row he female
The first column of your census data should have a column named: areaid which should be a unique identifier of each area. ALso notice that the survey data sould use binary (0 or 1) values for all variables.
We need to construct a microsimulation object which will hold all necessery objects of our simulation. Thos objects are the imported data and after the simulation, the results will be stored inside the microsimulation object. This is the main object of every simulation process and it holds all necessary information and results of the fitting process. The following command creates a microsimulation object with the name insms and attach the census and survey data to it. It also defines the number of iterations (40) before ending the fitting process.
mysms = new("microsimulation", iterations = 40, census = census, panel = survey,
lexicon = in.lexicon)
The object mysms now has 5 slots which contain various objects and information. We can explore the slot names with the following command:
slotNames(mysms)
[1] "census" "panel" "lexicon" "results" "iterations"
The census slot, contains the census data and the lpane slot the panel data of the simulation. The lexicon slot contains the data association information and the results slot contains the results of the simulation process which is currently empty. Finally the iterations slot contains the number of iterations before the selection of the best combination of individuals for each area.
Now that we have a microsimulation object, we use it to start the fitting process.
try01 = run_parallel_HC(mysms)
The object try01 is a new microsimulation object which holds the results of the fitting process as well as the initial data.
The results slot, inside the try01 object, holds the results of the fitting process.
try01
An object of class "microsimulation"
Slot "census":
areaid population he females
1 8300 7 11 1
2 8301 20 8 8
3 8302 8 15 2
4 8303 20 3 9
5 8304 10 8 12
6 8305 3 5 4
7 8306 6 5 7
8 8307 10 6 1
9 8308 5 11 11
10 8309 13 7 6
Slot "panel":
pid he female agemature car_owner house_owner working
1 6501 0 1 0 0 1 1
2 6502 0 1 1 1 1 0
3 6503 1 0 0 0 0 1
4 6504 1 0 1 1 1 1
5 6505 0 0 0 1 0 1
6 6506 0 1 0 0 1 1
7 6507 1 0 1 1 1 0
8 6508 0 0 1 1 0 1
9 6509 1 0 1 0 0 0
10 6510 1 1 0 0 0 0
11 6511 1 0 0 0 1 0
12 6512 1 0 1 1 0 0
13 6513 0 1 1 1 0 0
14 6514 0 0 1 0 0 0
15 6515 0 0 1 1 0 1
16 6516 0 0 0 0 0 0
17 6517 1 1 1 1 0 0
18 6518 0 0 1 0 0 0
19 6519 0 1 0 0 0 1
20 6520 0 1 0 0 1 0
21 6521 0 1 0 1 1 0
22 6522 0 1 1 0 0 1
23 6523 0 0 1 1 1 1
24 6524 1 0 0 0 1 1
25 6525 1 1 1 0 1 1
26 6526 1 0 0 1 1 1
27 6527 0 1 0 0 1 0
28 6528 0 0 0 1 1 0
29 6529 0 0 0 0 1 0
30 6530 0 0 1 0 1 0
31 6531 0 0 1 0 1 1
32 6532 0 0 0 0 0 1
33 6533 1 1 0 1 1 1
34 6534 0 1 1 0 0 0
35 6535 0 0 1 0 1 0
36 6536 0 0 1 1 1 1
37 6537 1 0 1 1 1 1
38 6538 0 1 1 1 1 0
39 6539 1 1 0 1 1 1
40 6540 1 0 1 0 0 1
41 6541 1 1 0 0 1 0
42 6542 1 1 0 0 1 1
43 6543 0 1 0 0 0 1
44 6544 0 0 1 1 1 1
45 6545 1 0 0 1 1 0
46 6546 1 0 1 1 1 1
47 6547 0 0 0 0 0 0
48 6548 0 0 1 0 1 1
49 6549 1 1 0 0 1 1
50 6550 0 1 0 1 1 0
51 6551 0 0 0 1 0 0
52 6552 0 0 1 1 1 0
53 6553 0 1 0 0 0 1
54 6554 1 1 0 1 0 1
55 6555 1 0 1 0 1 0
56 6556 1 1 1 1 0 1
57 6557 0 0 0 0 0 1
58 6558 1 1 0 0 0 1
59 6559 1 1 1 0 0 0
60 6560 0 1 1 0 1 1
61 6561 1 0 0 0 1 1
62 6562 1 0 0 1 0 0
63 6563 0 0 0 0 1 0
64 6564 1 1 1 0 1 0
65 6565 0 0 0 1 1 1
66 6566 0 1 1 0 1 1
67 6567 1 0 0 0 0 1
68 6568 1 1 1 1 1 0
69 6569 0 0 1 1 1 1
70 6570 1 0 1 0 0 0
71 6571 0 0 1 0 1 1
72 6572 1 0 1 1 1 1
73 6573 0 1 1 1 0 0
74 6574 1 0 1 0 0 0
75 6575 1 1 1 1 1 0
76 6576 0 1 0 0 0 1
77 6577 0 0 0 0 0 1
78 6578 1 1 1 1 0 0
79 6579 1 1 0 1 1 0
80 6580 0 0 1 0 0 1
81 6581 1 1 0 0 1 1
82 6582 0 1 0 0 1 0
83 6583 0 1 0 1 0 0
84 6584 0 1 0 1 1 0
85 6585 1 1 0 0 1 0
86 6586 0 0 1 1 1 1
87 6587 0 1 1 1 0 0
88 6588 1 0 0 1 1 0
89 6589 1 1 0 1 1 0
90 6590 1 1 1 1 1 1
91 6591 1 1 0 0 0 1
92 6592 1 1 0 0 0 0
93 6593 0 0 1 0 1 0
94 6594 0 0 0 1 0 1
95 6595 1 1 0 0 1 1
96 6596 0 0 0 1 1 1
97 6597 0 0 1 1 1 1
98 6598 0 1 0 1 1 1
99 6599 0 0 1 0 0 0
100 6600 0 1 1 1 0 0
101 6601 1 0 1 1 1 0
102 6602 0 1 1 1 1 1
103 6603 0 0 0 0 1 0
104 6604 0 0 0 0 1 1
105 6605 0 1 0 1 1 0
106 6606 0 1 1 1 1 1
107 6607 1 1 1 1 0 1
108 6608 1 0 1 1 1 0
109 6609 0 0 1 1 0 1
110 6610 1 0 1 0 1 1
111 6611 0 1 0 1 1 0
112 6612 0 1 0 1 0 0
113 6613 1 1 1 0 0 1
114 6614 1 1 0 0 0 1
115 6615 1 0 0 0 1 1
116 6616 0 1 0 0 0 1
117 6617 0 0 1 0 1 1
118 6618 0 1 1 0 0 1
119 6619 1 0 0 0 0 0
120 6620 0 1 1 0 0 0
121 6621 1 1 0 0 1 1
122 6622 0 0 1 0 1 0
123 6623 0 1 1 0 1 0
124 6624 0 0 1 0 0 1
125 6625 1 0 0 1 1 1
126 6626 0 1 0 0 0 1
127 6627 1 0 0 1 0 1
128 6628 1 1 1 1 1 1
129 6629 0 0 1 0 0 1
130 6630 0 1 0 1 1 1
131 6631 1 0 0 1 1 0
132 6632 0 1 1 1 1 1
133 6633 0 0 0 0 0 0
134 6634 1 1 0 0 1 0
135 6635 0 0 0 0 0 0
136 6636 1 1 0 1 0 1
137 6637 1 1 1 1 0 0
138 6638 1 0 0 0 0 1
139 6639 1 0 0 0 0 1
140 6640 1 0 0 1 1 1
141 6641 1 1 1 0 0 0
142 6642 0 1 0 0 1 0
143 6643 1 0 1 1 1 1
144 6644 1 0 1 1 0 0
145 6645 0 0 0 1 0 1
146 6646 0 1 1 1 1 1
147 6647 1 1 0 0 0 1
148 6648 0 0 1 1 1 0
149 6649 1 1 1 1 0 0
150 6650 1 1 0 1 1 1
151 6651 0 1 0 0 0 0
152 6652 0 1 1 1 0 0
153 6653 0 1 0 1 1 1
154 6654 0 0 1 0 0 0
155 6655 0 1 1 0 1 1
156 6656 0 0 1 1 0 0
157 6657 1 0 0 0 0 0
158 6658 0 0 1 0 1 1
159 6659 1 1 0 1 0 1
160 6660 0 0 1 1 1 1
161 6661 0 0 0 0 0 1
162 6662 1 1 1 0 0 0
163 6663 1 0 0 1 1 0
164 6664 1 1 1 1 1 0
165 6665 0 0 1 1 1 0
166 6666 1 1 1 0 1 1
167 6667 1 0 0 0 1 0
168 6668 1 0 1 0 0 1
169 6669 1 1 1 0 0 1
170 6670 0 1 1 1 0 1
171 6671 1 0 0 1 1 1
172 6672 1 1 0 0 1 0
173 6673 0 0 1 0 1 1
174 6674 0 1 0 0 1 0
175 6675 1 1 0 1 0 0
176 6676 0 0 0 0 0 0
177 6677 1 0 0 1 1 1
178 6678 1 0 0 0 0 0
179 6679 1 1 1 1 0 0
180 6680 1 1 1 0 0 1
181 6681 1 1 0 1 1 0
182 6682 1 0 0 0 1 0
183 6683 1 0 1 1 0 0
184 6684 0 0 1 0 1 0
185 6685 1 1 0 1 0 1
186 6686 0 0 1 0 1 1
187 6687 1 0 1 0 1 0
188 6688 1 1 1 1 0 1
189 6689 0 0 1 0 0 1
190 6690 1 1 0 0 1 0
191 6691 0 0 0 0 1 0
192 6692 0 0 0 1 1 1
193 6693 0 0 1 1 1 1
194 6694 1 0 1 0 0 1
195 6695 1 1 0 1 1 1
196 6696 1 1 0 1 1 1
197 6697 1 0 1 0 1 0
198 6698 0 1 1 0 1 1
199 6699 1 1 0 1 1 0
200 6700 1 1 1 1 0 0
Slot "lexicon":
con_1 con_2
census_row he females
survey_row he female
Slot "results":
[[1]]
[[1]]$areaid
[1] 8300
[[1]]$selection
pid he female agemature car_owner house_owner working
55 6555 1 0 1 0 1 0
88 6588 1 0 0 1 1 0
144 6644 1 0 1 1 0 0
128 6628 1 1 1 1 1 1
4 6504 1 0 1 1 1 1
96 6596 0 0 0 1 1 1
39 6539 1 1 0 1 1 1
[[1]]$tae
[1] 6
[[1]]$tries
[1] 8 6 6 11 7 11 9 10 9 10 12 10 9 9 13 9 11 9 12 12 8 9 10
[24] 15 6 11 11 12 9 8 9 6 12 9 11 10 8 10 9 8
[[1]]$error_states
[1] 8 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
[36] 6 6 6 6 6
[[2]]
[[2]]$areaid
[1] 8301
[[2]]$selection
pid he female agemature car_owner house_owner working
16 6516 0 0 0 0 0 0
182 6682 1 0 0 0 1 0
32 6532 0 0 0 0 0 1
37 6537 1 0 1 1 1 1
79 6579 1 1 0 1 1 0
200 6700 1 1 1 1 0 0
68 6568 1 1 1 1 1 0
91 6591 1 1 0 0 0 1
86 6586 0 0 1 1 1 1
82 6582 0 1 0 0 1 0
197 6697 1 0 1 0 1 0
105 6605 0 1 0 1 1 0
18 6518 0 0 1 0 0 0
32.1 6532 0 0 0 0 0 1
31 6531 0 0 1 0 1 1
20 6520 0 1 0 0 1 0
96 6596 0 0 0 1 1 1
170 6670 0 1 1 1 0 1
150 6650 1 1 0 1 1 1
161 6661 0 0 0 0 0 1
[[2]]$tae
[1] 1
[[2]]$tries
[1] 5 14 7 3 3 5 6 4 7 7 4 6 5 1 5 3 4 4 6 7 5 8 9
[24] 5 9 6 6 4 1 3 2 4 10 4 3 2 4 4 1 3
[[2]]$error_states
[1] 5 5 5 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[36] 1 1 1 1 1
[[3]]
[[3]]$areaid
[1] 8302
[[3]]$selection
pid he female agemature car_owner house_owner working
169 6669 1 1 1 0 0 1
188 6688 1 1 1 1 0 1
104 6604 0 0 0 0 1 1
160 6660 0 0 1 1 1 1
4 6504 1 0 1 1 1 1
7 6507 1 0 1 1 1 0
4.1 6504 1 0 1 1 1 1
184 6684 0 0 1 0 1 0
[[3]]$tae
[1] 10
[[3]]$tries
[1] 14 15 13 12 13 13 11 12 12 17 13 11 14 10 10 15 14 13 12 12 12 11 13
[24] 12 14 16 13 13 13 12 11 15 16 12 13 10 12 16 13 11
[[3]]$error_states
[1] 14 14 13 12 12 12 11 11 11 11 11 11 11 10 10 10 10 10 10 10 10 10 10
[24] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
[[4]]
[[4]]$areaid
[1] 8303
[[4]]$selection
pid he female agemature car_owner house_owner working
117 6617 0 0 1 0 1 1
79 6579 1 1 0 1 1 0
174 6674 0 1 0 0 1 0
149 6649 1 1 1 1 0 0
198 6698 0 1 1 0 1 1
124 6624 0 0 1 0 0 1
96 6596 0 0 0 1 1 1
111 6611 0 1 0 1 1 0
73 6573 0 1 1 1 0 0
104 6604 0 0 0 0 1 1
72 6572 1 0 1 1 1 1
129 6629 0 0 1 0 0 1
96.1 6596 0 0 0 1 1 1
161 6661 0 0 0 0 0 1
187 6687 1 0 1 0 1 0
48 6548 0 0 1 0 1 1
128 6628 1 1 1 1 1 1
20 6520 0 1 0 0 1 0
13 6513 0 1 1 1 0 0
115 6615 1 0 0 0 1 1
[[4]]$tae
[1] 3
[[4]]$tries
[1] 6 10 7 9 10 9 5 3 6 16 14 11 7 7 11 9 9 7 10 7 8 7 9
[24] 8 9 10 8 8 9 12 14 10 4 8 9 9 8 8 15 11
[[4]]$error_states
[1] 6 6 6 6 6 6 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[36] 3 3 3 3 3
[[5]]
[[5]]$areaid
[1] 8304
[[5]]$selection
pid he female agemature car_owner house_owner working
33 6533 1 1 0 1 1 1
125 6625 1 0 0 1 1 1
99 6599 0 0 1 0 0 0
10 6510 1 1 0 0 0 0
181 6681 1 1 0 1 1 0
65 6565 0 0 0 1 1 1
137 6637 1 1 1 1 0 0
149 6649 1 1 1 1 0 0
112 6612 0 1 0 1 0 0
179 6679 1 1 1 1 0 0
[[5]]$tae
[1] 6
[[5]]$tries
[1] 11 14 13 14 10 7 13 9 13 14 12 11 16 9 8 11 10 11 12 10 9 13 9
[24] 9 7 9 10 9 12 7 11 10 8 8 6 7 10 10 8 7
[[5]]$error_states
[1] 11 11 11 11 10 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
[24] 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6
[[6]]
[[6]]$areaid
[1] 8305
[[6]]$selection
pid he female agemature car_owner house_owner working
159 6659 1 1 0 1 0 1
179 6679 1 1 1 1 0 0
169 6669 1 1 1 0 0 1
[[6]]$tae
[1] 3
[[6]]$tries
[1] 5 5 6 9 5 6 6 5 7 8 7 7 6 7 7 6 6 3 5 7 5 7 5 7 8 6 5 5 5 7 8 5 6 6 6
[36] 6 5 6 7 6
[[6]]$error_states
[1] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[36] 3 3 3 3 3
[[7]]
[[7]]$areaid
[1] 8306
[[7]]$selection
pid he female agemature car_owner house_owner working
123 6623 0 1 1 0 1 0
41 6541 1 1 0 0 1 0
113 6613 1 1 1 0 0 1
113.1 6613 1 1 1 0 0 1
6 6506 0 1 0 0 1 1
199 6699 1 1 0 1 1 0
[[7]]$tae
[1] 2
[[7]]$tries
[1] 3 8 8 8 6 5 6 7 6 5 4 7 2 7 9 8 5 5 5 6 9 4 5 4 5 5 5 5 5 6 4 9 7 6 8
[36] 6 5 7 4 7
[[7]]$error_states
[1] 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[36] 2 2 2 2 2
[[8]]
[[8]]$areaid
[1] 8307
[[8]]$selection
pid he female agemature car_owner house_owner working
192 6692 0 0 0 1 1 1
177 6677 1 0 0 1 1 1
72 6572 1 0 1 1 1 1
187 6687 1 0 1 0 1 0
165 6665 0 0 1 1 1 0
200 6700 1 1 1 1 0 0
70 6570 1 0 1 0 0 0
15 6515 0 0 1 1 0 1
67 6567 1 0 0 0 0 1
99 6599 0 0 1 0 0 0
[[8]]$tae
[1] 0
[[8]]$tries
[1] 4 9 2 6 11 6 2 4 3 4 9 3 3 7 7 6 7 7 9 5 4 5 5
[24] 5 3 7 8 6 8 6 4 5 0 6 7 5 5 4 6 5
[[8]]$error_states
[1] 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 0 0
[36] 0 0 0 0 0
[[9]]
[[9]]$areaid
[1] 8308
[[9]]$selection
pid he female agemature car_owner house_owner working
59 6559 1 1 1 0 0 0
89 6589 1 1 0 1 1 0
96 6596 0 0 0 1 1 1
49 6549 1 1 0 0 1 1
141 6641 1 1 1 0 0 0
[[9]]$tae
[1] 14
[[9]]$tries
[1] 18 20 18 17 16 15 17 14 19 21 15 16 14 15 18 18 18 18 19 17 18 15 17
[24] 17 18 16 14 17 18 19 19 18 15 16 17 15 17 16 16 17
[[9]]$error_states
[1] 18 18 18 17 16 15 15 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
[24] 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
[[10]]
[[10]]$areaid
[1] 8309
[[10]]$selection
pid he female agemature car_owner house_owner working
47 6547 0 0 0 0 0 0
96 6596 0 0 0 1 1 1
84 6584 0 1 0 1 1 0
37 6537 1 0 1 1 1 1
41 6541 1 1 0 0 1 0
80 6580 0 0 1 0 0 1
45 6545 1 0 0 1 1 0
165 6665 0 0 1 1 1 0
164 6664 1 1 1 1 1 0
101 6601 1 0 1 1 1 0
107 6607 1 1 1 1 0 1
6 6506 0 1 0 0 1 1
41.1 6541 1 1 0 0 1 0
[[10]]$tae
[1] 0
[[10]]$tries
[1] 5 3 6 2 4 1 7 1 3 1 3 0 3 2 3 2 6 3 1 2 2 3 1 2 2 2 3 5 3 3 3 2 2 1 3
[36] 4 1 2 2 1
[[10]]$error_states
[1] 5 3 3 2 2 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[36] 0 0 0 0 0
Slot "iterations":
[1] 40
length(try01@results)
[1] 10
The results object, holds the results for 4 areas. For each area, the microsimulation object holds a number of information. Let's examine the third area of our microsimulation.
area03 = try01@results[[3]]
area03
$areaid
[1] 8302
$selection
pid he female agemature car_owner house_owner working
169 6669 1 1 1 0 0 1
188 6688 1 1 1 1 0 1
104 6604 0 0 0 0 1 1
160 6660 0 0 1 1 1 1
4 6504 1 0 1 1 1 1
7 6507 1 0 1 1 1 0
4.1 6504 1 0 1 1 1 1
184 6684 0 0 1 0 1 0
$tae
[1] 10
$tries
[1] 14 15 13 12 13 13 11 12 12 17 13 11 14 10 10 15 14 13 12 12 12 11 13
[24] 12 14 16 13 13 13 12 11 15 16 12 13 10 12 16 13 11
$error_states
[1] 14 14 13 12 12 12 11 11 11 11 11 11 11 10 10 10 10 10 10 10 10 10 10
[24] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
As can be see, the area03$areaid is the name of this area. The area03$selection object is the generated microdata of the area is the following:
area03$selection
pid he female agemature car_owner house_owner working
169 6669 1 1 1 0 0 1
188 6688 1 1 1 1 0 1
104 6604 0 0 0 0 1 1
160 6660 0 0 1 1 1 1
4 6504 1 0 1 1 1 1
7 6507 1 0 1 1 1 0
4.1 6504 1 0 1 1 1 1
184 6684 0 0 1 0 1 0
which can be exported to a csv file with the following command:
write.table(area03$selection, "area03Microdata.csv", sep = ",")
Each sub-object of the results can be called as following object$subobject The area03$tae is the Total Absolute Error of the fitting process for this area. The area03$tries holds the TAE of the random selections during the fitting process. This is the error of each combination, even if the combination isn't selected. Finally, the area03$error_states holds the progress of the TAE during the iterations. The length of this array, is the same as the number of iterations and it is used mainly for tracking and then plotting the progress of the TAE. The last two arrays, can be plotted in order to examine the progress of the fitting process:
plotTries(insms = try01, 3)
The above plot, shows the progress of TAE during the fitting process. The horizontal axis represents the iterations and the vertical the TAE. Each red circle, represents the TAE of a randomly selected combination of individuals, in each iteration. The dark filled dots, represent, the TAE of the currently selected best combination of individuals. This graph is very useful when the fitting algorithm is Simulated Annealing as it depicts the tolerance of the algorithm during the first iterations.
This was a small tutorial on preparing microdata with the use of R and the sms library. Please fill free to contact me regarding the sms library.