LIAM 2: A NEW OPEN SOURCE DEVELOPMENT TOOL FOR DISCRETE-TIME DYNAMIC MICROSIMULATION MODELS GIJS DEKKERS (FEDERAL PLANNING BUREAU, Brussels, CESO, K.U.LEUVEN.

Slides:



Advertisements
Similar presentations
Estimating the Level of Underreporting of Expenditures among Expenditure Reporters: A Further Micro-Level Latent Class Analysis Clyde Tucker Bureau of.
Advertisements

LIAM 2: A NEW OPEN SOURCE DEVELOPMENT TOOL FOR THE DEVELOPMENT OF DISCRETE-TIME DYNAMIC MICROSIMULATION MODELS GAËTAN DE MENTEN (Federal Planning Bureau)
Chapter 7 Hypothesis Testing
Programming Languages and Paradigms The C Programming Language.
Federal Planning Bureau Economic analyses and forecasts LIAM 2 A tool for the development of dynamic cross- sectional microsimulation models presentation.
Programming Types of Testing.
MDU Development Unit Model. MDU Development Unit Model Howard Redway Model Development Unit UK Department for Work and Pensions
March 2013 ESSnet DWH - Workshop IV DATA LINKING ASPECTS OF COMBINING DATA INCLUDING OPTIONS FOR VARIOUS HIERARCHIES (S-DWH CONTEXT)
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
Spreadsheets in Finance and Forecasting Presentation 8 Buttons, Boxes and Bars.
Tutorial 6 & 7 Symbol Table
Introduction.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
Fundamentals of Python: From First Programs Through Data Structures
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Federal Planning Bureau Economic analyses and forecasts LIAM2* A sneak preview... *Life-cycle Income Analysis Model Gijs Dekkers Federal Planning Bureau.
Fundamentals of Python: First Programs
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
Coding closed questions Training session 5 GAP Toolkit 5 Training in basic drug abuse data management and analysis.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
RESEARCH PROPOSAL: THEORY, RESEARCH QUESTION & HYPOTHESIS
Section 4-3 The Addition Rule. COMPOUND EVENT A compound event is any event combining two or more simple events. NOTATION P(A or B) = P(in a single trial,
NÁRODNÁ BANKA SLOVENSKA BNB, April 23, 2008 Miroslav Gavura Forecasting and Policy Analysis System in the NBS.
LIAM 2: A NEW OPEN SOURCE DEVELOPMENT TOOL FOR THE DEVELOPMENT OF DISCRETE-TIME DYNAMIC MICROSIMULATION MODELS PHILIPPE LIÉGEOIS (CEPS/INSTEAD, Luxembourg.
Albania Statistical Training Prosecution / Courts Session 4, January 31, – Overview of the Criminal Justice System and Statistics – Recording.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Rev. 0 CONFIDENTIAL Mod.19 02/00 Rev.2 Mobile Terminals S.p.A. Trieste Author: M.Fragiacomo, D.Protti, M.Torelli 31 Project Idea Feasibility.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
SE: CHAPTER 7 Writing The Program
Eurostat Expression language (EL) in Eurostat SDMX - TWG Luxembourg, 5 Jun 2013 Adam Wroński.
 Agenda 2/20/13 o Review quiz, answer questions o Review database design exercises from 2/13 o Create relationships through “Lookup tables” o Discuss.
Metadata driven application for data processing – from local toward global solution Rudi Seljak Statistical Office of the Republic of Slovenia.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
Bosnia & Herzegovina Statistical Training Prosecution / Courts Session 4, November 22nd Overview of the Criminal Justice System and Statistics – Recording.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 8-1 Chapter 8 Fundamentals of Hypothesis Testing: One-Sample Tests Statistics.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X1 Chapter 3 Control Statements.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Quantitative research – variables, measurement levels, samples, populations HEM 4112 – Research methods I Martina Vukasovic.
Lyne Guertin Census Data Processing and Estimation Section Social Survey Methods Division Methodology Branch, Statistics Canada UNECE April 28-30, 2014.
Software Engineering (CSI 321) Project Planning & Estimation 1.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Note Combining LIAM2 and EUROMOD: a (useful?) possibility.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 A gentle introduction to microsimulation Gijs Dekkers.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Developing a concrete model : the full path II] Building Micro data (cf. variables)
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Aggregates, output and other basic tools.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 7. Stochastic concepts in LIAM2.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 4. Basic concepts, a rudimentary model, and input data (demo01.yml)
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Playing with Objects.
ILUTE A Tour-Based Mode Choice Model Incorporating Inter-Personal Interactions Within the Household Matthew J. Roorda Eric J. Miller UNIVERSITY OF TORONTO.
Python: Building Geoprocessing Tools David Wynne, Ghislain Prince.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Advanced topics.
Presented to Toll Modeling Panel presented by Krishnan Viswanathan, Cambridge Systematics, Inc.. September 16, 2010 Time of Day in FSUTMS.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Lecture 9 Symbol Table and Attributed Grammars
Debugging and Random Numbers
Dynamic Microsimulation Population Projection in Developing Countries
Overview and Basics of Hypothesis Testing
Paper presented at the séminaire scientifique, Caisse des Dépôts,
Phil Tayco Slide version 1.0 Created Oct 2, 2017
Chapter 6 Intermediate-Code Generation
Boolean Expressions to Make Comparisons
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Programming Languages and Paradigms
An introduction to MIDAS
13/05/2013 Gijs Dekkers Gaëtan de Menten Raphaël Desmet
Presentation transcript:

LIAM 2: A NEW OPEN SOURCE DEVELOPMENT TOOL FOR DISCRETE-TIME DYNAMIC MICROSIMULATION MODELS GIJS DEKKERS (FEDERAL PLANNING BUREAU, Brussels, CESO, K.U.LEUVEN AND CEPS/INSTEAD, Luxembourg) PHILIPPE LIÉGEOIS (CEPS/INSTEAD and DULBEA, ULB, Brussels) IMA 4th General Conference, Canberra Dec 9th, 2013

2 GENERAL MOTIVATION OF THE TRAINING SESSION  Introduce LIAM2, a free, open source, user-friendly modelling and simulation framework  Basic functionalities, by examples and practice (“learning- by-doing”) : when back home, being ready to use LIAM2 and entering a process of elaborating own developments (MSM model)  Other more advanced topics, latest developments, by examples : making you aware of (new) possibilities or technical difficulties  Documentation : slides (just gathering essential information by topic), some examples and “UserGuide” (release 0.7.0) included in the LIAM2 bundle ( + Google grouphttp://liam2.plan.be G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA

3 W HY LIAM2 AND W HERE DOES IT COME FROM ?  Most existing microsimulation models have been developed by separate (teams of) researchers.  The drawback of each team working on its own is that they have to put a lot of time and effort in the customary development simulation tools… which makes microsimulation models even more expensive than strictly necessary.  Furthermore, as modellers often are not professional programmers, the result is not necessarily the most efficient in terms of simulation speed.  This is the reason why several partners joined their efforts to develop a dynamic Microsimulation modeling toolbox (“LIAM2”) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA

4 W HY LIAM2 AND W HERE D OES I T C OME F ROM ?  Initialized through a collaboration between the Federal Planning Bureau in Brussels (development), the CEPS/INSTEAD and the General Inspectorate of Social Security in Luxembourg (testing and complementary funding) and Cathal O’Donoghue (LIAM and expertise) as well as other experts, under European funding (MiDaL Project , PROGRESS programme, Grant VS/2009/0569, CEPS/INSTEAD)  Most of the technical job for LIAM2 done in Brussels (Gaëtan de Menten, Geert Bryon, Raphaël Desmet and Gijs Dekkers)  Open source, User-friendly and Efficient :  A clear separation between “modellers” (responsible for the modelling) and “programmers” (in charge of the development of critical methodological issues, including state-of-the-art methods for data-handling and simulation optimization)  Implementation of language which is easy to use for the modellers G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA

5 C ONTENTS OF THE T RAINING S ESSION 1)Getting started with LIAM2 2)A rudimentary model, creating objects and some output 3)Linking Objects 4)Stochastic simulation 5)Marriage market (Matching function) 6)Importing data towards LIAM2 input format 7)Advanced topics 8)Conclusions, including building a model with LIAM2 G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA

6 1. G ETTING STARTED WITH LIAM2  Just download and use it (demonstration) S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA

7 2. A R UDIMENTARY M ODEL T HE BRICKS  LIAM2 involving several kinds of « bricks », among which…  ENTITIES : objects (persons, households, firms, cell, …) with a unique identifier  FIELDS : attributes of an entity (e.g. person’s age)  LINKS : relation between entities (e.g. person’s children) ; can lead to subsequent use (e.g. spouse.mother.age)  GLOBALS : a parameter not related to a specific entity, may vary through time (e.g. CPI)  PROCESSES : assignments, which change the value of a variable (e.g. « age+1 ») using an expression, and actions which do not (e.g. remove dead person)  MACROS : piece of code, re-evaluated each time it is referenced (e.g. « WIDOW: civilstate == 5) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

8 2.2 O VERALL STRUCTURE OF A M ODEL  A model is typically composed of 3 main blocks…  « globals »  « entities » : including their fields, links and definition of processes (order not meaningful) and macros available for that kind of entity  « simulation » : including the general setup of the model, e.g. input, output, starting period of simulation, number of periods of simulation, etc  Within the blocks, indentation is meaningful (cf. YAML-markup language) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

globals: periodic: - CPI: float# Consumer Price Index -... entities: household:... person: fields: - age: int - gender: bool# “ 0 ” if female, “ 1 ” if male - m_id: int# mother ’ s identifier -... macros: FEMALE: gender == 0... links:# first one : Mother to Children mc: {type: one2many, target: person, field: m_id}... processes: age: "age + 1"... divorce: "..."# the process is here DECLARED/SPECIFIED only... simulation: processes: - person: [ year, age,... divorce,# the process now SIMULATED/used... ] input: path: "INPUT_DATA" file: "INIT_MODEL_LXG_INPUT_2007.h5"# “ HDF5 ” format output: path: "OUTPUT_DATA" file: "FINAL_MIDAS_LXG_RESULTS.h5“# “ HDF5 ” format start_period: 2008 # first simulated period periods: 20 LXG MIDAS MODEL (2012) A global view first… Gijs Dekkers and Philippe Liégeois - TRAINING LIAM2 - IMA Conference Canberra

MIDAS_LU - 1st Part : declaring objects… # # LUXEMBOURG MIDAS MODEL # FINAL VERSION, AS ON 14 MAR 2012 # globals: periodic: - CPI: float# Consumer Price Index -... entities: household:... person: fields: - age: int - gender: bool# “ 0 ” if female, “ 1 ” if male - m_id: int# mother ’ s identifier -... macros: FEMALE: gender == 0... links:# first one : Mother to Children mc: {type: one2many, target: person, field: m_id}... processes: age: "age + 1"... divorce: "..."# the process is here DECLARED only...

Gijs Dekkers and Philippe Liégeois - TRAINING LIAM2 - IMA Conference Canberra … then 2 nd Part : simulating … simulation: processes: - person: [ year, age,... divorce,# the process now SIMULATED/used... ] input: path: "INPUT_DATA" file: "INIT_MODEL_LXG_INPUT_2007.h5"# “ HDF5 ” format output: path: "OUTPUT_DATA" file: "FINAL_MIDAS_LXG_RESULTS_YEARS_2007_2009.h5" start_period: 2008 # first simulated period periods: 2 … simulation: processes: - person: [ year, age,... divorce,# the process now SIMULATED/used... ] input: path: "INPUT_DATA" file: "INIT_MODEL_LXG_INPUT_2007.h5"# “ HDF5 ” format output: path: "OUTPUT_DATA" file: "FINAL_MIDAS_LXG_RESULTS_YEARS_2007_2009.h5" start_period: 2008 # first simulated period periods: 2

I NPUT D ATA AND S TRUCTURE  Demonstration G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS D1

O UTPUTTING O UTCOMES (A)  dump(), groupby(), show(), qshow(), csv(), …  dump() ~ « list » Syntax: dump([expr1, expr2,..., filter=filterexpression, missing=value, header=True] Example : Run the model (e.g. bundled Notepad++ editor => F6) dump ( id, hh_id, age, gender, filter = id<20 ) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

O UTPUTTING O UTCOMES (B)  groupby() ~ Summary tables Syntax: groupby(expr1[, expr2, expr3,...] [, expr=expression] # « count() » by default [, filter=filterexpression] [, percent=True], …) Example : groupby ( trunc(age/10), gender ) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

O UTPUTTING O UTCOMES (C)  show() qshow() Syntax: show(expr1[, expr2, expr3,...]) Example : show ( count(age>=18), avg(age, filter = age>=18 ))) NB : “ show ” is implicit in console environment itself NB2 : qshow() is equivalent to show() but with textual form in output G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

O UTPUTTING O UTCOMES (D)  csv() ~ to «.csv » files Syntax: csv(expr1[, expr2, expr3,..., [suffix=’file_suffix’][, fname=’filename’][, mode=’w’ by default / ’a’]) NB : default « fname » is « {entity}_{period} » (e.g. « person_2003.csv ») Example : csv ( avg(income), suffix=’income’) (e.g. « person_2003_income.csv ») G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

T HE " INIT " PHASE OF SIMULATION G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

18 NB : A BOUT VARIABLES IN LIAM2 - L OCAL /T EMPORARY  Most often, variables are declared in « fieds » section of an entity : they may be assigned a value through processes and will be stored in the output file  But often, you need a variable only to store an intermediate result : simply make an assignment to an undeclared variable  Example : person: fields: # period and id are implicit - age: int - agegroup: int processes: age: age + 1 agediv10: trunc(age / 10) agegroup: agediv10 * 10 agegroup2: agediv10 * 5 G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

19 3. L INKING O BJECTS - (A) M ANY 2O NE  Links are of « many2one » or « one2many » types  « many2one » : linking many objects to one only (e.g. children to their mother or members of household to HH) Syntax link_name: {type: many2one, target:, field: } NB : “ field ” logically targeting the “single” side of link Examples (defined within entity : « person ») household: {type: many2one, target: household, field: hh_id} G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS D2

20 3. L INKING O BJECTS - (B) O NE 2M ANY  « one2many » : linking one object to several others (e.g. a household to members of household) Syntax (idem many2one) link_name: {type:, target:, field: } NB : “ field ” logically targeting the “single” side of link Examples (defined within entity : « person ») persons: {type: one2many, target: person, field: hh_id} G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

21 3. L INKING O BJECTS - (C) G ETTING I NFO OUT OF L INKAGE  For accessing the information through links, just show the route and « chain » steps towards the target : Syntax (basic) link_name.field_name Examples mother.age but also mother.mother.age Aggregate information on one2many context (in « household ») persons.avg(age) but also persons.count(age<=17) Aggregate information on many2one context (in « person ») household.get(persons.avg(age)) mother.get((mother.age+father.age)/2) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

22 4. I NTRODUCING S TOCHASTIC S IMULATION 4.1 T HE “C HOICE ” FUNCTION (A)  Up to now, deterministic approach : no random component  Imagine on the contrary an event happening with exogenous probability p : which gender while just born, but also who is dying, marrying, getting a job, etc  The simplest way to « decide » while simulating which will be the outcome of the random event for a given entity is to draw a random number u from an uniform [0,1] distribution. If u > p, then the entity is experiencing the event (e.g. dying).  The same methodology can be applied if a choice between more than 2 options (e.g. attributing a household to a region within the country) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS D2 & 3

T HE “C HOICE ” FUNCTION (B)  This is exactly what is aiming to produce the “choice” function in LIAM2.  Suppose i=1..n choice options, each with a probability p i. A choice expression then has the following form: Syntax choice([option_1, option_2,..., option_n], [prob_option_1, prob_option_2,..., prob_option_n])} Example gender_just_born: choice([True, False], [0.51, 0.49]) education_level: choice([1,2,3], [0.1, 0.4, 0.5]) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

L OGIT R EGRESSION (A)  Sometimes, we know more about the event which probability to happen may rely on entity’s (personal) characteristics to be made more explicit through e.g. a « logit regression » if a qualitative (dichotomous) choice. e.g. a married couple may be less at risk of divorce if the duration of marriage is longer up to the present period  Formally, if « α + βX » is the combination of characteristics x i which result from a logit regression and « explain » correctly the event under study, then :  First, a « logit score » (which is a probability) can be computed : logit_score(α + βX) = logistic(α + βX - logit(u)) where « u » is a random number from an uniform distribution [0, 1] ( logit(u) = log (u/(1-u)) and logistic(z) = logit -1 (z) )  Second, the decision rule can be the following : if the logit score > 0.5, then the event is happening (e.g. dying), otherwise not. G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

“L OGIT _ SCORE ” AND “ LOGIT _ REGR ” F UNCTIONS (B)  In LIAM2, the first task, computing a score or risk, is performed thanks to the logit_score(expression) function which then returns a probability p = logistic(expression - logit(u)) NB : logit_score(0.0) is equivalent to uniform(), then returns a value > 0.5 with probability ½ (prob<1/2 if “<0.0”)  Another function, logit_regr(), is performing both tasks at once and returns a boolean ( True if the event is happening) Syntax logit_regr(expression, [, filter=conditions], …) Examples death: logit_regr( * age, filter = age>40) NB : logit_regr(0.0) returns True with probability 0.5 logit_regr(<0) returns True with probability <0.5 G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

L OGIT AND S TATE A LIGNMENT  Alternatively, rather than grouding the decision on the threshold 0.5 for the probability p, we can decide to « select » a proportion of entities (by category) which must experience the event : this is « alignment »  The logit_regr syntax encompasses alignment possibilities : Syntax logit_regr(expression, [, filter=conditions] [, align=proportions]) Examples divorce: logit_regr( *household.nb_children *dur_in_couple *agediff, filter = ISFEMALE and ISMARRIED), align = 'al_p_divorce.csv') G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

27 NB : (S TOCHASTIC S IMULATION ) L OGIT E XTENSIONS  A simple use of logit_expr() function is equivalent to a « choice » process : Example dead: if(ISMALE, logit_regr(0.0, align='al_p_dead_m.csv'), logit_regr(0.0, align='al_p_dead_f.csv'))  The logit_expr() function can be split into 2 steps logit_score() and align() in LIAM2, which may make the whole process more flexible (e.g. take): Syntax align(score, proportions [, filter=conditions] [, take=conditions] [, leave=conditions] …) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

O THER R EGRESSIONS  Continuous G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

29 5. T HE “M ARRIAGE M ARKET ” (“M ATCHING ” FUNCTION )  Marriage market) matches individuals from set 1 with individuals from set 2.  For each individual i in set 1 following a particular order (defined through an “ orderby ” parameter) :  a score is computed for all (unmatched) individuals in set 2 and  the best scoring member from set 2 is chosen for the match with i Syntax matching( set1filter=boolean_expr,set2filter=boolean_expr, orderby=, score=coef1 * field1 + coef2 * other.field2 +...) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS D5

30 6. I MPORTING D ATA T OWARDS HDF5 F ORMAT  Demonstrating G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

31 7. A DVANCED T OPICS  Arrays  new & clone  align abs  tips & tricks  Common mistakes G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

32 A N OTE A BOUT “ NEW ”, “ REMOVE ” AND “ CLONE ” F UNCTIONS  Entities (persons, households) may need to be created from scratch or removed while proceeding  For example :  if a marriage, the 2 partners are forming a single household, which means that one of them at least is leaving his/her former household  If a birth, then a new person ; when dying, a person is removed from the population  Sometimes, we may need to create a “clone” of an existing entity Syntax and Examples (NB : treatments needed with links, etc) new(’entity_name’[, filter=expr][, number=value] *set initial values of selected variables*) clone(filter=new_born and is_twin, gender=choice([True, False], [0.51, 0.49])) remove(dead) G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

33 8. C ONCLUSIONS  Including Implementing a model in LIAM2 G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS

34 I MPLEMENTING A MODEL IN LIAM2 : THE FULL PATH (A-D) B] Building Micro data (cf. variables) & Macro_based data (cf. alignments & parameters) (e.g. from EUROMOD, survey and/or adm. data C] Building and estimating Behavioral equations (e.g. probability of divorce) A] Structuring the model, depending on OBJECTIVES, starting e.g. from MIDAS_BE : demography, activity status, tax-benefit => variables, parameters (« GLOBALS ») & alignments needed D] Running, Debugging, Outputting, Validating G IJS D EKKERS AND P HILIPPE L IÉGEOIS - TRAINING LIAM2 - IMA C ONFERENCE C ANBERRA S TART – M ODEL – L INKS – S TOCHASTIC – M ATCHING – I MPORT – O THERS