Skip to content
SimPaths
Model Validation

Model Validation

This section explains the current procedures used to validate SimPaths inputs and outputs, from regression checks to aggregate comparisons against external survey data. Validation is a core part of maintaining trust in the model after changes to parameters, code, or input data, and it provides a structured way to spot specification or implementation issues early.

The procedures below describe how to perform the checks; they do not present a set of validation results for a particular model release.

Scope of the checks

The procedures documented here cover two kinds of checks:

  1. Validating regression estimates. This step assesses the performance of the regression models that govern key behavioural and demographic processes within SimPaths (e.g. leaving the parental home, returning to education). Using the estimated regression coefficients, we generate predicted values for each observation in the estimation sample, compute/plot aggregate statistics, and compare these with the equivalent values from the estimation sample.

    This provides a straightforward check that the estimated relationships embedded in the model are consistent with observed empirical patterns.

  2. Validating simulated output. The second check examines the simulated output produced by SimPaths. The model is run for a period in which comparable survey data are available (the current master configures 2013–2023), and aggregate measures from the simulated data are compared to benchmarks computed using data from the UK Household Longitudinal Study (UKHLS).

    The validation focuses on the model's ability to reproduce aggregate measures over time (time-series consistency) and distributions within years, rather than the accuracy of individual trajectories through time.

Obtaining the validation scripts

Validation procedures are currently executed in Stata. The corresponding do-files are located in validation/ on the develop branch of the SimPaths GitHub repository.

You can access these files in one of three ways:

  1. Clone the repository. This is suitable for developers who want the full version history or plan to contribute changes. See the Working in GitHub guide.

  2. Download the repository as a ZIP file. This provides a snapshot of all files on the selected branch.

    • In the GitHub interface, select the develop branch, click Code, and choose Download ZIP.
    • Extract the ZIP file locally and navigate to the validation folder.
  3. Download individual files directly from GitHub. This is suitable if you only need a few specific scripts.

    • Select the develop branch and navigate to the desired file in the validation folder.
    • Click the Download raw file icon (the downward arrow) at the top right of the file viewer to save it locally.

These methods differ in how much of the repository you download. Downloading an individual script does not include the other files it may need.

Running the validation scripts

Once you have obtained the relevant validation files, the next step is to run them in Stata. This section explains how to set up your working environment, what data are required, and how to execute the validation do-files for each stage of validation.

Validating regression estimates

These older process-specific checks are in validation/01_estimate_validation/do_files/. They expect saved estimation samples with the variable names and predictions used by those scripts. Check compatibility with the current estimation outputs before running them; the folder does not contain its own 00_master.do.

  1. Run the regression estimation do-files. Use compatible saved samples from the relevant estimation stage. The current estimation entry point is input/regression_files/RegressionEstimates/00_master_regression_estimates.do, but its outputs are not automatically interchangeable with the older validation samples.

  2. Set up the file structure. Place the downloaded do-files in a do_files subfolder within your estimate-validation folder. Create data and graphs subfolders alongside it. Within graphs, create:

    • education
    • fertility
    • health
    • home_ownership
    • income
    • leave_parental_home
    • partnership
    • retirement
    • wages
  3. Check the location of the input data files. Set dir_validation_data to the folder containing the samples required by the selected script, for example E1a_sample.dta for the education check. Verify the required columns as well as the filename.

  4. Define the globals before running a check. Set dir_validation_data, dir_validation_graphs and country in your Stata session or a local driver file. Then run the required int_val_*.do script. There is no estimate-validation master in this checkout to configure these globals for you.

Run the validation do-files to produce the plots once these steps are complete.

Validating the simulated output

The main entry point is validation/02_simulated_output_validation/do_files/00_master.do. It prepares survey targets, processes existing simulation outputs and runs the comparison plots.

  1. Obtain completed simulation outputs. Enable the required record-level exports; the standard preparation script reads Person.csv and BenefitUnit.csv. Its Household.csv import is currently commented out. See Multiple Runs and Statistical display.

  2. Configure the master script's paths. Edit the settings marked >>> EDIT <<<, including dir_ind, path, dir_UKHLS_data and the dir_simulated_data expression inside the alignment loop. path points to the validation folder containing do_files/. The master creates its data/, graphs/ and per-alignment graph subfolders automatically.

  3. Supply the survey input and identify the run folders. The UKHLS target script reads UKHLS_pooled_ipop.dta from dir_UKHLS_data. Set local alignments to the output-folder names to compare and global folder to the common run-folder prefix.

    The importer expects dir_simulated_data/<folder>_<n>/csv/Person.csv and BenefitUnit.csv, with n running from zero through max_n_runs. Thus max_n_runs = 4 means five run folders. Match the paths to your actual outputs rather than assuming their names already follow this layout.

  4. Check the comparison settings and run the master. Set min_sim_year, max_sim_year and the other parameters for the intended comparison. Run the whole configured 00_master.do so the directory setup, survey preparation and alignment loop execute together.

For the additional consumption, housing, pension and unsecured-debt checks, configure 00_master_wealth.do in the same folder. It accepts explicit CSV directories and separate survey inputs. Run it directly, or enable run_wealth_validation in the main master after configuring it. These scripts use completed outputs; they do not launch new simulations.