This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
howtos:toolcoding:using_a_relative_propensity [2010/11/12 20:58] shona.weldon created |
howtos:toolcoding:using_a_relative_propensity [2010/11/25 13:19] shona.weldon |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Using a relative propensity ====== | + | ====== Using relative propensities to create data based on some simple assumptions ====== |
When you have an equation with more unknowns that constraints and you want to add some assumptions to solve it you may add a relative propensity calculation. Best served by an example. | When you have an equation with more unknowns that constraints and you want to add some assumptions to solve it you may add a relative propensity calculation. Best served by an example. | ||
+ | ===== Example ===== | ||
Given: | Given: | ||
- | households[uss,usdt,th] | + | households[uss,usdt,th] |
- | population[uss,th] | + | population[uss,th] |
Want to get: | Want to get: | ||
- | peoplePerHousehold[uss,usdt,th] | + | peoplePerHousehold[uss,usdt,th] |
constraints: | constraints: | ||
- | population[uss,th] = sum (households[uss,usdt,th] * peoplePerHousehold[uss,usdt,th]; dim=usdt) | + | population[uss,th] = sum (households[uss,usdt,th] * peoplePerHousehold[uss,usdt,th]; dim=usdt) |
makeup a relative propensity: | makeup a relative propensity: | ||
- | relPopPersPerHH[usdt] = where each value is related to one of the entries | + | relPopPersPerHH[usdt] = where each value is related to one of the entries |
Finally the math to calculate peoplePerHousehold[uss,usdt,th] is: | Finally the math to calculate peoplePerHousehold[uss,usdt,th] is: | ||
- | local peoplePerHouseholdEst[uss,usdt,th] = households[uss,usdt,th] * peoplePerHousehold[usdt] | + | !Equation A: |
- | peoplePerHousehold[uss,usdt,th] = population[uss,th] / peoplePerHouseholdEst[uss,usdt,th] * relPopPersPerHH[usdt] | + | local populationEst[uss,th] = sum (households[uss,usdt,th] * relPopPersPerHH[usdt]; dim=usdt) |
- | + | !Equation B: | |
+ | peoplePerHousehold[uss,usdt,th] = (population[uss,th] / populationEst[uss,th]) * relPopPersPerHH[usdt] | ||