13.07.2015 Views

LIAM 2 User Guide

LIAM 2 User Guide

LIAM 2 User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>LIAM</strong> 2 <strong>User</strong> <strong>Guide</strong>, Release 0.7.0test_align_link:# this is a procedure defined at the level of households- num_persons: persons.count()- total_population: sum(num_persons)# MIG_PERCENT is a simple float periodic global- num_migrants: total_population * MIG_PERCENT# MIG is a 3d array: age - gender - period but we want only the# 2d array for this period.# currently, we need to manually compute the index (0-based)# for the current period in the array. We know the first# period in our array is 2000, so the index for the current# period is: "period - 2000"# period is the last dimension of the array and we do not# want to modify other dimensions, so we use ":" for those# dimensions.- mig_period: MIG[:,:,period - 2000]# Distribute total desired migrants, by age and gender- need: num_migrants * mig_period# households have a 50% chance to be candidate for immigration- is_candidate: uniform() < 0.5# apply alignment, using the number of persons in each household# as a score, so that households with more persons are tried first# as this gives better results.- aligned: align_abs(num_persons, need,filter=is_candidate,link=persons, secondary_axis=gender,errors=’carry’)logit_regrlogit_regr is a shortcut form to call logit_score and “evaluate whether the event happened” in a single function.Thus, the function returns a boolean: True for individuals which are selected, False for all others. Its general formis:- aligned: logit_regr(expression,[, filter=conditions][, align=proportions])The align argument supports all the same formats than the proportions argument of align(): filename, percentage,list of values, ...Evaluation whether the event happens is done differently whether the align argument is used or not. If alignmentis used, logit_regr is equivalent to:- aligned: align(logit_score(expression), proportions, filter=conditions)Without align argument, the condition for the event occurring is p*i > 0.5, which means that in this form, logit_regris equivalent to:- aligned: if(conditions, logit_score(expression) > 0.5, False)example- to_give_birth: logit_regr(0.0,filter=FEMALE and (age >= 15) and (age

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!