be performed using the majority of computers available to users. On the other hand, the Monte Carlo simulation requires the use of the census data. Census data, depending on the country, can range from anywhere between roughly 30,000 observations to almost half a billion. Depending on a user’s computer setup, a couple million observations can really slow down the computer to a crawl. Assuming variables in double type precision, a 5 million observation dataset with 30 variables will require roughly 1.1 GB of memory. Therefore, in order to speed up the second stage operation and to be able to operate with larger datasets, a couple of modifications are implemented.

The first modification concerns importing the census data and formatting it in a more memory friendly way. Along with the main command we supply a sub-command that allows the user to import the census data for the second stage, `sae data import` . The data is imported one vector at a time and saved into a Mata format file which is used for the processing of each regressor at a time for each simulation to obtain the predicted welfare. Proceeding in this manner, the maximum number of observations that can be used in the simulation stage is increased. As shown in the examples section, this setup requires preparing the target dataset beforehand. Due to this setup, the Monte Carlo simulations are executed one vector at a time. For smaller datasets it is likely that performing all simulations in one go results in quicker execution times,<sup>27</sup> once we move on to larger census data this method provides faster execution times and allows for more efficient memory management.

The second modification, is a plugin for processing the simulations and producing the required indicators. This is only used/necessary for processing indicators. The processing is also done one simulation at a time, just like the Monte Carlo simulations. The plugin speeds up the process considerably, especially when requesting Gini coefficients.<sup>28</sup>

# **6 The** **`sae` Command and Sub-Commands**

The `sae` command and sub-commands for modeling, simulating, and data manipulation are introduced below. The common syntax for the command is:

## `sae [routine] [sub routine]`

Currently available routines and subroutines are:

- `sae data import||export :` This is used to import the target dataset to a more manageable format for the simulations. It is also used to export the resulting simulations to a dataset of the user’s preference.

- `sae model lmm/povmap :` This routine is for obtaining the _GLS_ estimates of the first stage. The sub-routines, lmm (linear mixed model) and povmap are used interchangeably.<sup>29</sup>

- `sae simulate lmm/povmap :` This routine and sub-routine obtains the _GLS_ estimates of the first stage, and goes on to perform the Monte Carlo simulations.

> 27This is particularly true for the MP version of Stata, which makes use of more than one core for its operations.

> 28Gini coefficients require sorting at every level, this is done much faster using a C plugin. Stata’s sorting speed (as of this writing), including Mata’s, is much slower than that of many other software.

> 29Future work aims to incorporate additional methodologies, such as models for discrete left hand side variables .

13