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:
-
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.
-
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:
-
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.
-
Download the repository as a ZIP file. This provides a snapshot of all files on the selected branch.
- In the GitHub interface, select the
developbranch, click Code, and choose Download ZIP. - Extract the ZIP file locally and navigate to the validation folder.
- In the GitHub interface, select the
-
Download individual files directly from GitHub. This is suitable if you only need a few specific scripts.
- Select the
developbranch 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.
- Select the
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.
-
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. -
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:
educationfertilityhealthhome_ownershipincomeleave_parental_homepartnershipretirementwages
-
Check the location of the input data files. Set
dir_validation_datato the folder containing the samples required by the selected script, for exampleE1a_sample.dtafor the education check. Verify the required columns as well as the filename. -
Define the globals before running a check. Set
dir_validation_data,dir_validation_graphsandcountryin your Stata session or a local driver file. Then run the requiredint_val_*.doscript. 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.
-
Obtain completed simulation outputs. Enable the required record-level exports; the standard preparation script reads
Person.csvandBenefitUnit.csv. ItsHousehold.csvimport is currently commented out. See Multiple Runs and Statistical display. -
Configure the master script's paths. Edit the settings marked
>>> EDIT <<<, includingdir_ind,path,dir_UKHLS_dataand thedir_simulated_dataexpression inside the alignment loop.pathpoints to the validation folder containingdo_files/. The master creates itsdata/,graphs/and per-alignment graph subfolders automatically. -
Supply the survey input and identify the run folders. The UKHLS target script reads
UKHLS_pooled_ipop.dtafromdir_UKHLS_data. Set localalignmentsto the output-folder names to compare and globalfolderto the common run-folder prefix.The importer expects
dir_simulated_data/<folder>_<n>/csv/Person.csvandBenefitUnit.csv, withnrunning from zero throughmax_n_runs. Thusmax_n_runs = 4means five run folders. Match the paths to your actual outputs rather than assuming their names already follow this layout. -
Check the comparison settings and run the master. Set
min_sim_year,max_sim_yearand the other parameters for the intended comparison. Run the whole configured00_master.doso 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.