Attribute VB_Name = "b05_Wealth_Housing"
'**************************************************************************************
'*** Module b05_Wealth_Housing
'**************************************************************************************
'
' This module contains subroutines that simulates housing and wealth variables.
'
'  - Capital gain (h_wealth_CapitalGain)
'  - Debt (h_wealth_debt)
'  - Debt interest (h_wealth_debt_interest, h_wealth_debt_interestrate)
'  - Housing variables (h_house_interest, h_house_cost, h_house_area, h_wealth_real_home,
'      h_house_tax, h_house_purchase)
'  - Interest and dividends (h_wealth_InterestDividends)
'  - Regional migration
'  - Financial wealth (h_wealth_financial)
'  - Other real wealth (h_wealth_real_other)
'  - Private pension savings (i_wealth_pension_year, i_wealth_pension_total)
'**************************************************************************************

Option Explicit
Option Base 1

' Imputation of house area and real wealth from owned home

Private Sub Owncost(ByVal i As Long, ByVal newstatus As Single, ByVal q25 As Double, _
         ByVal q50 As Double, ByVal q75 As Double, ByVal q90 As Double, ByVal q95 As Double, _
         ByVal p50 As Double, ByVal p75, ByVal p90, ByVal p95)

  Dim value, area, loan, kb, bklimat, uvarme, udrift, taxv, interest, oldwealth As Long
  Dim pihat As Double, rndnr As Double
  Dim w1, w2, w3, w4 As Single
  Dim inr As Long
  
  Const XVARME1 As Single = 131             'Heating cost County 23-25 per square m
  Const XVARME2 As Single = 114             'Heating cost County 20-22 per square m
  Const XVARME3 As Single = 105             'Heating cost County 01-08, 15-19 per square m
  Const XVARME4 As Single = 105             'Heating cost County 09-14 per square m
  Const Xdrift  As Single = 114             'Operation cost square meter

  bklimat = kommundata(h_kommunindex(i)).bklimat
  
  If h_wealth_financial(i) <= p50 Then w1 = 1 Else w1 = 0
  If h_wealth_financial(i) > p50 And h_wealth_financial(i) <= p75 Then w2 = 1 Else w2 = 0
  If h_wealth_financial(i) > p75 And h_wealth_financial(i) <= p90 Then w3 = 1 Else w3 = 0
  If h_wealth_financial(i) > p90 And h_wealth_financial(i) <= p95 Then w4 = 1 Else w4 = 0
  
  If model_time = 0 Then 'h_house_area not known in startdata'
    h_house_area(i) = House_Mod4(i, q25, q50, q75, q90, q95)     'house size, square meter
  End If
            
  If model_time > 0 And newstatus = 1 Then 'h_house_market_value and h_house_debt are known in startdata
    area = House_Mod4(i, q25, q50, q75, q90, q95)     'house size, square meter
    value = House_Mod5(i, q25, q50, q75, q90, q95, area / 100, w1, w2, w3, w4) 'house market value
    
    h_wealth_real_home(i) = mini(500000000, Int(value * m_price_rw_home99)) 'Price indexation
    h_house_tax(i) = h_wealth_real_home(i) / kommundata(h_kommunindex(i)).kb
    h_house_area(i) = Int(area)
   
  End If   'end model_time >0 and newstatus=1
    
  If bklimat = 1 Then uvarme = XVARME1 * h_house_area(i) 'heating cost climate zon 1
  If bklimat = 2 Then uvarme = XVARME2 * h_house_area(i) 'heating cost climate zon 2
  If bklimat = 3 Then uvarme = XVARME3 * h_house_area(i) 'heating cost climate zon 3
  If bklimat = 4 Then uvarme = XVARME4 * h_house_area(i) 'heating cost climate zon 4

  h_house_cost(i) = (Xdrift * h_house_area(i) + uvarme) / m_price99        'operating cost in current prices
           
End Sub

'----------------------------------------------------------------------------------------------------------------- 'Hyresuppgifterna för 1999 är hämtade från BO 39 SM 0002, tabell 3. 'Hushållet tilldelas en lägenhetstyp efter antal personer i hushållet. 'Som boendeutgift sätts en genomsnittlig årshyra efter region och lägenhetstyp. ' 'Antal Antal Region Region Region Region 'personer rum A B C D '1 1 34109 35093 31470 29132 '2 2 47230 47065 42742 40261 '3-4 3 57931 56698 52770 49908 '5-6 4 70816 70714 65671 61162 '7 5+ 92141 88174 81307 69562 ' ' Region A = Stor - Stockholm ' Region B = Stor - Göteborg ' Region C = Övriga kommuner med mer än 75 000 invånare ' Region D = Övriga kommuner ' Anm: Observera att denna boendeutgift ger ett lägre värde än den faktiska eftersom hushållen i ' verkligheten bor rymligare än vad som anges av tabellen ovan. ' I syfte att korrigera den för låga kostnaden har jag beräknat boendekostnad för hyresboende från HEK-99 ' Variabel UBOENDE uppdelad på BBOREG för kosthushållet. ' 'Antal Region Region Region Region 'personer A B C D '1 45278 46921 41371 39075 '2 59828 58710 53195 48711 '3-4 69076 65693 61123 55577 '5-6 73816 64849 65455 61354 '7 73942 60965 84439 82449 ' 'Som synes stora skillnader, men beräkningarna för stora hushåll bygger på mycket få observationer. 'Jag använder HEK för hushåll 1-4 personer och BO 39 för övriga.
Private Sub Rentcost(ByVal i As Long) Dim cost As Single Dim abcd_r As Integer, member As Integer If model_time = 0 Then member = get_hh_size(i) 'h_size is not set at base year Else member = h_size(i) End If abcd_r = kommundata(h_kommunindex(i)).abcd_region If member = 1 Then If abcd_r = 1 Then cost = 45278 If abcd_r = 2 Then cost = 46921 If abcd_r = 3 Then cost = 41371 If abcd_r = 4 Then cost = 39075 End If If member = 2 Then If abcd_r = 1 Then cost = 59828 If abcd_r = 2 Then cost = 58710 If abcd_r = 3 Then cost = 53195 If abcd_r = 4 Then cost = 48711 End If If member >= 3 And member <= 4 Then If abcd_r = 1 Then cost = 69076 If abcd_r = 2 Then cost = 65693 If abcd_r = 3 Then cost = 61123 If abcd_r = 4 Then cost = 55577 End If If member >= 5 And member <= 6 Then If abcd_r = 1 Then cost = 70816 If abcd_r = 2 Then cost = 70714 If abcd_r = 3 Then cost = 65671 If abcd_r = 4 Then cost = 61162 End If If member >= 7 Then If abcd_r = 1 Then cost = 92141 If abcd_r = 2 Then cost = 88174 If abcd_r = 3 Then cost = 81307 If abcd_r = 4 Then cost = 69562 End If h_house_area(i) = member * 30 'imputing housing area h_house_cost(i) = cost / m_price99 ' cost in current prices h_house_tax(i) = 0 h_wealth_real_home(i) = 0 h_house_interest(i) = 0 End Sub
'******************************************************************** '*** Model 8 - House size for owner ' Y=square meter / 100 ' OLS model
Function House_Mod4(ByVal hhidx As Long, ByVal q25 As Double, ByVal q50 As Double, _ ByVal q75 As Double, ByVal q90 As Double, ByVal q95 As Double) As Double Const a0 As Single = 1.33506 'Intercept Const a1 As Single = -0.35159 'Max age 18-19 = 1, else 0 Const a2 As Single = -0.3091 'Max age 20-24 = 1, else 0 Const a3 As Single = -0.28882 'Max age 25-29 = 1, else 0 Const a4 As Single = -0.17579 'Max age 30-34 = 1, else 0 Const a5 As Single = -0.1594 'Max age 35-39 = 1, else 0 Const a6 As Single = -0.12083 'Max age 40-44 = 1, else 0 Const a7 As Single = -0.03803 'Max age 45-49 = 1, else 0 Const a8 As Single = 0.20469 'Marital status, 0=Single, 1=Non-single Const a9 As Single = 0.12915 'Number of children (in the household) < 18 years Const a10 As Single = -0.01167 'Number of children squared Const a11 As Single = -0.46524 'tax income : X <=p25 Const a12 As Single = -0.3756 'tax income : p25 < X <= p50 Const a13 As Single = -0.29305 'tax income : p50 < X <= p75 Const a14 As Single = -0.23555 'tax income : p75 < X <= p90 Const a15 As Single = -0.102 'tax income : p90 < X <= p95 Const a16 As Single = -0.12207 '1 if H-region=1, else 0, Stockholm Const a17 As Single = -0.04758 '1 if H-region=2, else 0, Gothenburg, Malmo Dim v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17 As Double Dim ex As Double Dim h_income As Double Dim inr, age_max, h_region As Single age_max = h_max_age(hhidx) If age_max > 17 And age_max < 20 Then v1 = 1 Else v1 = 0 If age_max > 19 And age_max < 25 Then v2 = 1 Else v2 = 0 If age_max > 24 And age_max < 30 Then v3 = 1 Else v3 = 0 If age_max > 29 And age_max < 35 Then v4 = 1 Else v4 = 0 If age_max > 34 And age_max < 40 Then v5 = 1 Else v5 = 0 If age_max > 39 And age_max < 45 Then v6 = 1 Else v6 = 0 If age_max > 44 And age_max < 50 Then v7 = 1 Else v7 = 0 If h_n_adults(hhidx) > 1 Then v8 = 1 Else v8 = 0 'Beräkna antal barn under 18 år i hushållet v9 = 0 inr = h_first_indnr(hhidx) 'First i-nr Do Until inr = 0 If i_age(indnr2index(inr)) < 18 Then v9 = v9 + 1 inr = i_next_indnr(indnr2index(inr)) Loop v10 = v9 * v9 h_income = h_max_inc_taxable(hhidx) If h_income <= q25 Then v11 = 1 Else v11 = 0 If h_income > q25 And h_income <= q50 Then v12 = 1 Else v12 = 0 If h_income > q50 And h_income <= q75 Then v13 = 1 Else v13 = 0 If h_income > q75 And h_income <= q90 Then v14 = 1 Else v14 = 0 If h_income > q90 And h_income <= q95 Then v15 = 1 Else v15 = 0 h_region = kommundata(h_kommunindex(hhidx)).h_region If h_region = 1 Then v16 = 1 Else v16 = 0 If h_region = 8 Or h_region = 9 Then v17 = 1 Else v17 = 0 ex = a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + _ a7 * v7 + a8 * v8 + a9 * v9 + a10 * v10 + a11 * v11 + a12 * v12 + a13 * v13 + _ a14 * v14 + a15 * v15 + a16 * v16 + a17 * v17 House_Mod4 = Int(ex * 100) End Function
'******************************************************************** '*** Model 9 - Market value of home for owner ' y=log(marketv/100000); ' OLS model
Function House_Mod5(ByVal hhidx As Long, ByVal q25 As Double, ByVal q50 As Double, ByVal q75 As Double, _ ByVal q90 As Double, ByVal q95 As Double, ByVal area As Single, _ ByVal w1 As Double, ByVal w2 As Double, ByVal w3 As Double, ByVal w4 As Double) As Double Const a0 As Single = 0.21501 'Intercept Const a1 As Single = 0.02748 'Max. age in the household Const a2 As Single = -0.02881 'Square of max age / 100 Const a3 As Single = 0.22295 'Marital status, 0=Single, 1=Non-single Const a4 As Single = -0.00049 'Number of children (in the household) < 18 years Const a5 As Single = 0.16705 'tax income : X <=p25 Const a6 As Single = 0.00117 'tax income : p25 < X <= p50 Const a7 As Single = -0.03867 'tax income : p50 < X <= p75 Const a8 As Single = -0.01329 'tax income : p75 < X <= p90 Const a9 As Single = -0.03896 'tax income : p90 < X <= p95 Const a10 As Single = 0.88275 '1 if H-region=1, else 0, Stockholm Const a11 As Single = 0.73231 '1 if H-region=2, else 0, Gothenburg, Malmo Const a12 As Single = 0.40752 '1 if H-region=3, else 0, Larger cities Const a13 As Single = 0.3012 '1 if H-region=4, else 0, Southern medium densed areas Const a14 As Single = 0.15413 '1 if H-region=5, else 0, Northern densed areas Const a15 As Single = 0.81052 'Area (output from equation above) Const a16 As Single = -0.58996 'Household financial wealth: < p50 Const a17 As Single = -0.41537 'Household financial wealth:p50-p75 Const a18 As Single = -0.27278 'Household financial wealth:p75-p90 Const a19 As Single = -0.15499 'Household financial wealth:p90-p95 Const a20 As Single = 0.65148 'RMSE Dim v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 As Double Dim ex, h_income As Double Dim inr, h_region As Single v1 = h_max_age(hhidx) v2 = v1 * v1 / 100 If h_n_adults(hhidx) > 1 Then v3 = 1 Else v3 = 0 'Beräkna antal barn under 18 år i hushållet v4 = 0 inr = h_first_indnr(hhidx) 'First i-nr Do Until inr = 0 If i_age(indnr2index(inr)) < 18 Then v4 = v4 + 1 inr = i_next_indnr(indnr2index(inr)) Loop h_income = h_max_inc_taxable(hhidx) If h_income <= q25 Then v5 = 1 Else v5 = 0 If h_income > q25 And h_income <= q50 Then v6 = 1 Else v6 = 0 If h_income > q50 And h_income <= q75 Then v7 = 1 Else v7 = 0 If h_income > q75 And h_income <= q90 Then v8 = 1 Else v8 = 0 If h_income > q90 And h_income <= q95 Then v9 = 1 Else v9 = 0 h_region = kommundata(h_kommunindex(hhidx)).h_region If h_region = 1 Then v10 = 1 Else v10 = 0 If h_region = 8 Or h_region = 9 Then v11 = 1 Else v11 = 0 If h_region = 3 Then v12 = 1 Else v12 = 0 If h_region = 4 Then v13 = 1 Else v13 = 0 If h_region = 5 Then v14 = 1 Else v14 = 0 v15 = area ex = a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + _ a7 * v7 + a8 * v8 + a9 * v9 + a10 * v10 + a11 * v11 + a12 * v12 + a13 * v13 + _ a14 * v14 + a15 * v15 + a16 * w1 + a17 * w2 + a18 * w3 + a19 * w4 House_Mod5 = Int(Exp(ex + 0.5 * a20 ^ 2) * 100000) End Function
'***************************************************** *********************************** ' Wealth: Routine for calculation of: ' Financial and real wealth. ' 1. Predict the probability of financial wealth(t) given zero wealth(t-1) ' 2. Predict the amount of financial wealth given a positive predicted wealth from model 1 ' 3. Predict financial wealth(t) given positive wealth(t-1) ' 4. Predict the probability of other real wealth(t) given zero wealth(t-1) ' 5. Predict the amount of other real wealth given a positive predicted wealth from model 4 ' 6. Predict other real wealth(t) given positive wealth(t-1) using a random walk ' 7. Predict the probability of pension savings per year ' 8. Predict the amount of pension savings per year ' ' Probability and amount of Wealth is imputed for households. ' Financial wealth includes all financial assets ' Other real wealth includes all real wealth except the value of own home ' Pension savings is imputed for individuals ' 'output: '***************************************************** *********************************** 'SESIM-variable :Description 'h_wealth_financial :Household financial wealth, SEK 'h_wealth_real_other :Household real wealth except own home, SEK 'i_wealth_financial :Individual financial wealth, SEK 'i_i_wealth_pension_year :Individual tax deductible pension savings, SEK 'i_i_wealth_pension_total :Individual accumulated pension savings '***************************************************** ************************************
Public Sub Wealth_PensionSavings() '! Wealth: Routine for calculation of Financial and real other wealth. status "Wealth_PensionSavings" Printdok "Wealth_PensionSavings" Dim i As Long Dim lfwealth As Double, lpwealth As Double, lrwealth As Double, shares_general99 As Double Dim rand() As Double, rand2 As Double, step As Double, tshares_general99 As Double Dim pihat As Double, rndnr As Double, ar As Double, PercShares As Double, tempwealth As Double Dim q25 As Double, q50 As Double, q75 As Double, q90 As Double, q95 As Double Dim qh25 As Double, qh50 As Double, qh75 As Double, qh90 As Double, qh95 As Double Dim age_max As Single Dim ed_max As Byte Dim va1, va2, va3, va4, va5, va6, va7, va8, va9, va10, va11, va12, vs, vi1, vi2, vi3, _ vi4, vi5 As Double Dim iru As Long Dim idx As Integer ReDim hincome(1 To m_hcount) As Double 'Local variable ReDim taxinc(1 To m_icount) As Double Dim t2, sigma2, mu, lnx As Single ' Part of financial wealth that relates to shares (used for indexation of FW) PercShares = 0.6 Dim robusteow 'Percentiles of residuals for model 5 minvalue= -1.76624 maxvalue 3.4572 robusteow = Array(-1.76624, -1.4302, -1.2935, -1.2489, -1.2144, -1.1719, -1.1397, -1.1173, -1.102, -1.0809, -1.0539, _ -1.0303, -1.0153, -1.0016, -0.9774, -0.9644, -0.9437, -0.9271, -0.9092, -0.8924, -0.8779, _ -0.8525, -0.8253, -0.802, -0.7706, -0.7378, -0.7162, -0.6956, -0.6822, -0.669, -0.6502, _ -0.6212, -0.6002, -0.5682, -0.5419, -0.5149, -0.4863, -0.4515, -0.4264, -0.3993, -0.3669, _ -0.3377, -0.313, -0.2534, -0.2247, -0.1896, -0.1629, -0.1423, -0.117, -0.076, -0.0586, _ -0.0249, -0.0035, 0.0123, 0.0363, 0.0627, 0.0961, 0.1289, 0.158, 0.1881, 0.2166, _ 0.2554, 0.2837, 0.3152, 0.3585, 0.3799, 0.4106, 0.4533, 0.4785, 0.497, 0.5242, _ 0.5634, 0.5924, 0.6261, 0.6686, 0.6881, 0.7095, 0.7289, 0.757, 0.7849, 0.8264, _ 0.861, 0.898, 0.9304, 0.9715, 1.0003, 1.0457, 1.0781, 1.1398, 1.1709, 1.2641, _ 1.3195, 1.4021, 1.4613, 1.5665, 1.6667, 1.7766, 1.9009, 2.0137, 2.2858, 3.4572) 'Calculates household financial wealth and taxable income as the sum of all adult members wealth For i = 1 To m_hcount If model_time = 0 Then 'Some adjustments in model_time=0 h_wealth_financial(i) = get_hh_sum(indnr2index(h_first_indnr(i)), "i_wealth_financial") ' If h_wealth_financial(i) < 10000 Then h_wealth_financial(i) = 0 If h_wealth_real_other(i) < 50000 Then h_wealth_real_other(i) = 0 ' Calculate total real wealth h_wealth_real(i) = h_wealth_real_home(i) + h_wealth_real_other(i) End If ' hincome(i) = get_hh_sum(indnr2index(h_first_indnr(i)), "i_inc_taxable") hincome(i) = h_sum_inc_taxable(i) Next 'Percentiles for sum of i_inc_taxable Dim perc As Variant perc = arr_Percentile(hincome, 25, 50, 75, 90, 95) qh25 = perc(1, 2) qh50 = perc(2, 2) qh75 = perc(3, 2) qh90 = perc(4, 2) qh95 = perc(5, 2) 'Financial wealth '----------------------------------------------------- ------------------------------------------------- If model_time > 0 Then 'Financial wealth known in start data ' Draw random numbers ReDim rand(1 To m_icount) Call RANNOR(m_icount, rand(1), model_time + base_year + random * Rnd) For i = 1 To m_hcount 'Household loop for wealth age_max = h_max_age(i) If age_max <= 24 Then va1 = 1 Else va1 = 0 If age_max >= 25 And age_max <= 29 Then va2 = 1 Else va2 = 0 If age_max >= 30 And age_max <= 34 Then va3 = 1 Else va3 = 0 If age_max >= 35 And age_max <= 39 Then va4 = 1 Else va4 = 0 If age_max >= 40 And age_max <= 44 Then va5 = 1 Else va5 = 0 If age_max >= 45 And age_max <= 49 Then va6 = 1 Else va6 = 0 If age_max >= 50 And age_max <= 54 Then va7 = 1 Else va7 = 0 If age_max >= 55 And age_max <= 59 Then va8 = 1 Else va8 = 0 If age_max >= 60 And age_max <= 64 Then va9 = 1 Else va9 = 0 If age_max >= 65 And age_max <= 69 Then va10 = 1 Else va10 = 0 If age_max >= 70 And age_max <= 74 Then va11 = 1 Else va11 = 0 If age_max >= 75 And age_max <= 79 Then va12 = 1 Else va12 = 0 If h_n_adults(i) > 1 Then vs = 1 Else vs = 0 ' hincome(i) = get_hh_sum(indnr2index(h_first_indnr(i)), "i_inc_taxable") hincome(i) = h_sum_inc_taxable(i) If hincome(i) <= qh25 Then vi1 = 1 Else vi1 = 0 If hincome(i) > qh25 And hincome(i) <= qh50 Then vi2 = 1 Else vi2 = 0 If hincome(i) > qh50 And hincome(i) <= qh75 Then vi3 = 1 Else vi3 = 0 If hincome(i) > qh75 And hincome(i) <= qh90 Then vi4 = 1 Else vi4 = 0 If hincome(i) > qh90 And hincome(i) <= qh95 Then vi5 = 1 Else vi5 = 0 'Financial wealth '----------------------------------------------------- ----------------------------------------------------- lfwealth = h_wealth_financial(i) 'Lag wealth (before updating) pihat = 0 If lfwealth <= 0 Then pihat = Fwealth_Mod1(va1, va2, va3, va4, va5, va6, va7, va8, va9, va10, va11, va12, vi1, vi2, vi3, vi4, vi5) 'probability of wealth rndnr = Rnd If rndnr < pihat Then rand2 = Rnd ' Generate random numbers log normal Const LAMBDA As Single = 0.4116 'Variance of lognormal Const theta As Single = 1.09 '-1.09 = min of lognormal t2 = theta ^ 2 mu = Log(t2) - 0.5 * Log(t2 + LAMBDA) 'Mean of normal log(x)' sigma2 = Log(1 + LAMBDA / t2) 'Variance of normal log(x)' lnx = mu + gauss(0, Sqr(sigma2)) ar = mini((Exp(lnx) - theta), 5.2) tshares_general99 = PercShares * m_shares_total99 + (1 - PercShares) * m_interest_long99 h_wealth_financial(i) = Fwealth_Mod2(ar, va1, va2, va3, va4, va5, va6, va7, va8, va9, va10, va11, va12, vi1, vi2, vi3, vi4, vi5) 'Wealth > 0 If h_wealth_financial(i) < 0 Then h_wealth_financial(i) = 0 'Wealth < 0 SEK is set to zero tempwealth = PercShares * h_wealth_financial(i) * m_shares_total99 + _ (1 - PercShares) * h_wealth_financial(i) * m_interest_long99 If (tempwealth <= 500000000) Then h_wealth_financial(i) = tempwealth Else h_wealth_financial(i) = 500000000 End If Else h_wealth_financial(i) = 0 End If End If 'End lfwealth <= 0 If lfwealth > 0 Then h_wealth_financial(i) = Fwealth_Mod3(i, lfwealth, va1, va2, va3, va4, va5, va6, va7, va8, va9, va10, va11, va12, vi1, vi2, vi3, vi4, vi5) 'Wealth(t) > 0 given wealth(t-1)>0 tempwealth = PercShares * h_wealth_financial(i) * (1 + (m_shares_rate + m_shares_dividends) / 100) + _ (1 - PercShares) * h_wealth_financial(i) * (1 + m_interest_long / 100) 'In order to get current value If (tempwealth <= 500000000) Then h_wealth_financial(i) = tempwealth Else h_wealth_financial(i) = 500000000 End If If h_wealth_financial(i) < 0 Then h_wealth_financial(i) = 0 'Wealth < 0 SEK is set to zero End If ' If household debt has decreased during the year the financial wealth is ' decreased by the same amount, i.e. the household has payed mortgages ' If h_wealth_debt(i) < h_wealth_debt1(i) Then ' h_wealth_financial(i) = h_wealth_financial(i) - (h_wealth_debt1(i) - h_wealth_debt(i)) ' h_wealth_financial(i) = maxi(0, h_wealth_financial(i)) ' End If ' Individualize financial wealth Call Individualize_FinancialWealth(i) 'Other real wealth '----------------------------------------------------- ---------------------------------------------------- lrwealth = h_wealth_real_other(i) 'Lag wealth (before updating) pihat = 0 If lrwealth <= 0 Then pihat = Rwealth_Mod1(va1, va2, va3, va4, va5, va6, va7, va8, va9, va10, va11, va12, vs, vi1, vi2, vi3, vi4, vi5) 'probability of wealth rndnr = Rnd If rndnr < pihat Then rand2 = Rnd idx = Int(rand2 * 100) + 1 ' Vector index step = rand2 * 100 - Int(rand2 * 100) ' Coefficient for linear interpolation between percentiles ar = (robusteow(idx + 1) - robusteow(idx)) * step + robusteow(idx) ' Simulated residual h_wealth_real_other(i) = Rwealth_Mod2(ar, age_max, vi1, vi2, vi3, vi4, vi5) 'Wealth > 0 '*** Truncation in order to prevent overflow error (TP060219) h_wealth_real_other(i) = mini(500000000, h_wealth_real_other(i) * m_price_rw_other99) 'In order to get current value If h_wealth_real_other(i) < 50000 / m_price99 Then h_wealth_real_other(i) = 0 'Wealth < 50 000 SEK is set to zero Else h_wealth_real_other(i) = 0 End If End If 'End lrwealth <= 0 If lrwealth > 0 Then 'Wealth(t) > 0 given wealth(t-1)>0 Assume same return as PPM h_wealth_real_other(i) = mini(500000000, maxi(0, (lrwealth + Sqr(2230) * rand(i))) * m_price_rw_other) If h_wealth_real_other(i) < 50000 / m_price99 Then h_wealth_real_other(i) = 0 'Wealth < 50 000 SEK is set to zero End If ' Calculate total real wealth h_wealth_real(i) = h_wealth_real_home(i) + h_wealth_real_other(i) ' Add the KB-adjusted value of the other real wealth to h_house_tax '*** Truncation to prevent overflow error (TP060219) h_house_tax(i) = mini(500000000, h_house_tax(i) + h_wealth_real_other(i) / kommundata(h_kommunindex(i)).kb) Next 'household loop for wealth ends here ' Pension savings '---------------------------------------------------- ---------------------------------------------------------------------- For i = 1 To m_icount taxinc(i) = i_inc_taxable(i) Next 'Percentiles for i_inc_taxable perc = arr_Percentile(taxinc, 25, 50, 75, 90, 95) q25 = perc(1, 2) q50 = perc(2, 2) q75 = perc(3, 2) q90 = perc(4, 2) q95 = perc(5, 2) For i = 1 To m_icount 'Individual loop for Pension savings If i_abroad(i) = 0 Then 'Only individuals in sweden have wealth If i_age(i) >= 18 And i_age(i) <= 64 Then 'Only allows individuals 18 -64 to obtain pension savings in this module pihat = 0 lpwealth = i_wealth_pension_year1(i) 'Lag wealth (before updating) If lpwealth <= 0 Then pihat = Psavings_Mod1(i, q25, q50, q75, q90, q95) 'probability of yearly pension savings rndnr = Rnd If rndnr < pihat Then i_wealth_pension_year(i) = Psavings_Mod2(i, q25, q50, q75, q90, q95) 'pension savings > 0 i_wealth_pension_year(i) = i_wealth_pension_year(i) / m_price99 'In order to get current price Else i_wealth_pension_year(i) = 0 End If End If 'End lpwealth <= 0 If lpwealth > 0 Then i_wealth_pension_year(i) = lpwealth * m_KPI '*** Calculated in a05_Rules: calc_rules '*** i_wealth_pension_total(i) = (i_wealth_pension_total(i) + i_wealth_pension_year(i)) * (1 + m_interest_long / 100) End If 'End lpwealth > 0 End If 'End 18-64 ' Else 'i_abroad=0 i_wealth_pension_year(i) = 0 i_wealth_pension_total(i) = 0 End If 'End i_abroad Next 'Individual loop for pension saving ends here End If 'If statement for model_time > 0 End Sub
'***************************************************** *************** '*** Model 1 - probability of financial wealth(1=yes, 0=no) *** ' DY=1 if wealth, else 0 ' logit model
Function Fwealth_Mod1(ByVal va1 As Double, ByVal va2 As Double, ByVal va3 As Double, ByVal va4 As Double, ByVal va5 As Double, ByVal va6 As Double, _ ByVal va7 As Double, ByVal va8 As Double, ByVal va9 As Double, ByVal va10 As Double, ByVal va11 As Double, ByVal va12 As Double, _ ByVal vi1 As Double, ByVal vi2 As Double, ByVal vi3 As Double, ByVal vi4 As Double, ByVal vi5 As Double) As Double 'Const a0 As Single = -0.30751 'Intercept 'Const a1 As Single = -1.63016 ' -24 'Const a2 As Single = -1.07604 '25-29 'Const a3 As Single = -0.85982 '30-34 'Const a4 As Single = -1.03412 '35-39 'Const a5 As Single = -1.0469 '40-44 'Const a6 As Single = -1.23921 '45-49 'Const a7 As Single = -1.2541 '50-54 'Const a8 As Single = -0.8583 '55-59 'Const a9 As Single = -0.79522 '60-64 'Const a10 As Single = -0.51795 '65-69 'Const a11 As Single = -0.5936 '70-74 'Const a12 As Single = -0.31776 '75-79 'Const a13 As Single = -2.88025 'tax income : X <=p25 'Const a14 As Single = -2.38752 'tax income : p25 < X <= p50 'Const a15 As Single = -1.94826 'tax income : p50 < X <= p75 'Const a16 As Single = -1.38027 'tax income : p75 < X <= p90 'Const a17 As Single = -0.71506 'tax income : p90 < X <= p95 Const a0 As Single = 0.60048 'Intercept Const a1 As Single = -0.88498 ' -24 Const a2 As Single = -0.69736 '25-29 Const a3 As Single = -0.81919 '30-34 Const a4 As Single = -0.93684 '35-39 Const a5 As Single = -1.04328 '40-44 Const a6 As Single = -1.16899 '45-49 Const a7 As Single = -1.14642 '50-54 Const a8 As Single = -1.08049 '55-59 Const a9 As Single = -0.90114 '60-64 Const a10 As Single = -0.733 '65-69 Const a11 As Single = -0.65676 '70-74 Const a12 As Single = -0.43381 '75-79 Const a13 As Single = -2.60493 'tax income : X <=p25 Const a14 As Single = -2.13505 'tax income : p25 < X <= p50 Const a15 As Single = -1.57561 'tax income : p50 < X <= p75 Const a16 As Single = -1.04016 'tax income : p75 < X <= p90 Const a17 As Single = -0.61007 'tax income : p90 < X <= p95 Dim ex As Double ex = Exp(a0 + a1 * va1 + a2 * va2 + a3 * va3 + a4 * va4 + a5 * va5 + a6 * va6 + _ a7 * va7 + a8 * va8 + a9 * va9 + a10 * va10 + a11 * va11 + a12 * va12 + _ a13 * vi1 + a14 * vi2 + a15 * vi3 + a16 * vi4 + a17 * vi5) Fwealth_Mod1 = ex / (1 + ex) 'ex = a0 + a1 * va1 + a2 * va2 + a3 * va3 + a4 * va4 + a5 * va5 + a6 * va6 + _ a7 * va7 + a8 * va8 + a9 * va9 + a10 * va10 + a11 * va11 + a12 * va12 + _ a13 * vi1 + a14 * vi2 + a15 * vi3 + a16 * vi4 + a17 * vi5 ' Fwealth_Mod1 = ex End Function
'***************************************************** *************** '*** Model 2 - financial wealth given wealth > 0 *** ' Y=(financial wealth / 1000) kronor ' OLS model
Function Fwealth_Mod2(ByVal ar As Double, ByVal va1 As Double, ByVal va2 As Double, ByVal va3 As Double, ByVal va4 As Double, ByVal va5 As Double, ByVal va6 As Double, _ ByVal va7 As Double, ByVal va8 As Double, ByVal va9 As Double, ByVal va10 As Double, ByVal va11 As Double, ByVal va12 As Double, _ ByVal vi1 As Double, ByVal vi2 As Double, ByVal vi3 As Double, ByVal vi4 As Double, ByVal vi5 As Double) As Double 'Const a0 As Single = 4.62107 'Intercept 'Const a1 As Single = -0.05541 ' -24 'Const a2 As Single = 0.01105 '25-29 'Const a3 As Single = 0.01137 '30-34 'Const a4 As Single = 0.04983 '35-39 'Const a5 As Single = 0.04587 '40-44 'Const a6 As Single = 0.02089 '45-49 'Const a7 As Single = 0.05717 '50-54 'Const a8 As Single = 0.05585 '55-59 'Const a9 As Single = 0.07443 '60-64 'Const a10 As Single = 0.0622 '65-69 'Const a11 As Single = 0.04189 '70-74 'Const a12 As Single = 0.08397 '75-79 'Const a13 As Single = -0.26139 'tax income : X <=p25 'Const a14 As Single = -0.27846 'tax income : p25 < X <= p50 'Const a15 As Single = -0.25637 'tax income : p50 < X <= p75 'Const a16 As Single = -0.23667 'tax income : p75 < X <= p90 'Const a17 As Single = -0.17354 'tax income : p90 < X <= p95 Const a0 As Single = 4.11968 'Intercept Const a1 As Single = -0.38918 ' -24 Const a2 As Single = -0.23525 '25-29 Const a3 As Single = -0.09806 '30-34 Const a4 As Single = -0.11248 '35-39 Const a5 As Single = -0.08929 '40-44 Const a6 As Single = -0.13599 '45-49 Const a7 As Single = -0.1094 '50-54 Const a8 As Single = 0.10601 '55-59 Const a9 As Single = 0.01721 '60-64 Const a10 As Single = 0.1681 '65-69 Const a11 As Single = 0.05592 '70-74 Const a12 As Single = 0.05422 '75-79 Const a13 As Single = -0.57373 'tax income : X <=p25 Const a14 As Single = -0.55061 'tax income : p25 < X <= p50 Const a15 As Single = -0.57211 'tax income : p50 < X <= p75 Const a16 As Single = -0.5316 'tax income : p75 < X <= p90 Const a17 As Single = -0.31861 'tax income : p90 < X <= p95 Dim ex As Double ex = a0 + a1 * va1 + a2 * va2 + a3 * va3 + a4 * va4 + a5 * va5 + a6 * va6 + _ a7 * va7 + a8 * va8 + a9 * va9 + a10 * va10 + a11 * va11 + a12 * va12 + _ a13 * vi1 + a14 * vi2 + a15 * vi3 + a16 * vi4 + a17 * vi5 Fwealth_Mod2 = Int(Exp(ex + ar)) * 1000 End Function
'***************************************************** *************** '*** Model 3 - financial wealth given wealth > 0 *** ' Y=log(financial wealth / 1000) kronor ' Random parameter
Function Fwealth_Mod3(ByVal i As Long, ByVal lfwealth As Double, ByVal va1 As Double, ByVal va2 As Double, ByVal va3 As Double, ByVal va4 As Double, ByVal va5 As Double, ByVal va6 As Double, _ ByVal va7 As Double, ByVal va8 As Double, ByVal va9 As Double, ByVal va10 As Double, ByVal va11 As Double, ByVal va12 As Double, _ ByVal vi1 As Double, ByVal vi2 As Double, ByVal vi3 As Double, ByVal vi4 As Double, ByVal vi5 As Double) As Double 'Const a0 As Single = 0.86796 'Intercept Const a0 As Single = 0.95 'Intercept NOTE: calibrated LF 060111 Const a1 As Single = 0.88323 'Wealth(t-1) Const a2 As Single = -0.01779 'lagy* -24 Const a3 As Single = -0.01527 'lagy*25-29 Const a4 As Single = -0.01836 'lagy*30-34 Const a5 As Single = -0.01697 'lagy*35-39 Const a6 As Single = -0.01633 'lagy*40-44 Const a7 As Single = -0.01511 'lagy*45-49 Const a8 As Single = -0.01153 'lagy*50-54 Const a9 As Single = -0.0066 'lagy*55-59 Const a10 As Single = -0.00515 'lagy*60-64 Const a11 As Single = -0.00329 'lagy*65-69 Const a12 As Single = -0.00188 'lagy*70-74 Const a13 As Single = 0.00036 'lagy*75-79 Const a14 As Single = 0.04294 'lagy*tax income : X <=p25 Const a15 As Single = 0.03045 'lagy*tax income : p25 < X <= p50 Const a16 As Single = 0.01779 'lagy*tax income : p50 < X <= p75 Const a17 As Single = 0.01147 'lagy*tax income : p75 < X <= p90 Const a18 As Single = 0.00296 'lagy*tax income : p90 < X <= p95 Const a19 As Single = -0.4743 'tax income : X <=p25 Const a20 As Single = -0.35605 'tax income : p25 < X <= p50 Const a21 As Single = -0.25246 'tax income : p50 < X <= p75 Const a22 As Single = -0.1863 'tax income : p75 < X <= p90 Const a23 As Single = -0.09846 'tax income : p90 < X <= p95 Const a24 As Single = 0.00408 'Index Stockholm stock exch. Const a25 As Single = 0.01979 'sigma_u Const a26 As Single = 0.3732 'sigma_e Dim ex As Double, wl As Double wl = Log(lfwealth / 1000) ' Random effects intercept is drawn only for new households If h_wealth_financial_varcomp(i) = 0 Then h_wealth_financial_varcomp(i) = gauss(0, a25) ex = a0 + a1 * wl + a2 * va1 * wl + a3 * va2 * wl + a4 * va3 * wl + a5 * va4 * wl + a6 * va5 * wl + _ a7 * va6 * wl + a8 * va7 * wl + a9 * va8 * wl + a10 * va9 * wl + a11 * va10 * wl + a12 * va11 * wl + a13 * va12 * wl + _ a14 * vi1 * wl + a15 * vi2 * wl + a16 * vi3 * wl + a17 * vi4 * wl + a18 * vi5 * wl + _ a19 * vi1 + a20 * vi2 + a21 * vi3 + a22 * vi4 + a23 * vi5 + a24 * m_shares_rate Fwealth_Mod3 = Int(Exp(ex + h_wealth_financial_varcomp(i) + gauss(0, a26)) * 1000) End Function
'***************************************************** *************** '*** Model 4 - probability of real oher wealth(1=yes, 0=no) *** ' DY=1 if wealth, else 0 ' logit model
Function Rwealth_Mod1(ByVal va1 As Double, ByVal va2 As Double, ByVal va3 As Double, ByVal va4 As Double, ByVal va5 As Double, ByVal va6 As Double, _ ByVal va7 As Double, ByVal va8 As Double, ByVal va9 As Double, ByVal va10 As Double, ByVal va11 As Double, ByVal va12 As Double, _ ByVal vs As Double, _ ByVal vi1 As Double, ByVal vi2 As Double, ByVal vi3 As Double, ByVal vi4 As Double, ByVal vi5 As Double) As Double Const a0 As Single = -4.21229 'Intercept Const a1 As Single = -1.25596 ' -24 Const a2 As Single = -0.06498 '25-29 Const a3 As Single = 0.52977 '30-34 Const a4 As Single = 0.55369 '35-39 Const a5 As Single = 0.68137 '40-44 Const a6 As Single = 0.72257 '45-49 Const a7 As Single = 0.75253 '50-54 Const a8 As Single = 0.73157 '55-59 Const a9 As Single = 0.69633 '60-64 Const a10 As Single = 0.83386 '65-69 Const a11 As Single = 0.57541 '70-74 Const a12 As Single = 0.33514 '75-79 Const a13 As Single = 0.24162 'Status 1=non-single Const a14 As Single = -2.0716 'tax income : X <=p25 Const a15 As Single = -1.58002 'tax income : p25 < X <= p50 Const a16 As Single = -1.16858 'tax income : p50 < X <= p75 Const a17 As Single = -0.74813 'tax income : p75 < X <= p90 Const a18 As Single = -0.50311 'tax income : p90 < X <= p95 Dim ex As Double ex = Exp(a0 + a1 * va1 + a2 * va2 + a3 * va3 + a4 * va4 + a5 * va5 + a6 * va6 + _ a7 * va7 + a8 * va8 + a9 * va9 + a10 * va10 + a11 * va11 + a12 * va12 + _ a13 * vs + a14 * vi1 + a15 * vi2 + a16 * vi3 + a17 * vi4 + a18 * vi5) Rwealth_Mod1 = ex / (1 + ex) End Function
'***************************************************** *************** '*** Model 5 - other real wealth given wealth > 0 *** ' Y=(financial wealth / 1000) kronor ' OLS model
Function Rwealth_Mod2(ByVal ar As Double, ByVal age_max As Double, _ ByVal vi1 As Double, ByVal vi2 As Double, ByVal vi3 As Double, ByVal vi4 As Double, ByVal vi5 As Double) As Double Const a0 As Single = 6.07002 'Intercept Const a1 As Single = -0.00913 'max(age) in household Const a2 As Single = -0.7753 'tax income : X <=p25 Const a3 As Single = -0.7335 'tax income : p25 < X <= p50 Const a4 As Single = -0.60358 'tax income : p50 < X <= p75 Const a5 As Single = -0.50132 'tax income : p75 < X <= p90 Const a6 As Single = -0.24896 'tax income : p90 < X <= p95 Dim ex As Double ex = a0 + a1 * age_max + a2 * vi1 + a3 * vi2 + a4 * vi3 + a5 * vi4 + a6 * vi5 Rwealth_Mod2 = Int(Exp(ex + ar)) * 1000 End Function
'***************************************************** *************** '*** Model 6 - probability of pension savings(1=yes, 0=no) *** ' DY=1 if savings, else 0 ' logit model
Function Psavings_Mod1(ByVal iidx As Long, ByVal q25 As Double, ByVal q50 As Double, _ ByVal q75 As Double, ByVal q90 As Double, ByVal q95 As Double) As Double Const a0 As Single = -2.45608 'Intercept Const a1 As Single = 0.46826 'Sex, 0=male, 1=female Const a2 As Single = 0.03535 'Age Const a3 As Single = -0.09727 'Age*Age/100 Const a4 As Single = -0.45021 'Low education Const a5 As Single = -0.16363 'Medium education Const a6 As Single = 0.02269 'Marital status, 0=Single, 1=Non-single Const a7 As Single = -1.77198 'tax income : X <=p25 Const a8 As Single = -0.5832 'tax income : p25 < X <= p50 Const a9 As Single = -0.24682 'tax income : p50 < X <= p75 Const a10 As Single = -0.1255 'tax income : p75 < X <= p90 Const a11 As Single = 0.01663 'tax income : p90 < X <= p95 Const a12 As Single = 0.50501 'Nationality: 1 if Swedish Dim v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 As Double Dim ex As Double v1 = i_sex(iidx) - 1 v2 = i_age(iidx) v3 = v2 * v2 / 100 If i_edlevel(iidx) = 0 Then v4 = 1 Else v4 = 0 If i_edlevel(iidx) = 1 Then v5 = 1 Else v5 = 0 v6 = i_civ_stat(iidx) If i_inc_taxable(iidx) <= q25 Then v7 = 1 Else v7 = 0 If i_inc_taxable(iidx) > q25 And i_inc_taxable(iidx) <= q50 Then v8 = 1 Else v8 = 0 If i_inc_taxable(iidx) > q50 And i_inc_taxable(iidx) <= q75 Then v9 = 1 Else v9 = 0 If i_inc_taxable(iidx) > q75 And i_inc_taxable(iidx) <= q90 Then v10 = 1 Else v10 = 0 If i_inc_taxable(iidx) > q90 And i_inc_taxable(iidx) <= q95 Then v11 = 1 Else v11 = 0 If i_born_abroad(iidx) = 1 Then v12 = 0 Else v12 = 1 ex = Exp(a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + _ a7 * v7 + a8 * v8 + a9 * v9 + a10 * v10 + a11 * v11 + a12 * v12) Psavings_Mod1 = ex / (1 + ex) End Function
'***************************************************** *************** '*** Model 7 - amount of pension savings given savings > 0 *** ' Y=(pension savings / 1000) kronor ' OLS model
Function Psavings_Mod2(ByVal iidx As Long, ByVal q25 As Double, ByVal q50 As Double, _ ByVal q75 As Double, ByVal q90 As Double, ByVal q95 As Double) As Double Const a0 As Single = 14.22205 'Intercept Const a1 As Single = -0.1947 'Sex, 0=male, 1=female Const a2 As Single = -0.25838 'Age Const a3 As Single = 0.59683 'Age*Age/100 Const a4 As Single = -1.65896 'Low education Const a5 As Single = -1.07824 'Medium education Const a6 As Single = -6.39336 'tax income : X <=p25 Const a7 As Single = -7.36022 'tax income : p25 < X <= p50 Const a8 As Single = -7.54614 'tax income : p50 < X <= p75 Const a9 As Single = -6.69367 'tax income : p75 < X <= p90 Const a10 As Single = -5.25442 'tax income : p90 < X <= p95 Const a11 As Single = -1.34359 'Nationality: 1 if Swedish Dim v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 As Double Dim ex As Double v1 = i_sex(iidx) - 1 v2 = i_age(iidx) v3 = v2 * v2 / 100 If i_edlevel(iidx) = 0 Then v4 = 1 Else v4 = 0 If i_edlevel(iidx) = 1 Then v5 = 1 Else v5 = 0 If i_inc_taxable(iidx) <= q25 Then v6 = 1 Else v6 = 0 If i_inc_taxable(iidx) > q25 And i_inc_taxable(iidx) <= q50 Then v7 = 1 Else v7 = 0 If i_inc_taxable(iidx) > q50 And i_inc_taxable(iidx) <= q75 Then v8 = 1 Else v8 = 0 If i_inc_taxable(iidx) > q75 And i_inc_taxable(iidx) <= q90 Then v9 = 1 Else v9 = 0 If i_inc_taxable(iidx) > q90 And i_inc_taxable(iidx) <= q95 Then v10 = 1 Else v10 = 0 If i_born_abroad(iidx) = 1 Then v11 = 0 Else v11 = 1 ex = (a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + _ a7 * v7 + a8 * v8 + a9 * v9 + a10 * v10 + a11 * v11) ex = maxi(0, ex) Psavings_Mod2 = Int(ex * 1000) End Function
' Imputation of housing information: house area, real wealth of home,...
Public Sub ImputeHousingInfo() status "Impute housing info" Printdok "Impute housing info" Dim h As Long, counter As Long Dim temp() As Double, temp2() As Double, p50 As Double, p75 As Double, p90 As Double, p95 As Double Dim q25 As Double, q50 As Double, q75 As Double, q90 As Double, q95 As Double Dim perc As Variant Dim buy As Single, newstatus As Single ReDim temp(1 To m_hcount), temp2(1 To m_hcount) For h = 1 To m_hcount If h_abroad(h) = 0 Then counter = counter + 1 temp(counter) = h_wealth_financial(h) temp2(counter) = h_max_inc_taxable(h) End If Next ReDim Preserve temp(1 To counter), temp2(1 To counter) 'Percentiles for households financial wealth perc = arr_Percentile(temp, 50, 75, 90, 95) p50 = perc(1, 2) p75 = perc(2, 2) p90 = perc(3, 2) p95 = perc(4, 2) perc = arr_Percentile(temp2, 25, 50, 75, 90, 95) q25 = perc(1, 2) q50 = perc(2, 2) q75 = perc(3, 2) q90 = perc(4, 2) q95 = perc(5, 2) For h = 1 To m_hcount If h_abroad(h) = 0 Then If h_house_owner(h) = 1 Then newstatus = h_new_housing(h) ' Imputation of house area and real wealth from owned home ' NOTE: is h_house_cost to be imputed here too?? TP050511 Call Owncost(h, newstatus, q25, q50, q75, q90, q95, p50, p75, p90, p95) Else ' Imputation of house area and house costs (rent) Call Rentcost(h) End If End If Next End Sub
'************************** '************************** '*** REGIONAL MIGRATION *** '************************** '************************** ' ' GENERAL COMMENTS: ' - Regional migration is modeled in a two-step procedure. In the first step it is decided whether the ' household leaves the current region or not using a logit model. If the household leaves the ' destination region is determined using a multinomial (conditional) logit model (McFadden type). ' - Moving households are allocated to a municipality within the target region with probabilities ' equal to the relative population frequencies of the municipalities. ' - Households that do not leave the region can still move within the region. This is modeled ' using a logit model. All households that move changes housing. In a later model their choice of ' tenure is simulated. ' - All individual variables used in the mover/stayer model is derived from the head of each household. ' The oldest adult individual is chosen as the head of the household.
Public Sub Regional_Migration() status "Regional migration" Printdok "Regional migration" Dim count_income As Long, h As Long, i As Long, j As Long Dim temp_income1() As Double, temp_income2() As Double, temp_income3() As Double Dim median_diskpink As Double Dim Q_dispinc As Variant, Q_capinc As Variant, Q_diff_dispinc As Variant, temp As Variant Dim reg01_1 As Byte, reg01_2 As Byte, reg01_3 As Byte, reg01_4 As Byte, reg01_5 As Byte Dim reg01_6 As Byte, reg01_7 As Byte, reg01_8 As Byte Dim age02k5_1 As Byte, age02k5_2 As Byte, age02k5_3 As Byte, age02k5_4 As Byte Dim utbtdsim_0 As Byte, utbtdsim_1 As Byte Dim ten01a_1 As Byte, mov01hf_1 As Byte, alos01b_1 As Byte, sex_1 As Byte, sweborn_1 As Byte Dim nsdink01_1 As Byte, nsdink01_2 As Byte, nsdink01_3 As Byte, nsdink01_4 As Byte Dim idnr As Long Dim xbeta As Double, prob As Double Dim pop_bbreg(1 To 9) As Long, KTAX(1 To 9) As Double, HPKVM(1 To 9) As Double Dim pop_munic(1 To 289, 1 To 9) As Long, unemp(1 To 9) As Double Dim SumMrktVal(1 To 9) As Double, SumHouseArea(1 To 9) As Double, NSumMrktVal(1 To 9) As Double Dim IsMoving() As Byte Dim hhdif02_2 As Byte, hhdif02_3 As Byte, hhdif02_4 As Byte, hhdif02_5 As Byte Dim hhdif02_7 As Byte, hhdif02_8 As Byte Dim s5dink01_1 As Byte, s5dink01_2 As Byte, s5dink01_3 As Byte, s5dink01_4 As Byte, s5dink01_5 As Byte Dim age02k4_1 As Byte, age02k4_2 As Byte, age02k4_3 As Byte, age02k4_4 As Byte Dim educ_1 As Byte, educ_2 As Byte, educ_3 As Byte '*** 1) MOVER/STAYER MODEL (MOVING BETWEEN BABYBOOM REGIONS) ' Calculate quintiles of lagged disposable income, lagged capital income and difference in ' disposable income between last year and the year before that count_income = 0 ReDim temp_income1(1 To m_icount), temp_income2(1 To m_icount), temp_income3(1 To m_icount) For h = 1 To m_hcount If h_abroad(h) = 0 Then count_income = count_income + 1 temp_income1(count_income) = h_inc_disposable1(h) End If Next ReDim Preserve temp_income1(1 To count_income) ' Calculate quintiles and median of taxable income temp = arr_Percentile(temp_income1, 20, 40, 50, 60, 80) Q_dispinc = Array(Array(temp(1, 1), temp(1, 2)), Array(temp(2, 1), temp(2, 2)), _ Array(temp(4, 1), temp(4, 2)), Array(temp(5, 1), temp(5, 2))) median_diskpink = temp(3, 2) ' Vector IsMoving is used to mark moving households ReDim IsMoving(1 To m_hcount) '*** Loop across household population For h = 1 To m_hcount '*** Only households living in Sweden is simulated If h_abroad(h) = 0 Then ' Variables to calculate agerage market value per square metre If h_house_owner(h) = 1 Then SumHouseArea(h_BB_region(h)) = SumHouseArea(h_BB_region(h)) + h_house_area(h) SumMrktVal(h_BB_region(h)) = SumMrktVal(h_BB_region(h)) + h_wealth_real_home(h) NSumMrktVal(h_BB_region(h)) = NSumMrktVal(h_BB_region(h)) + 1 ' No of terms in summation End If ' Calculate regional population frequencies pop_bbreg(h_BB_region(h)) = pop_bbreg(h_BB_region(h)) + h_size(h) pop_munic(h_kommunindex(h), h_BB_region(h)) = pop_munic(h_kommunindex(h), h_BB_region(h)) + _ h_size(h) ' Average local tax within the region KTAX(h_BB_region(h)) = KTAX(h_BB_region(h)) + kommundata(h_kommunindex(h)).skatt02 * h_size(h) ' Dummy variables for regions If h_BB_region(h) = 1 Then reg01_1 = 1 Else reg01_1 = 0 If h_BB_region(h) = 2 Then reg01_2 = 1 Else reg01_2 = 0 If h_BB_region(h) = 3 Then reg01_3 = 1 Else reg01_3 = 0 If h_BB_region(h) = 4 Then reg01_4 = 1 Else reg01_4 = 0 If h_BB_region(h) = 5 Then reg01_5 = 1 Else reg01_5 = 0 If h_BB_region(h) = 6 Then reg01_6 = 1 Else reg01_6 = 0 If h_BB_region(h) = 7 Then reg01_7 = 1 Else reg01_7 = 0 If h_BB_region(h) = 8 Then reg01_8 = 1 Else reg01_8 = 0 ' Dummy variables for quintile of disposable income (lagged) nsdink01_1 = 0: nsdink01_2 = 0: nsdink01_3 = 0: nsdink01_4 = 0 Select Case (h_inc_disposable1(h)) Case Is < Q_dispinc(1)(2) nsdink01_1 = 1 Case Is < Q_dispinc(2)(2) nsdink01_2 = 1 Case Is < Q_dispinc(3)(2) nsdink01_3 = 1 Case Is < Q_dispinc(4)(2) nsdink01_4 = 1 Case Else End Select ' Dummy variable for sex (head of household) If i_sex(h_idx_headofhh(h)) = 1 Then sex_1 = 1 Else sex_1 = 0 ' Dummy variables for educational attainment (head of household) If i_edlevel(h_idx_headofhh(h)) = 0 Then utbtdsim_0 = 1 Else utbtdsim_0 = 0 If i_edlevel(h_idx_headofhh(h)) = 1 Then utbtdsim_1 = 1 Else utbtdsim_1 = 0 ' Version 2 of educational attainment (head of household) ' educ 1 'Eftergymn.' 2'Gymn.' '3 'Förgymn.'. If i_edlevel(h_idx_headofhh(h)) = 2 Then educ_1 = 1 Else educ_1 = 0 If i_edlevel(h_idx_headofhh(h)) = 1 Then educ_2 = 1 Else educ_2 = 0 ' Dummy variables for age (head of household) ' Age groups: 0-24, 25-39, 40-64, 65-79, 80+ age02k5_1 = 0: age02k5_2 = 0: age02k5_3 = 0: age02k5_4 = 0 Select Case i_age(h_idx_headofhh(h)) Case Is <= 24 age02k5_1 = 1 Case Is <= 39 age02k5_2 = 1 Case Is <= 64 age02k5_3 = 1 Case Is <= 79 age02k5_4 = 1 Case Else End Select ' Dummy variables for age (head of household) ' age02k4 1'0-24' 2'25-39' 3'40-64' 4'65--'. age02k4_1 = 0: age02k4_2 = 0: age02k4_3 = 0: age02k4_4 = 0 Select Case i_age(h_idx_headofhh(h)) Case Is <= 24 age02k4_1 = 1 Case Is <= 39 age02k4_2 = 1 Case Is <= 64 age02k4_3 = 1 Case Else age02k4_4 = 1 End Select ' Dummy variable for nationality (head of household) If i_born_abroad(h_idx_headofhh(h)) = 0 Then sweborn_1 = 1 Else sweborn_1 = 0 ' Dummy variable for home ownership If h_house_owner(h) = 1 Then ten01a_1 = 1 Else ten01a_1 = 0 ' Dummy variable indicating the household has moved (only for households that existed ' two years ago) ' NOTE: mov = 0 means that household HAS MOVED! If h_new_housing1(h) = 1 Then mov01hf_1 = 1 Else mov01hf_1 = 0 End If ' Dummy variable indicating that at least one person in the household is unemployed alos01b_1 = 0 idnr = h_first_indnr(h) Do While idnr <> 0 If i_status(indnr2index(idnr)) = 6 Then unemp(h_BB_region(h)) = unemp(h_BB_region(h)) + 1 alos01b_1 = 1 End If idnr = i_next_indnr(indnr2index(idnr)) Loop ' DEMOGRAPHIC EVENTS: the "order of determination" of various demographic events used when ' estimating the models is used also in SESIM. ' Last child moves out If h_childmoveout(h) = 1 And h_n_child(h) = 0 Then hhdif02_8 = 1 Else hhdif02_8 = 0 ' Separation If i_year_sep(h_idx_headofhh(h)) = base_year + model_time Then hhdif02_2 = 1 hhdif02_8 = 0 Else hhdif02_2 = 0 End If ' Partner dies If i_widowed(h_idx_headofhh(h)) = base_year + model_time Then hhdif02_3 = 1 hhdif02_8 = 0 hhdif02_2 = 0 Else hhdif02_3 = 0 End If ' Nestleave (applies to childrens household - not parents) If i_bvux(h_idx_headofhh(h)) = 1 And i_bvux1(h_idx_headofhh(h)) = 0 Then hhdif02_4 = 1 hhdif02_8 = 0 hhdif02_2 = 0 hhdif02_3 = 0 Else hhdif02_4 = 0 End If ' Move together If i_civ_stat(h_idx_headofhh(h)) = 1 And i_civ_stat1(h_idx_headofhh(h)) = 0 Then hhdif02_5 = 1 hhdif02_8 = 0 hhdif02_2 = 0 hhdif02_3 = 0 hhdif02_4 = 0 Else hhdif02_5 = 0 End If ' More children If h_n_child(h) > h_n_child1(h) Then hhdif02_7 = 1 hhdif02_8 = 0 hhdif02_2 = 0 hhdif02_3 = 0 hhdif02_4 = 0 hhdif02_5 = 0 Else hhdif02_7 = 0 End If '*** Determine type of household - different models for different household types If h_n_adults(h) = 2 Then If h_n_child(h) > 0 Then '*** Cohabiting with children Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -5.88160066644641 + age02k4_1 * 1.00774768562171 + age02k4_2 * 0.962755616861431 + age02k4_3 * 9.16891570417107E-02 + sweborn_1 * 0.865938189144422 + educ_1 * 0.180972504908724 + educ_2 * 3.64282448538011E-02 + hhdif02_5 * 1.12200902040684 + hhdif02_7 * 1.5511540233147 + alos01b_1 * 0.233458456960386 + mov01hf_1 * 1.41988476881372 + s5dink01_1 * 0.863297895245886 + s5dink01_2 * 0.556945745322283 + s5dink01_3 * 0.373749473093242 + s5dink01_4 * 0.413684442243587 + ten01a_1 * -0.331090376344465 Case (2) xbeta = 1 * -6.61016923198553 + age02k4_1 * 1.72253769592634 + age02k4_2 * 1.51062184184993 + age02k4_3 * 0.59975569312641 + sweborn_1 * 0.603931849950309 + educ_1 * 0.531138197216384 + educ_2 * 8.95864215261098E-03 + hhdif02_5 * 1.05542870961742 + hhdif02_7 * 1.5005134865923 + alos01b_1 * 0.281893684292672 + mov01hf_1 * 1.85652233255162 + s5dink01_1 * 0.985581749933024 + s5dink01_2 * 0.817178940614477 + s5dink01_3 * 0.472345149358799 + s5dink01_4 * 0.573174546331386 + ten01a_1 * -0.853496716380943 Case (3) xbeta = 1 * -6.41023136170965 + age02k4_1 * 1.55515713200337 + age02k4_2 * 1.57923759221221 + age02k4_3 * 0.782332794891814 + sweborn_1 * 0.681042218141028 + educ_1 * 0.423015818569253 + educ_2 * 6.02857833862373E-02 + hhdif02_5 * 1.13887325323179 + hhdif02_7 * 1.52926001695948 + alos01b_1 * 0.370130470459207 + mov01hf_1 * 1.46447074106599 + s5dink01_1 * 0.818058133975094 + s5dink01_2 * 0.56553561117246 + s5dink01_3 * 0.25952932801313 + s5dink01_4 * 0.361304926681004 + ten01a_1 * -0.636138631267581 Case (4) xbeta = 1 * -5.48441008723598 + age02k4_1 * 0.884302407713155 + age02k4_2 * 0.810410476909122 + age02k4_3 * 0.193541811687601 + sweborn_1 * -0.127943860091377 + educ_1 * 0.603426625359724 + educ_2 * -6.06850784397589E-03 + hhdif02_5 * 1.23396457867024 + hhdif02_7 * 1.69245973142757 + alos01b_1 * 0.276738028139894 + mov01hf_1 * 1.68433758450708 + s5dink01_1 * 1.10915639466828 + s5dink01_2 * 0.837923005321299 + s5dink01_3 * 0.686571127464593 + s5dink01_4 * 0.270815396932671 + ten01a_1 * -0.813447983629977 Case (5) xbeta = 1 * -5.43411288454348 + age02k4_1 * 1.8750371901699 + age02k4_2 * 1.31048691373687 + age02k4_3 * 0.6644239027201 + sweborn_1 * -0.269673681439486 + educ_1 * 0.519926105136211 + educ_2 * -0.084315703381201 + hhdif02_5 * 0.9630519017966 + hhdif02_7 * 1.25757857419548 + alos01b_1 * 0.271946796410605 + mov01hf_1 * 1.46996406897164 + s5dink01_1 * 0.590745811156864 + s5dink01_2 * 0.581840172059229 + s5dink01_3 * 0.802871420596704 + s5dink01_4 * 0.25885445205292 + ten01a_1 * -0.647041416852824 Case (6) xbeta = 1 * -4.58411763140985 + age02k4_1 * 1.5408528877776 + age02k4_2 * 1.18244302943076 + age02k4_3 * 0.477963279804258 + sweborn_1 * -0.606985936878542 + educ_1 * 0.523549587949409 + educ_2 * -0.060832212159347 + hhdif02_5 * 0.912321657912013 + hhdif02_7 * 1.10097876633262 + alos01b_1 * 0.31203647097524 + mov01hf_1 * 1.26181239015097 + s5dink01_1 * 0.793572763240273 + s5dink01_2 * 0.99283471116368 + s5dink01_3 * 0.710408330373546 + s5dink01_4 * 0.108616483252598 + ten01a_1 * -1.06135172052177 Case (7) xbeta = 1 * -4.94224840419998 + age02k4_1 * 1.28430771450424 + age02k4_2 * 0.797221344616659 + age02k4_3 * 0.415495371510162 + sweborn_1 * -0.707177662625923 + educ_1 * 0.749111604337626 + educ_2 * 3.02394426222239E-02 + hhdif02_5 * 1.20961248159522 + hhdif02_7 * 1.21181573431657 + alos01b_1 * 0.448239604381308 + mov01hf_1 * 1.52493020004588 + s5dink01_1 * 1.13962694611957 + s5dink01_2 * 1.17348089025721 + s5dink01_3 * 0.845283323753798 + s5dink01_4 * 0.215543207428879 + ten01a_1 * -0.728586542846102 Case (8) xbeta = 1 * -5.3646916438647 + age02k4_1 * 2.11785384596569 + age02k4_2 * 1.69244999678963 + age02k4_3 * 1.12835851714131 + sweborn_1 * -0.749837303196174 + educ_1 * 0.76597655080511 + educ_2 * -2.57426587851043E-02 + hhdif02_5 * 1.11061271220643 + hhdif02_7 * 1.35957411413186 + alos01b_1 * 0.430015333008085 + mov01hf_1 * 1.4906531611354 + s5dink01_1 * 1.12327793964828 + s5dink01_2 * 0.76357941621541 + s5dink01_3 * 0.431824888694309 + s5dink01_4 * 6.10894169146732E-02 + ten01a_1 * -0.683617723431315 Case Else xbeta = 1 * -4.39717252224396 + age02k4_1 * 1.55473576523358 + age02k4_2 * 1.20752690664547 + age02k4_3 * 0.683844432657629 + sweborn_1 * -1.28804865339011 + educ_1 * 0.817620221651163 + educ_2 * 0.209523070174836 + hhdif02_5 * 0.967081252462975 + hhdif02_7 * 1.58869199971362 + alos01b_1 * 0.251658600736681 + mov01hf_1 * 1.4637445492617 + s5dink01_1 * 0.439848375818787 + s5dink01_2 * 0.295272086492119 + s5dink01_3 * 0.253412107987014 + s5dink01_4 * 0.107721013668696 + ten01a_1 * -1.1586799565558 End Select Else '*** Cohabiting without children Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -5.39190997834017 + age02k4_1 * 1.41706654768151 + age02k4_2 * 0.740212820004238 + age02k4_3 * 0.39773448398662 + sweborn_1 * 0.397521391714696 + educ_1 * 0.120389361596651 + educ_2 * 0.177505456374104 + hhdif02_5 * 1.09850832484152 + hhdif02_8 * 0.768540742319536 + alos01b_1 * 0.448784733274229 + mov01hf_1 * 1.38410398409479 + s5dink01_1 * 0.282244756070444 + s5dink01_2 * 0.119010338774015 + s5dink01_3 * -9.33069572414151E-03 + s5dink01_4 * 0.159827467272793 + ten01a_1 * -6.74377929219617E-02 Case (2) xbeta = 1 * -5.56880370277098 + age02k4_1 * 1.87073862068035 + age02k4_2 * 1.24394573082121 + age02k4_3 * 0.498414588840914 + sweborn_1 * 0.229741044978325 + educ_1 * 0.461081677472153 + educ_2 * 0.21123674135837 + hhdif02_5 * 1.04160351187892 + hhdif02_8 * 0.727217630749412 + alos01b_1 * 0.583172663815664 + mov01hf_1 * 1.04476593450779 + s5dink01_1 * 0.046942261178718 + s5dink01_2 * 3.96051036470034E-02 + s5dink01_3 * -6.65497013175436E-02 + s5dink01_4 * -7.04648457729702E-03 + ten01a_1 * -0.419028917737612 Case (3) xbeta = 1 * -6.11744594319782 + age02k4_1 * 1.85159087696108 + age02k4_2 * 1.43916861920088 + age02k4_3 * 0.722725331032205 + sweborn_1 * 0.466363836341378 + educ_1 * 0.751853280170132 + educ_2 * 0.492252824223608 + hhdif02_5 * 0.796864257401887 + hhdif02_8 * 0.759597727862362 + alos01b_1 * 0.364690741243645 + mov01hf_1 * 1.23681948866124 + s5dink01_1 * -0.244217799238279 + s5dink01_2 * 0.479423800248059 + s5dink01_3 * 0.478004647761299 + s5dink01_4 * 0.170395440410878 + ten01a_1 * -0.426191060403576 Case (4) xbeta = 1 * -5.58095410129852 + age02k4_1 * 1.85981499833256 + age02k4_2 * 1.32414688290503 + age02k4_3 * 0.323172543386621 + sweborn_1 * -8.80517090623895E-02 + educ_1 * 0.961192701148744 + educ_2 * 0.342148922339458 + hhdif02_5 * 0.892831639505437 + hhdif02_8 * 0.928339666221161 + alos01b_1 * 0.478559969211256 + mov01hf_1 * 1.3056307956138 + s5dink01_1 * 0.721465859071284 + s5dink01_2 * 0.335898228813359 + s5dink01_3 * 0.150330494357077 + s5dink01_4 * -6.85410732835709E-02 + ten01a_1 * -0.513537053880118 Case (5) xbeta = 1 * -4.96808246865517 + age02k4_1 * 1.96183307832527 + age02k4_2 * 1.4432435458842 + age02k4_3 * 0.400680019818099 + sweborn_1 * -8.36643134887153E-02 + educ_1 * 0.562321781511852 + educ_2 * 9.46601869251091E-02 + hhdif02_5 * 1.26925876435809 + hhdif02_8 * 0.751133567961367 + alos01b_1 * 0.43316909267261 + mov01hf_1 * 1.27033538837602 + s5dink01_1 * 0.045317019916818 + s5dink01_2 * 4.90899641818552E-02 + s5dink01_3 * -0.281062071840971 + s5dink01_4 * -0.225547695547247 + ten01a_1 * -0.431086701391079 Case (6) xbeta = 1 * -4.33984186735958 + age02k4_1 * 2.4107846854507 + age02k4_2 * 1.62237951619424 + age02k4_3 * 0.585704606694971 + sweborn_1 * -0.596386269402486 + educ_1 * 0.949484024677923 + educ_2 * 0.453839574876015 + hhdif02_5 * 0.656749969415055 + hhdif02_8 * 0.288611360477544 + alos01b_1 * 0.363822818957247 + mov01hf_1 * 1.00482607420666 + s5dink01_1 * 0.141305136014173 + s5dink01_2 * 0.340913600298017 + s5dink01_3 * -0.046605817620954 + s5dink01_4 * -4.66690573649665E-02 + ten01a_1 * -1.00814464359364 Case (7) xbeta = 1 * -4.71079838047804 + age02k4_1 * 2.20617982800848 + age02k4_2 * 1.00502997174775 + age02k4_3 * -2.10158188597536E-02 + sweborn_1 * -0.440385934149311 + educ_1 * 1.11641183117769 + educ_2 * 0.454547604114787 + hhdif02_5 * 1.13428065819902 + hhdif02_8 * 0.293768745853006 + alos01b_1 * 0.67882407333418 + mov01hf_1 * 1.2740422277512 + s5dink01_1 * 0.282374681759099 + s5dink01_2 * -0.213425357659898 + s5dink01_3 * -0.243710802009761 + s5dink01_4 * -0.4447835000033 + ten01a_1 * -0.453129571556301 Case (8) xbeta = 1 * -4.56502949571789 + age02k4_1 * 2.92968274745612 + age02k4_2 * 1.29264275881763 + age02k4_3 * 8.51661025954106E-02 + sweborn_1 * -0.417775749966644 + educ_1 * 0.918098921306723 + educ_2 * 0.356893773912692 + hhdif02_5 * 1.15163633275531 + hhdif02_8 * 0.829610356461285 + alos01b_1 * 0.369457773669201 + mov01hf_1 * 1.40612276158303 + s5dink01_1 * 0.162576981755847 + s5dink01_2 * 4.51160819422212E-02 + s5dink01_3 * -0.166030337461489 + s5dink01_4 * -6.32107706912224E-02 + ten01a_1 * -0.667112138060954 Case Else xbeta = 1 * -4.70720566918309 + age02k4_1 * 2.72520841934254 + age02k4_2 * 1.50029795393879 + age02k4_3 * -0.10275675443107 + sweborn_1 * -0.849812483597214 + educ_1 * 1.32174298685487 + educ_2 * 0.568350657513221 + hhdif02_5 * 0.527207854651387 + hhdif02_8 * 0.813457399058036 + alos01b_1 * 0.369790289872152 + mov01hf_1 * 1.69244935371163 + s5dink01_1 * 0.619245048000102 + s5dink01_2 * 0.361708650094995 + s5dink01_3 * 8.22660208779612E-02 + s5dink01_4 * -6.58563201994526E-02 + ten01a_1 * -0.746432277930379 End Select End If '*** Single households Else If h_n_child(h) > 0 Then '*** Single with children Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -6.58822557594706 + age02k4_1 * 1.37309026046502 + age02k4_2 * 0.925149294368411 + age02k4_3 * 0.294514151189973 + sweborn_1 * 0.828379255276185 + educ_1 * -0.144449018155534 + educ_2 * 3.16113566622589E-02 + hhdif02_2 * 1.02684928400683 + hhdif02_3 * 0.703832176754352 + hhdif02_7 * 1.33883631866737 + alos01b_1 * 0.166745754631988 + mov01hf_1 * 2.30122173696649 + s5dink01_1 * 1.28659628481009 + s5dink01_2 * 1.1593281712293 + s5dink01_3 * 0.75040336858707 + s5dink01_4 * 0.508208799596489 + ten01a_1 * 8.48699548276188E-02 + sex_1 * -0.290657451537743 Case (2) xbeta = 1 * -5.47411937088695 + age02k4_1 * 1.56453244183287 + age02k4_2 * 1.17993714370706 + age02k4_3 * 0.345159986735662 + sweborn_1 * 0.3157151839228 + educ_1 * 0.1394535967488 + educ_2 * -3.03391523534262E-02 + hhdif02_2 * 0.937891073701945 + hhdif02_3 * -0.361947296054848 + hhdif02_7 * 1.22186087119539 + alos01b_1 * 0.156115104764368 + mov01hf_1 * 1.9579281452375 + s5dink01_1 * 0.606058881843637 + s5dink01_2 * 0.310451945624966 + s5dink01_3 * -0.041600078391611 + s5dink01_4 * -0.224342014689562 + ten01a_1 * -0.300913606743589 + sex_1 * -0.177611099281998 Case (3) xbeta = 1 * -5.27037940550211 + age02k4_1 * 0.954214392631662 + age02k4_2 * 0.664376608884891 + age02k4_3 * 1.58742038444208E-02 + sweborn_1 * 0.32646035505388 + educ_1 * 6.15533377905072E-02 + educ_2 * -0.117386173747581 + hhdif02_2 * 0.933400434548015 + hhdif02_3 * -0.242268597370086 + hhdif02_7 * 1.22388068906111 + alos01b_1 * 0.148563328607327 + mov01hf_1 * 1.92657640591945 + s5dink01_1 * 0.864116476743337 + s5dink01_2 * 0.578989034429748 + s5dink01_3 * 0.426210384608523 + s5dink01_4 * 0.479015576112616 + ten01a_1 * -0.365050884362171 + sex_1 * -9.13605744338459E-02 Case (4) xbeta = 1 * -5.29310032473729 + age02k4_1 * 2.04708016707454 + age02k4_2 * 1.3824184552732 + age02k4_3 * 0.925481572135289 + sweborn_1 * -0.113016020235386 + educ_1 * 0.260513564117244 + educ_2 * 2.35377036298803E-02 + hhdif02_2 * 0.840936272088075 + hhdif02_3 * -1.40929061729474 + hhdif02_7 * 1.06267197956543 + alos01b_1 * 0.239845296912746 + mov01hf_1 * 2.02057264953768 + s5dink01_1 * 0.228976241605968 + s5dink01_2 * -8.97774096769077E-03 + s5dink01_3 * -0.268712650142317 + s5dink01_4 * -0.24513768968673 + ten01a_1 * -0.214857077414587 + sex_1 * -0.185205332533527 Case (5) xbeta = 1 * -6.25127611657569 + age02k4_1 * 3.075599946898 + age02k4_2 * 2.69984426846147 + age02k4_3 * 2.26198799450133 + sweborn_1 * -0.159287596168557 + educ_1 * 3.99230793379465E-02 + educ_2 * -0.202807374735332 + hhdif02_2 * 0.910429313788521 + hhdif02_3 * 3.47488099649725E-02 + hhdif02_7 * 0.937226111545379 + alos01b_1 * 0.165801531580235 + mov01hf_1 * 1.89934142239055 + s5dink01_1 * 0.296360959470215 + s5dink01_2 * -1.58205659737789E-02 + s5dink01_3 * -0.178953990727427 + s5dink01_4 * -0.231956287046514 + ten01a_1 * -0.207691687246835 + sex_1 * -0.436051748107883 Case (6) xbeta = 1 * -4.67588490212775 + age02k4_1 * 1.72675659273887 + age02k4_2 * 1.24933387880313 + age02k4_3 * 0.830057575504293 + sweborn_1 * -0.708776766598644 + educ_1 * 0.267408866294824 + educ_2 * 0.151371556147151 + hhdif02_2 * 0.374636186967866 + hhdif02_3 * 0.110040169659749 + hhdif02_7 * 0.880189913858409 + alos01b_1 * 0.250814551666965 + mov01hf_1 * 1.69354207413514 + s5dink01_1 * 0.856017534111519 + s5dink01_2 * 0.147310805774462 + s5dink01_3 * -2.86726699321745E-02 + s5dink01_4 * 0.1713156376253 + ten01a_1 * -0.316357941266059 + sex_1 * -4.91358762374897E-02 Case (7) xbeta = 1 * -4.86538373132391 + age02k4_1 * 2.34748185755986 + age02k4_2 * 1.78563264023144 + age02k4_3 * 1.27030048508508 + sweborn_1 * -0.422529483585948 + educ_1 * 0.334678840626777 + educ_2 * -1.36736359501668E-02 + hhdif02_2 * 0.744777116511094 + hhdif02_3 * -0.726056887688851 + hhdif02_7 * 1.16934108889592 + alos01b_1 * 0.351174050030063 + mov01hf_1 * 1.78286119124789 + s5dink01_1 * 0.118542082292344 + s5dink01_2 * -0.144334526463603 + s5dink01_3 * -0.282720793934976 + s5dink01_4 * -0.333587801161595 + ten01a_1 * -0.153506629194933 + sex_1 * -0.379960330677001 Case (8) xbeta = 1 * -4.65691327563564 + age02k4_1 * 2.19854990999064 + age02k4_2 * 1.44864898796112 + age02k4_3 * 1.33038161282918 + sweborn_1 * -0.524941680286784 + educ_1 * 0.522129242649296 + educ_2 * -1.30753222880593E-02 + hhdif02_2 * 0.655508414063446 + hhdif02_3 * -0.386973887654046 + hhdif02_7 * 0.759091394871176 + alos01b_1 * 0.250921269295191 + mov01hf_1 * 1.72824771919616 + s5dink01_1 * 0.576186253327412 + s5dink01_2 * 8.81763109071926E-02 + s5dink01_3 * -0.16227973933657 + s5dink01_4 * -0.117418695136513 + ten01a_1 * -0.405522458793326 + sex_1 * -0.462103553081298 Case Else xbeta = 1 * -4.49587214528809 + age02k4_1 * 1.8697076865903 + age02k4_2 * 1.28787983512601 + age02k4_3 * 0.944279457539424 + sweborn_1 * -0.79355044672053 + educ_1 * 0.285983119399105 + educ_2 * 4.25330857463078E-03 + hhdif02_2 * 0.764534143635752 + hhdif02_3 * 0.40607999922104 + hhdif02_7 * 0.774869436905088 + alos01b_1 * 0.136722909233198 + mov01hf_1 * 2.01221318404322 + s5dink01_1 * 0.404216715641112 + s5dink01_2 * 0.244001192102089 + s5dink01_3 * -0.179187332594309 + s5dink01_4 * -8.67945229734228E-02 + ten01a_1 * -0.384949252717185 + sex_1 * -0.387893774477525 End Select Else '*** Single without children Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -5.72663689966261 + age02k4_1 * 1.67803548006928 + age02k4_2 * 1.15540017485972 + age02k4_3 * 0.595546654367734 + sweborn_1 * 0.422981721917049 + educ_1 * 9.44898763617935E-02 + educ_2 * 0.141078003956514 + hhdif02_2 * 1.76581233707626 + hhdif02_3 * 0.203244367715417 + hhdif02_4 * 1.65429801589033 + hhdif02_8 * 1.24218688066345 + alos01b_1 * 0.278896591911478 + mov01hf_1 * 1.26536921217511 + s5dink01_1 * 0.485110440552398 + s5dink01_2 * 0.255044219969707 + s5dink01_3 * 0.116102255370394 + s5dink01_4 * 6.29375343041507E-04 + ten01a_1 * 0.129740467873409 + sex_1 * -2.81874044903923E-02 Case (2) xbeta = 1 * -4.95646936463372 + age02k4_1 * 1.99407237825452 + age02k4_2 * 1.73241671126713 + age02k4_3 * 0.914069021395268 + sweborn_1 * 0.134656393726232 + educ_1 * 0.315445006031745 + educ_2 * 0.200531929873775 + hhdif02_2 * 1.39754632948306 + hhdif02_3 * 0.14602059759432 + hhdif02_4 * 1.76492769796359 + hhdif02_8 * 0.95862247380871 + alos01b_1 * 0.210083378665168 + mov01hf_1 * 1.04374669575898 + s5dink01_1 * -0.168521621166969 + s5dink01_2 * -0.436078656680446 + s5dink01_3 * -0.599669239723382 + s5dink01_4 * -0.517794526223985 + ten01a_1 * -9.23103152861767E-02 + sex_1 * -0.144446916482823 Case (3) xbeta = 1 * -4.81551160823257 + age02k4_1 * 1.80363978528496 + age02k4_2 * 1.83213502959583 + age02k4_3 * 0.874759608588485 + sweborn_1 * 0.21610548974067 + educ_1 * 0.351692965768808 + educ_2 * 9.81561035863354E-02 + hhdif02_2 * 1.28208870108576 + hhdif02_3 * 6.58525350479034E-02 + hhdif02_4 * 1.66209183389207 + hhdif02_8 * 1.13807589070793 + alos01b_1 * 0.15383788771947 + mov01hf_1 * 0.956040781061599 + s5dink01_1 * -0.207351383858839 + s5dink01_2 * -0.410596445585016 + s5dink01_3 * -0.486773378775451 + s5dink01_4 * -0.521512186195878 + ten01a_1 * -0.165813492803423 + sex_1 * -0.134244424200124 Case (4) xbeta = 1 * -5.1335989020794 + age02k4_1 * 2.17966839804826 + age02k4_2 * 2.02802250360045 + age02k4_3 * 1.04794939282794 + sweborn_1 * -0.114658064948635 + educ_1 * 0.914709119891287 + educ_2 * 0.294450195339752 + hhdif02_2 * 1.39450832440986 + hhdif02_3 * 0.300783422576842 + hhdif02_4 * 2.01410543795859 + hhdif02_8 * 0.881484723288532 + alos01b_1 * 0.12878095151142 + mov01hf_1 * 1.10358273576622 + s5dink01_1 * 2.22529200495775E-02 + s5dink01_2 * -0.306801689173692 + s5dink01_3 * -0.524079960383564 + s5dink01_4 * -0.291423924582932 + ten01a_1 * -0.147579589126493 + sex_1 * -0.136688010489375 Case (5) xbeta = 1 * -4.88162649961041 + age02k4_1 * 2.10096669141539 + age02k4_2 * 1.9606520602656 + age02k4_3 * 0.974295388095939 + sweborn_1 * -0.111352651417993 + educ_1 * 0.70283658773542 + educ_2 * 0.2357249002231 + hhdif02_2 * 1.43995042639267 + hhdif02_3 * 0.211415029591487 + hhdif02_4 * 1.91422090933162 + hhdif02_8 * 0.815886438030277 + alos01b_1 * 0.110120359758405 + mov01hf_1 * 0.987671594540927 + s5dink01_1 * 0.097282543715733 + s5dink01_2 * -0.158092044287615 + s5dink01_3 * -0.246106103213361 + s5dink01_4 * -0.139300046099828 + ten01a_1 * -0.198660132078569 + sex_1 * -0.191564290076703 Case (6) xbeta = 1 * -4.51695508794159 + age02k4_1 * 2.18160749676045 + age02k4_2 * 2.10558625682961 + age02k4_3 * 1.02499434090145 + sweborn_1 * -0.322901999057687 + educ_1 * 0.867450448270105 + educ_2 * 0.240291730643711 + hhdif02_2 * 1.34728971134327 + hhdif02_3 * 0.563396590067501 + hhdif02_4 * 1.76315869908613 + hhdif02_8 * 1.02109030316747 + alos01b_1 * 0.196465760802355 + mov01hf_1 * 0.780386524755953 + s5dink01_1 * -3.52846988612525E-02 + s5dink01_2 * -0.304577730949314 + s5dink01_3 * -0.489277080502854 + s5dink01_4 * -0.442518164629104 + ten01a_1 * -0.374477546512312 + sex_1 * -0.221634928535336 Case (7) xbeta = 1 * -4.56519132771564 + age02k4_1 * 2.67086240416427 + age02k4_2 * 2.1224857966143 + age02k4_3 * 1.09265783568615 + sweborn_1 * -0.520814388939192 + educ_1 * 1.07668926948182 + educ_2 * 0.488004494829287 + hhdif02_2 * 1.64870154993347 + hhdif02_3 * 0.487418454904394 + hhdif02_4 * 2.25882738788884 + hhdif02_8 * 1.07145799454866 + alos01b_1 * 0.114973868010438 + mov01hf_1 * 1.14658711618677 + s5dink01_1 * -0.109870650304094 + s5dink01_2 * -0.589626214385536 + s5dink01_3 * -0.743114292133267 + s5dink01_4 * -0.413332373834382 + ten01a_1 * -3.24633852244879E-02 + sex_1 * -0.124109560285778 Case (8) xbeta = 1 * -4.51979067185614 + age02k4_1 * 2.53209871742259 + age02k4_2 * 1.94890820676476 + age02k4_3 * 0.916660237835334 + sweborn_1 * -0.380821396177048 + educ_1 * 1.06572564298741 + educ_2 * 0.35851544165183 + hhdif02_2 * 1.6110748144185 + hhdif02_3 * 0.667962535251348 + hhdif02_4 * 2.09578677570685 + hhdif02_8 * 0.884090505314277 + alos01b_1 * 0.10248766934677 + mov01hf_1 * 1.31771268699972 + s5dink01_1 * -0.05609013580467 + s5dink01_2 * -0.355282749426188 + s5dink01_3 * -0.501953822819957 + s5dink01_4 * -0.168662914911167 + ten01a_1 * -0.145700884727253 + sex_1 * -0.194957160162842 Case Else xbeta = 1 * -4.26699412028526 + age02k4_1 * 2.76174926316867 + age02k4_2 * 2.15477791438012 + age02k4_3 * 0.894259212973816 + sweborn_1 * -0.806717467031177 + educ_1 * 1.15912643135821 + educ_2 * 0.515365832987253 + hhdif02_2 * 1.41780833819642 + hhdif02_3 * 0.294316025591371 + hhdif02_4 * 2.17748443325319 + hhdif02_8 * 1.09395943745308 + alos01b_1 * 9.20058807887815E-02 + mov01hf_1 * 1.20939122898616 + s5dink01_1 * -0.268779179320368 + s5dink01_2 * -0.681768892618235 + s5dink01_3 * -0.808505998413493 + s5dink01_4 * -0.47094678146065 + ten01a_1 * -0.165449022250049 + sex_1 * -0.206300107948844 End Select End If End If ' If h_n_adults(h) = 2 Then prob = 1 / (1 + Exp(-xbeta)) If Rnd < prob Then ' Household is marked for simulation of destination region below IsMoving(h) = 1 '*** Houshold is marked for tenure choice h_new_housing(h) = 1 Else '*** Houshold does not leave the region IsMoving(h) = 0 '*** MOVER/STAYER MODEL 2: MOVING WITHIN THE REGION *** '*** Determine type of household - different models for different household types If h_n_adults(h) = 2 Then If h_n_child(h) > 0 Then '*** Cohabiting with children *** Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -3.47103602000487 + age02k4_1 * 2.41306415606971 + age02k4_2 * 1.57047334167036 + age02k4_3 * 0.668326173303106 + hhdif02_5 * 1.63483470512627 + hhdif02_7 * 1.19130687253963 + nsdink01_1 * 0.137702342292834 + nsdink01_2 * 0.188166801709643 + nsdink01_3 * 8.32341610421381E-02 + nsdink01_4 * 4.91963425488039E-02 + ten01a_1 * -0.604312585100501 + educ_1 * 0.20813822663485 + educ_2 * 6.08356484270866E-02 Case (2) xbeta = 1 * -3.03505752537588 + age02k4_1 * 2.17250293975715 + age02k4_2 * 1.37259716418883 + age02k4_3 * 0.680430721040657 + hhdif02_5 * 1.32342735019253 + hhdif02_7 * 1.15407073033082 + nsdink01_1 * 0.312012470764555 + nsdink01_2 * 0.199881806560695 + nsdink01_3 * 0.147131985056161 + nsdink01_4 * 8.88537980500247E-02 + ten01a_1 * -1.23031127103814 + educ_1 * 4.40694245657843E-02 + educ_2 * -3.37053390097243E-03 Case (3) xbeta = 1 * -3.33332882628599 + age02k4_1 * 2.57098085397912 + age02k4_2 * 1.34812881995317 + age02k4_3 * 0.52273823650141 + hhdif02_5 * 1.69618224796758 + hhdif02_7 * 1.15012564393823 + nsdink01_1 * 0.127777921675485 + nsdink01_2 * 0.334415392836683 + nsdink01_3 * 0.151549757006983 + nsdink01_4 * 0.039229258688836 + ten01a_1 * -0.825674417655102 + educ_1 * 0.220063335974014 + educ_2 * 0.123115496660297 Case (4) xbeta = 1 * -2.87393431578494 + age02k4_1 * 2.68955096132062 + age02k4_2 * 1.51023272464202 + age02k4_3 * 0.758877730297759 + hhdif02_5 * 1.45836857081141 + hhdif02_7 * 1.0782036400209 + nsdink01_1 * 0.146081192169264 + nsdink01_2 * -1.14367516447268E-02 + nsdink01_3 * -0.107011979618079 + nsdink01_4 * -0.100746223385391 + ten01a_1 * -1.55405713202972 + educ_1 * 0.154395573848845 + educ_2 * 2.93538165843067E-02 Case (5) xbeta = 1 * -3.02531527356547 + age02k4_1 * 2.77605385056082 + age02k4_2 * 1.53874495495939 + age02k4_3 * 0.645299641549505 + hhdif02_5 * 1.54587344286881 + hhdif02_7 * 0.904028830685909 + nsdink01_1 * 0.272549551041863 + nsdink01_2 * 2.65512791777457E-02 + nsdink01_3 * -1.33712508684698E-02 + nsdink01_4 * -5.13381336053186E-02 + ten01a_1 * -1.31767786958846 + educ_1 * 0.146995755385873 + educ_2 * 3.80120567595786E-02 Case (6) xbeta = 1 * -3.21094440819747 + age02k4_1 * 3.06176436632474 + age02k4_2 * 1.85247796992165 + age02k4_3 * 0.884439652358376 + hhdif02_5 * 1.40924876661449 + hhdif02_7 * 1.23512219947423 + nsdink01_1 * 0.280697523369306 + nsdink01_2 * 0.21689086535407 + nsdink01_3 * -0.145616966729814 + nsdink01_4 * -1.96595134830993E-02 + ten01a_1 * -1.62840829215142 + educ_1 * 0.232173786971167 + educ_2 * 9.35161284044424E-02 Case (7) xbeta = 1 * -2.1942124072041 + age02k4_1 * 2.50444613209857 + age02k4_2 * 1.10973064015544 + age02k4_3 * 0.426458442983645 + hhdif02_5 * 1.30670830618536 + hhdif02_7 * 1.01060648164126 + nsdink01_1 * 5.70780380291303E-02 + nsdink01_2 * -2.03463691481203E-02 + nsdink01_3 * -8.69854574199501E-02 + nsdink01_4 * -2.21563188429719E-02 + ten01a_1 * -1.71680333214829 + educ_1 * 7.13174577025501E-02 + educ_2 * 5.61718236112538E-02 Case (8) xbeta = 1 * -2.96856400060462 + age02k4_1 * 2.48238927164076 + age02k4_2 * 1.30538202739957 + age02k4_3 * 0.549280123202109 + hhdif02_5 * 1.46755757729919 + hhdif02_7 * 1.0715736393783 + nsdink01_1 * 0.483762034892854 + nsdink01_2 * 0.258094388919089 + nsdink01_3 * 0.14839792067794 + nsdink01_4 * 0.159019693723562 + ten01a_1 * -1.66594269529807 + educ_1 * 0.268090099130622 + educ_2 * 0.258591993822839 Case Else xbeta = 1 * -2.59235069645548 + age02k4_1 * 2.61957290888085 + age02k4_2 * 1.31480844758116 + age02k4_3 * 0.506756933007912 + hhdif02_5 * 1.48667870846864 + hhdif02_7 * 1.47806879800095 + nsdink01_1 * 0.418995187470556 + nsdink01_2 * 0.132035820042184 + nsdink01_3 * -8.98084052667918E-02 + nsdink01_4 * -0.137450175154566 + ten01a_1 * -1.88778318951191 + educ_1 * 0.233970333665183 + educ_2 * 8.62019633347212E-02 End Select Else '*** Cohabiting without children *** Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -3.18610102758582 + age02k4_1 * 2.3010767962707 + age02k4_2 * 1.54843241139712 + age02k4_3 * 0.31085942136394 + hhdif02_5 * 0.978726344535214 + hhdif02_8 * 0.592753952196006 + nsdink01_1 * 9.26484697044024E-02 + nsdink01_2 * -7.29101454780361E-02 + nsdink01_3 * 2.84304072725773E-02 + nsdink01_4 * -0.11309180328434 + ten01a_1 * -0.379157030402444 + educ_1 * 0.107643945438329 + educ_2 * 0.013869089574712 Case (2) xbeta = 1 * -3.10685183161756 + age02k4_1 * 2.49597461437489 + age02k4_2 * 1.60383716781461 + age02k4_3 * 0.402163099974546 + hhdif02_5 * 0.777896362863187 + hhdif02_8 * 0.705609885029765 + nsdink01_1 * 0.135472752331616 + nsdink01_2 * -0.152733950120518 + nsdink01_3 * -0.172813641944413 + nsdink01_4 * -0.20763320222162 + ten01a_1 * -0.600288280979838 + educ_1 * -0.111253988548755 + educ_2 * -2.17653835752358E-02 Case (3) xbeta = 1 * -2.96465967952855 + age02k4_1 * 2.36820578544205 + age02k4_2 * 1.53669474953528 + age02k4_3 * 0.142220102173018 + hhdif02_5 * 1.03981354629006 + hhdif02_8 * 0.585250540730077 + nsdink01_1 * -7.00972869112005E-02 + nsdink01_2 * -0.230441630724643 + nsdink01_3 * -0.167670025269088 + nsdink01_4 * -0.146058930045163 + ten01a_1 * -0.53888081890879 + educ_1 * -0.187464435768445 + educ_2 * -0.160258221363935 Case (4) xbeta = 1 * -2.75431395180135 + age02k4_1 * 2.43051899857945 + age02k4_2 * 1.46279756955382 + age02k4_3 * 0.169248221982738 + hhdif02_5 * 1.07240977287832 + hhdif02_8 * 0.473220966405738 + nsdink01_1 * 7.39172937613092E-02 + nsdink01_2 * -0.108625111825969 + nsdink01_3 * -0.193326442234068 + nsdink01_4 * -0.224472470144011 + ten01a_1 * -0.827428540753723 + educ_1 * 5.05849118120687E-02 + educ_2 * 1.22702577884979E-02 Case (5) xbeta = 1 * -2.96819963333179 + age02k4_1 * 2.67622194331586 + age02k4_2 * 1.54403143776802 + age02k4_3 * 0.130562253753709 + hhdif02_5 * 1.253235359562 + hhdif02_8 * 0.664593041578669 + nsdink01_1 * 0.059737399277278 + nsdink01_2 * -5.61556466856134E-02 + nsdink01_3 * -0.129480548543161 + nsdink01_4 * -0.176059308920792 + ten01a_1 * -0.724700771446522 + educ_1 * -7.52075846018456E-02 + educ_2 * -3.94572189715121E-03 Case (6) xbeta = 1 * -2.6115497787029 + age02k4_1 * 1.61623854211073 + age02k4_2 * 1.21820715251234 + age02k4_3 * -4.11548163171138E-02 + hhdif02_5 * 1.02189246829271 + hhdif02_8 * 0.764204911312437 + nsdink01_1 * -0.181797972690355 + nsdink01_2 * -8.62698395936533E-02 + nsdink01_3 * -0.174778157471988 + nsdink01_4 * -0.138696512008281 + ten01a_1 * -0.932590767065014 + educ_1 * -0.129229231653902 + educ_2 * 1.62656964599757E-02 Case (7) xbeta = 1 * -2.35099874723911 + age02k4_1 * 2.86736245579275 + age02k4_2 * 1.11362246346625 + age02k4_3 * -4.96908498296786E-02 + hhdif02_5 * 1.24419880883185 + hhdif02_8 * 0.596814463983589 + nsdink01_1 * -0.116147531633107 + nsdink01_2 * -0.176145125649595 + nsdink01_3 * -0.245573147663189 + nsdink01_4 * -0.253215923341285 + ten01a_1 * -0.900522549385092 + educ_1 * -6.52614578377725E-02 + educ_2 * 6.82472470095665E-02 Case (8) xbeta = 1 * -2.70598798149121 + age02k4_1 * 3.28684911749219 + age02k4_2 * 1.28890261485864 + age02k4_3 * 0.133032002545829 + hhdif02_5 * 1.6164255476081 + hhdif02_8 * 0.77758193427984 + nsdink01_1 * 0.149380985432119 + nsdink01_2 * 0.109397631622056 + nsdink01_3 * -0.124502557043223 + nsdink01_4 * -0.141099515171817 + ten01a_1 * -1.09519053007236 + educ_1 * -5.83367478439105E-02 + educ_2 * -3.80786401366626E-02 Case Else xbeta = 1 * -2.81626057938211 + age02k4_1 * 3.29303500656587 + age02k4_2 * 1.23938206211062 + age02k4_3 * 0.10927627843789 + hhdif02_5 * 1.58981504035505 + hhdif02_8 * 0.665028319443505 + nsdink01_1 * 0.290933896361176 + nsdink01_2 * 4.79010614952105E-02 + nsdink01_3 * -0.100451267947873 + nsdink01_4 * -0.145210040306286 + ten01a_1 * -0.946908133218892 + educ_1 * 2.68858652900322E-04 + educ_2 * 0.05791444174663 End Select End If Else If h_n_child(h) > 0 Then '*** Single with children *** Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -3.83231861569409 + age02k4_1 * 2.60956375573173 + age02k4_2 * 1.63954910365564 + age02k4_3 * 1.10014526651125 + hhdif02_2 * 1.66564642404674 + hhdif02_3 * -0.129875582932699 + hhdif02_7 * 1.73831167461353 + nsdink01_1 * 0.181202146680086 + nsdink01_2 * 0.135554623523691 + nsdink01_3 * 8.66063219603506E-02 + nsdink01_4 * 5.60779880144784E-02 + ten01a_1 * 0.14213170830342 + educ_1 * 0.049372114725585 + educ_2 * 8.54882347131726E-02 + sex_1 * -0.166267676392131 Case (2) xbeta = 1 * -3.33338901888595 + age02k4_1 * 1.93130181723159 + age02k4_2 * 1.30581842802998 + age02k4_3 * 0.898488380177181 + hhdif02_2 * 1.51274588668539 + hhdif02_3 * -0.265786148160205 + hhdif02_7 * 1.60753597158774 + nsdink01_1 * 0.317976668160899 + nsdink01_2 * 0.26619547308001 + nsdink01_3 * 0.149576783632621 + nsdink01_4 * 0.165233375955569 + ten01a_1 * -6.23399399593456E-02 + educ_1 * -7.65478860477195E-02 + educ_2 * 2.71501277358981E-03 + sex_1 * -0.250963293922398 Case (3) xbeta = 1 * -3.83514495504146 + age02k4_1 * 2.32539238804366 + age02k4_2 * 1.48554638421926 + age02k4_3 * 0.996596515010333 + hhdif02_2 * 1.58335449223705 + hhdif02_3 * 0.505641863980469 + hhdif02_7 * 1.61043031964307 + nsdink01_1 * 0.216110774397553 + nsdink01_2 * 0.235592370250558 + nsdink01_3 * 0.218184775099289 + nsdink01_4 * 0.093436021024441 + ten01a_1 * 0.137454977690065 + educ_1 * 0.180655414005501 + educ_2 * 0.322497645971462 + sex_1 * -9.80035673388865E-02 Case (4) xbeta = 1 * -3.52407148220774 + age02k4_1 * 2.58397033318754 + age02k4_2 * 1.6435871199193 + age02k4_3 * 1.21155240167431 + hhdif02_2 * 1.71289752955239 + hhdif02_3 * -0.446535880927579 + hhdif02_7 * 1.68528651423424 + nsdink01_1 * 0.412171851543313 + nsdink01_2 * 0.310495630353182 + nsdink01_3 * 0.278589034735599 + nsdink01_4 * 0.115552177719896 + ten01a_1 * -0.279577990689059 + educ_1 * 0.127899227812961 + educ_2 * 0.148486763492391 + sex_1 * -0.39112855746774 Case (5) xbeta = 1 * -3.94005073503122 + age02k4_1 * 2.86753723617371 + age02k4_2 * 2.03767470352178 + age02k4_3 * 1.53884157509271 + hhdif02_2 * 1.68309972551157 + hhdif02_3 * -0.609416242559259 + hhdif02_7 * 1.75882266293864 + nsdink01_1 * 0.396499680067166 + nsdink01_2 * 0.249114939729699 + nsdink01_3 * 0.230045247023017 + nsdink01_4 * 0.193485944150826 + ten01a_1 * -0.214067812727959 + educ_1 * 3.79884719251716E-02 + educ_2 * 9.80496879103874E-02 + sex_1 * -0.346857342489711 Case (6) xbeta = 1 * -3.91293594604177 + age02k4_1 * 2.99233901813246 + age02k4_2 * 2.22757568200948 + age02k4_3 * 1.75454873925853 + hhdif02_2 * 1.78900646734279 + hhdif02_3 * -0.876898840709218 + hhdif02_7 * 1.54337658606214 + nsdink01_1 * 0.341688128140831 + nsdink01_2 * 0.297703135414209 + nsdink01_3 * 0.133741387092204 + nsdink01_4 * 0.107844644524673 + ten01a_1 * -0.354729376777649 + educ_1 * -8.60621570184634E-03 + educ_2 * 5.29640627565914E-02 + sex_1 * -0.395107817718153 Case (7) xbeta = 1 * -3.18770942673591 + age02k4_1 * 2.50915609736218 + age02k4_2 * 1.61221218117319 + age02k4_3 * 1.11001149969134 + hhdif02_2 * 1.62228314685811 + hhdif02_3 * -7.42067966214912E-02 + hhdif02_7 * 1.65429844912201 + nsdink01_1 * 0.3195168679974 + nsdink01_2 * 0.328031343895465 + nsdink01_3 * 0.26940732434082 + nsdink01_4 * 0.179707406593504 + ten01a_1 * -0.468343242721434 + educ_1 * -9.57353611048453E-03 + educ_2 * 0.111334583816311 + sex_1 * -0.541706199742995 Case (8) xbeta = 1 * -3.56597329594496 + age02k4_1 * 2.66525821573206 + age02k4_2 * 1.88133832293546 + age02k4_3 * 1.41895013337175 + hhdif02_2 * 1.9426106002261 + hhdif02_3 * -1.1282916932647 + hhdif02_7 * 1.63233727350455 + nsdink01_1 * 0.562333912565618 + nsdink01_2 * 0.423432093857504 + nsdink01_3 * 0.392481173380767 + nsdink01_4 * 0.394219356487873 + ten01a_1 * -0.567357732192542 + educ_1 * 4.60299393977573E-02 + educ_2 * 8.61034333566557E-02 + sex_1 * -0.676021550886946 Case Else xbeta = 1 * -3.68401060278929 + age02k4_1 * 3.12106299669194 + age02k4_2 * 2.06314891451339 + age02k4_3 * 1.52095105090032 + hhdif02_2 * 1.73752153354687 + hhdif02_3 * -0.379199674048033 + hhdif02_7 * 1.76478949071253 + nsdink01_1 * 0.670551489770375 + nsdink01_2 * 0.548682379542002 + nsdink01_3 * 0.440180250335318 + nsdink01_4 * 0.276363802989893 + ten01a_1 * -0.679663223517001 + educ_1 * 6.36781582788782E-02 + educ_2 * 0.110691103798376 + sex_1 * -0.694249943010388 End Select Else '*** Single without children *** Select Case (h_BB_region(h)) Case (1) xbeta = 1 * -2.83254174664821 + age02k4_1 * 1.81420907736706 + age02k4_2 * 1.36265519265634 + age02k4_3 * 0.34111463219308 + hhdif02_2 * 2.66865824669966 + hhdif02_3 * 0.57800684922505 + hhdif02_4 * 3.37851749524224 + hhdif02_8 * 1.25251231246335 + nsdink01_1 * -0.16912911986368 + nsdink01_2 * -4.70197283627404E-02 + nsdink01_3 * -0.106634569484323 + nsdink01_4 * -0.070420097387817 + ten01a_1 * -8.53466837662291E-02 + educ_1 * 0.075262661169656 + educ_2 * 1.85955299028168E-02 + sex_1 * -2.64674550482032E-02 Case (2) xbeta = 1 * -2.69037352046831 + age02k4_1 * 1.7589290220388 + age02k4_2 * 1.23903814556012 + age02k4_3 * 0.301914213456571 + hhdif02_2 * 2.77178560781058 + hhdif02_3 * 0.481181272970079 + hhdif02_4 * 3.64724675383257 + hhdif02_8 * 1.24008896152236 + nsdink01_1 * -2.04034445912492E-02 + nsdink01_2 * -5.33434137309419E-02 + nsdink01_3 * -7.21566253355435E-02 + nsdink01_4 * -4.20438792021557E-02 + ten01a_1 * -0.248874439137994 + educ_1 * -5.77468935785549E-02 + educ_2 * -9.82694888791789E-04 + sex_1 * -3.22370349412214E-02 Case (3) xbeta = 1 * -2.78001651603751 + age02k4_1 * 1.77069810389907 + age02k4_2 * 1.26707230768362 + age02k4_3 * 0.291800547190043 + hhdif02_2 * 2.66332184968714 + hhdif02_3 * 0.613363068352658 + hhdif02_4 * 3.65897893128639 + hhdif02_8 * 1.09853675231132 + nsdink01_1 * -3.23969200805885E-02 + nsdink01_2 * -7.57312724894118E-02 + nsdink01_3 * -1.77838335545918E-02 + nsdink01_4 * -4.01934902784032E-02 + ten01a_1 * -0.276826119450376 + educ_1 * 0.128862892981998 + educ_2 * 7.82101420443804E-02 + sex_1 * -5.51282828102287E-03 Case (4) xbeta = 1 * -2.52190163697077 + age02k4_1 * 1.92472551354515 + age02k4_2 * 1.28272468290799 + age02k4_3 * 0.276127213809365 + hhdif02_2 * 2.79102682737709 + hhdif02_3 * 0.687179700152637 + hhdif02_4 * 3.6095620321847 + hhdif02_8 * 1.15192732342369 + nsdink01_1 * 0.121887933100298 + nsdink01_2 * -1.88976931095098E-02 + nsdink01_3 * -2.94274778502228E-02 + nsdink01_4 * -1.15290665923963E-02 + ten01a_1 * -0.428845216481454 + educ_1 * 1.14018752280289E-02 + educ_2 * 6.55374425965707E-02 + sex_1 * -6.21859920152053E-02 Case (5) xbeta = 1 * -2.68715400041172 + age02k4_1 * 1.92426859527828 + age02k4_2 * 1.3868942694244 + age02k4_3 * 0.314452977919147 + hhdif02_2 * 2.88627914506124 + hhdif02_3 * 0.732081290984633 + hhdif02_4 * 3.59685917711002 + hhdif02_8 * 1.15889850964494 + nsdink01_1 * 0.113401011224373 + nsdink01_2 * -1.20584240495327E-02 + nsdink01_3 * -3.43168802742413E-02 + nsdink01_4 * 2.02757860706707E-02 + ten01a_1 * -0.380664136486074 + educ_1 * 2.36860065813661E-02 + educ_2 * 0.058234642727286 + sex_1 * -5.75556540751983E-02 Case (6) xbeta = 1 * -2.65983605405779 + age02k4_1 * 1.96320872603672 + age02k4_2 * 1.37792070874261 + age02k4_3 * 0.299181981001751 + hhdif02_2 * 2.93993460279526 + hhdif02_3 * 0.479480994946484 + hhdif02_4 * 3.65271749230622 + hhdif02_8 * 1.18453279477072 + nsdink01_1 * 9.21862509244672E-02 + nsdink01_2 * 3.32575043258235E-02 + nsdink01_3 * 4.42465397948181E-02 + nsdink01_4 * -0.015867908500926 + ten01a_1 * -0.407019480265089 + educ_1 * 0.104156714169046 + educ_2 * 8.52434590572992E-02 + sex_1 * -8.66699066876318E-02 Case (7) xbeta = 1 * -2.34899550508465 + age02k4_1 * 1.85072848704713 + age02k4_2 * 1.10876626660106 + age02k4_3 * 0.172939799904457 + hhdif02_2 * 2.76707386971533 + hhdif02_3 * 0.640984108505396 + hhdif02_4 * 3.31689784998251 + hhdif02_8 * 1.10607804495365 + nsdink01_1 * 8.97874328546212E-02 + nsdink01_2 * -0.025125894542541 + nsdink01_3 * -0.040281434912395 + nsdink01_4 * -1.70922492093609E-02 + ten01a_1 * -0.483404325269078 + educ_1 * 3.65490984404025E-02 + educ_2 * 9.94617191102654E-02 + sex_1 * -0.111945476526451 Case (8) xbeta = 1 * -2.52382120952758 + age02k4_1 * 1.95550284826109 + age02k4_2 * 1.25179837254857 + age02k4_3 * 0.241763037397189 + hhdif02_2 * 2.7379170973376 + hhdif02_3 * 0.48812397956781 + hhdif02_4 * 3.28790351679736 + hhdif02_8 * 1.21870044700719 + nsdink01_1 * 0.246384325754361 + nsdink01_2 * 9.46607431578066E-02 + nsdink01_3 * 3.49390893745673E-02 + nsdink01_4 * 1.87259871469397E-02 + ten01a_1 * -0.505542253976181 + educ_1 * -6.73762004257724E-02 + educ_2 * 0.077234649325537 + sex_1 * -0.115472740263591 Case Else xbeta = 1 * -2.4901559525699 + age02k4_1 * 2.06958276515346 + age02k4_2 * 1.2351657097525 + age02k4_3 * 0.226738020937554 + hhdif02_2 * 2.89617387514195 + hhdif02_3 * 0.575373942314272 + hhdif02_4 * 3.36630008287407 + hhdif02_8 * 1.28478468907999 + nsdink01_1 * 0.197986054777377 + nsdink01_2 * 5.61410042855598E-02 + nsdink01_3 * 0.06644688531586 + nsdink01_4 * 4.78711008370281E-02 + ten01a_1 * -0.562513697834945 + educ_1 * 5.27147818526103E-02 + educ_2 * 0.102584433175407 + sex_1 * -0.125275246779666 End Select End If End If prob = 1 / (1 + Exp(-xbeta)) If Rnd < prob Then ' Household has moved within the region and is marked for tenure choice h_new_housing(h) = 1 Else '*** The household has not moved but needs to get some housing variables updated If h_house_owner(h) = 1 Then h_wealth_real_home(h) = mini(500000000, h_wealth_real_home(h) * m_price_rw_home) h_house_tax(h) = h_wealth_real_home(h) / kommundata(h_kommunindex(h)).kb Else h_house_cost(h) = h_house_cost(h) * m_KPI End If End If End If ' Household does not move to other BB-region End If 'If h_abroad(h) = 0 Next ' Next household '*** 2a) DESTINATION MODEL: HOUSEHOLDS THAT ARE RANDOMIZED TO MOVE ARE ASSIGNED TO A '*** TARGET REGION ACCORDING TO A CONDITIONAL LOGIT MODEL. '*** Calculate some covariates ' Average regional tax rates, house market value by square meter and ' unemployment rates Dim HPKVMnationalAverage As Double For i = 1 To 9 If pop_bbreg(i) > 0 Then KTAX(i) = KTAX(i) / pop_bbreg(i) unemp(i) = (unemp(i) / pop_bbreg(i)) * 100 Else KTAX(i) = 0 unemp(i) = 0 status "ERROR (Regional_Migration): zero regional population" End If If SumHouseArea(i) > 0 Then HPKVM(i) = SumMrktVal(i) / NSumMrktVal(i) ' The estimates based on 2002 data use house value, not housevalue per sqm (051027, Matias Eklöf) Else HPKVM(i) = 0 status "ERROR (Regional_Migration): zero regional house area" End If HPKVMnationalAverage = HPKVMnationalAverage + HPKVM(i) / 9# ' Next ' Prepare parameter matrix '--------------------------------------------------------------- Dim b1, b2, b3, b4, b5, b6, b7, b8, b9, theta ' Parameter estimates based on 2000 and 2002 data' Estimated by Matias Eklöf 8-12-2005 ' The columns represent: ' [1] : price_ratio ' [2] : Unempl_rate ' [3] : ASC ' [4] : 1(age>=16)(age-16) ' [5] : 1(age>=21)(age-21) ' [6] : 1(age>=25)(age-25) ' [7] : 1(age>=40)(age-40) ' [8] : 1(age>=65)(age-65) ' [9] : sdink/median ' [10] : svenskf ' [11] : 1(0<=utbtdsim<1) ' [12] : 1(1<=utbtdsim<2) ' Parameter estimates for home region 1 Sthlm b1 = Array( _ Array(1.318039, 0.03483122, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(1.318039, 0.03483122, 0.6666243, 0.05028398, -0.2964477, 0.2423093, 0.02948178, -0.04858126, 0.01745091, -0.1234184, -0.4737577, -0.2453912), _ Array(1.318039, 0.03483122, 2.94885, -0.2067395, -0.03367198, 0.266054, 0.01532449, -0.06913432, 0.02280867, 0.1433039, -0.02653836, 0.2231936), _ Array(1.318039, 0.03483122, 2.008513, -0.04528071, -0.09607011, 0.181303, -0.01310786, -0.07079319, -0.0005321958, -0.06555379, 0.2590733, 0.3071453), _ Array(1.318039, 0.03483122, 1.695533, -0.07210621, -0.1613663, 0.253512, -0.006244571, -0.0336138, -0.1008388, 0.04026326, -0.02577906, 0.2333637), _ Array(1.318039, 0.03483122, 0.6436043, -0.0943811, -0.004022536, 0.1672707, -0.009718212, -0.1248989, -0.01396804, 0.4636264, 0.6649806, 0.5929365), _ Array(1.318039, 0.03483122, 1.55335, -0.2992699, 0.3212182, 0.07945264, -0.05513607, -0.1164789, 0.02933511, 0.3082867, 0.9669091, 0.8399603), _ Array(1.318039, 0.03483122, 0.9054093, -0.1233699, 0.1140343, 0.06584875, -0.01144501, -0.1131458, -0.09036628, 0.317958, 0.781373, 0.6830922) _ ) ' Parameter estimates for home region 2 Gbg b2 = Array( _ Array(-1.182803, -0.403462, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(-1.182803, -0.403462, -0.1224845, 0.1582171, -0.6276524, 0.5062293, -0.007120494, -0.02645534, -0.1865718, -0.008222889, -0.5072435, -0.07516375), _ Array(-1.182803, -0.403462, 0.3799909, -0.1212332, -0.17121, 0.3636184, -0.03387541, -0.0863949, -0.1165414, 0.04337189, 0.6722839, 0.642525), _ Array(-1.182803, -0.403462, -1.161625, 0.120365, -0.4922878, 0.4243797, -0.04019881, -0.04822039, -0.4166062, -0.0004443472, 0.2563822, 0.409115), _ Array(-1.182803, -0.403462, -1.272456, 0.02032607, -0.3857669, 0.4071523, -0.02447658, -0.03652675, -0.6005032, 0.1977082, -0.286523, 0.08736821), _ Array(-1.182803, -0.403462, -2.762018, -0.002641994, -0.1336613, 0.237488, -0.04631224, -0.1176955, -0.1706618, 0.6099721, 1.114713, 0.784609), _ Array(-1.182803, -0.403462, -2.676038, -0.1276375, -0.0736779, 0.2953791, -0.04789207, -0.1179899, -0.4734016, 0.3721078, 0.8960911, 0.7630541), _ Array(-1.182803, -0.403462, -3.310095, 0.07839535, -0.2678184, 0.2517399, -0.02554433, -0.1422635, -0.5234504, 0.5128968, 0.954434, 0.7166137) _ ) ' Parameter estimates for home region 3 Mlm b3 = Array( _ Array(-0.04278921, -0.2352431, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(-0.04278921, -0.2352431, 0.5195873, -0.06863005, -0.1079889, 0.2227636, -0.04222422, -0.02987644, -0.3313734, -0.07501359, 0.453182, 0.2133518), _ Array(-0.04278921, -0.2352431, 0.9836182, -0.1507389, 0.01930165, 0.2289553, -0.06569444, -0.1223168, -0.04877468, 0.486699, 1.411152, 0.9586409), _ Array(-0.04278921, -0.2352431, -0.3219998, -0.004726558, -0.2864209, 0.3563351, -0.03699222, -0.1415653, -0.1444277, 0.05976183, 0.6834895, 0.2085442), _ Array(-0.04278921, -0.2352431, 0.3280386, -0.3325951, 0.1023176, 0.2900763, -0.09968299, 0.06862914, -0.3949622, 0.08619727, 0.6463511, 1.009983), _ Array(-0.04278921, -0.2352431, -0.504695, -0.2371021, 0.1784839, 0.1568281, -0.05107521, -0.1323272, -0.02513761, 0.3670177, 1.299572, 0.9356206), _ Array(-0.04278921, -0.2352431, -1.714011, -0.1313675, 0.02918444, 0.1273321, 0.02061806, -0.1909359, -0.06167498, 0.2274775, 1.206148, 0.6434325), _ Array(-0.04278921, -0.2352431, -1.505037, 0.01926747, -0.2519433, 0.2799321, 0.0008653132, -0.1109414, -0.1619583, 0.03933947, 1.087733, 0.6824622) _ ) ' Parameter estimates for home region 4 UrbGtl b4 = Array( _ Array(-0.3802264, -0.103116, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(-0.3802264, -0.103116, 0.06926136, -0.01188008, -0.1346866, 0.1750635, -0.0177256, -0.0247485, -0.01990444, 0.2240743, 0.2921302, 0.1820971), _ Array(-0.3802264, -0.103116, -0.1190186, 0.09724829, -0.3489634, 0.2868279, -0.006434229, -0.03771225, -0.09762079, 0.298349, 0.1787931, 0.1352671), _ Array(-0.3802264, -0.103116, -0.5546437, 0.04698886, -0.3382387, 0.3375529, -0.04306047, 0.03423685, -0.3188532, 0.2395807, -0.05095468, 0.04732388), _ Array(-0.3802264, -0.103116, -2.194168, 0.1631212, -0.5024972, 0.3770501, -0.05621369, 0.06529035, -0.4167598, 0.413689, -0.0518199, 0.2624326), _ Array(-0.3802264, -0.103116, -1.80611, -0.03338999, 0.01281235, 0.1152878, -0.07337882, -0.06829902, -0.00503376, 0.7211393, 1.44177, 0.9762229), _ Array(-0.3802264, -0.103116, -3.267831, 0.02529517, -0.03473733, 0.09618958, -0.05881458, -0.08728242, -0.2528954, 0.4870691, 1.115886, 0.7190221), _ Array(-0.3802264, -0.103116, -3.274825, 0.06685562, -0.1814595, 0.1773044, -0.02769395, -0.1582053, -0.2851455, 0.5487802, 0.8960253, 0.6698835) _ ) ' Parameter estimates for home region 5 UrbSve b5 = Array( _ Array(-0.6832437, -0.1279797, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(-0.6832437, -0.1279797, -0.8187507, -0.05478163, -0.09721054, 0.1504246, 0.0140001, 0.01723275, -0.3971174, 0.3269637, -0.3610167, -0.03468647), _ Array(-0.6832437, -0.1279797, -3.210519, 0.3416248, -0.6260854, 0.2899161, 0.01347138, -0.0008838788, -0.1750185, 0.1881875, -0.3250384, -0.05513317), _ Array(-0.6832437, -0.1279797, -0.7100599, -0.08175063, -0.1481166, 0.2555944, -0.004086173, 0.007639112, -0.240039, 0.3199751, -0.07551045, 0.1259055), _ Array(-0.6832437, -0.1279797, -1.831122, -0.03602572, -0.1965105, 0.2724474, -0.02063615, -0.009311242, -0.4562768, 0.4769579, 0.08876958, 0.3271957), _ Array(-0.6832437, -0.1279797, -4.527949, 0.2002903, -0.2795622, 0.1186205, -0.0004071549, -0.04756306, 0.0004123798, 0.5491119, 0.6650371, 0.4832033), _ Array(-0.6832437, -0.1279797, -2.734041, -0.104293, 0.09447507, 0.09807184, -0.06307266, -0.04956578, -0.1336334, 1.026619, 1.216475, 0.8478002), _ Array(-0.6832437, -0.1279797, -3.27492, -0.08338381, 0.0353892, 0.1142898, -0.03369651, -0.05361878, -0.3278245, 0.8145303, 0.7292069, 0.4220194) _ ) ' Parameter estimates for home region 6 UrbNorr b6 = Array( _ Array(2.941191, -0.4566801, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(2.941191, -0.4566801, 0.2540453, 0.4208999, -0.6148768, 0.1997706, -0.01142201, 0.00523086, -0.2437927, -0.142478, 0.02977007, 0.1334757), _ Array(2.941191, -0.4566801, 0.5816373, 0.3226524, -0.4514085, 0.1451309, -0.004619057, -0.2659265, -0.5586508, -0.3205764, -0.3630487, -0.1417017), _ Array(2.941191, -0.4566801, 3.84262, 0.06883076, -0.3137929, 0.2797191, -0.0219082, -0.002383454, -0.1229115, -0.161037, 0.1850401, 0.171873), _ Array(2.941191, -0.4566801, 3.293936, 0.1018768, -0.3064089, 0.2457134, -0.02066914, -0.03444086, -0.201508, 0.1351531, 0.2332582, 0.1396383), _ Array(2.941191, -0.4566801, 0.8699705, 0.2586378, -0.3079516, 0.1106795, -0.03586364, -0.07970135, -0.2568913, 0.3424095, 0.8146069, 0.4438496), _ Array(2.941191, -0.4566801, 2.194334, -0.001400703, 0.08782469, -0.04533664, -0.002908813, -0.06241612, -0.2254379, 0.5934949, 0.7541834, 0.4931438), _ Array(2.941191, -0.4566801, 3.835651, 0.1221157, -0.1312888, 0.08797049, -0.05348312, -0.06499377, -0.3102872, 1.004833, 1.086847, 0.8109558) _ ) ' Parameter estimates for home region 7 RurGtl b7 = Array( _ Array(2.000594, -0.2174421, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(2.000594, -0.2174421, 2.548015, -0.0941344, 0.01029407, 0.1025573, -0.01805385, 0.00005763852, -0.02780311, -0.07242529, 0.02157467, 0.1346818), _ Array(2.000594, -0.2174421, 2.558109, -0.05770979, -0.1380251, 0.224452, -0.02183655, 0.00839938, -0.2380607, -0.1748662, -0.4572683, -0.09382267), _ Array(2.000594, -0.2174421, 4.273242, -0.06441575, -0.1022022, 0.2224704, -0.05314218, -0.01268586, 0.05911134, 0.1035101, 0.6114789, 0.557218), _ Array(2.000594, -0.2174421, 2.922403, -0.04542042, -0.1967756, 0.2722917, -0.01450803, -0.007806261, -0.2737485, 0.1732791, -0.2591412, 0.08214859), _ Array(2.000594, -0.2174421, 1.77803, 0.1086527, -0.2904468, 0.1830969, 0.01096012, -0.01442305, -0.8426369, 0.1394931, -0.1992722, -0.02146478), _ Array(2.000594, -0.2174421, 1.236708, -0.09554434, 0.1039577, 0.06203597, -0.03714388, -0.08850899, -0.2471637, 0.3760014, 0.9147641, 0.7577504), _ Array(2.000594, -0.2174421, 0.952118, 0.1811657, -0.2495837, 0.1046087, 0.0114905, -0.1475123, -0.6248262, 0.1971974, 0.6877318, 0.6785678) _ ) ' Parameter estimates for home region 8 RurSve b8 = Array( _ Array(0.1299986, -0.1643176, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(0.1299986, -0.1643176, 0.1492903, -0.09763258, -0.03572815, 0.1188363, 0.01154065, -0.009292246, -0.2076043, -0.09276325, -0.3362605, 0.03768222), _ Array(0.1299986, -0.1643176, 0.05505963, -0.1665462, 0.0504304, 0.1089017, 0.01088422, -0.01130927, -0.4925761, -0.170859, -0.8970686, -0.3772623), _ Array(0.1299986, -0.1643176, 1.466131, -0.2613159, 0.08644004, 0.1922032, -0.0009683817, -0.02416353, -0.09585196, -0.06425475, -0.1349598, 0.17884), _ Array(0.1299986, -0.1643176, 1.670383, -0.182829, 0.05755833, 0.1587579, -0.02834442, -0.007980649, -0.1584931, 0.3866353, 0.05298125, 0.2162055), _ Array(0.1299986, -0.1643176, -0.4720782, -0.07486621, -0.1226047, 0.2016106, 0.01772333, -0.04319521, -0.3747539, 0.6202371, -0.01649346, 0.1149347), _ Array(0.1299986, -0.1643176, -1.34093, -0.1570435, 0.2034802, 0.01325964, -0.04545667, -0.05347023, -0.1298227, 0.2004872, 0.6919345, 0.5839103), _ Array(0.1299986, -0.1643176, -1.288421, -0.09656396, 0.06177128, 0.08037475, -0.01363471, -0.06974047, -0.2324129, 0.3393487, 0.3097291, 0.4729937) _ ) ' Parameter estimates for home region 9 RurNorr b9 = Array( _ Array(0.2935686, -0.2896723, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#, 0#), _ Array(0.2935686, -0.2896723, 0.3365823, -0.01526516, -0.1582069, 0.1972943, -0.04065998, -0.0171421, -0.3882055, -0.1708624, -0.1457175, -0.03774757), _ Array(0.2935686, -0.2896723, -0.3249169, 0.1130557, -0.3611187, 0.25829, 0.001199965, -0.01889742, -0.4287289, -0.5746882, -0.2666719, -0.2322736), _ Array(0.2935686, -0.2896723, 0.992501, -0.02309028, -0.2252678, 0.2805251, -0.0190415, -0.02441655, -0.02633383, -0.2814601, 0.006874478, -0.02495896), _ Array(0.2935686, -0.2896723, 1.651025, -0.1072389, -0.1574662, 0.2945389, -0.003504761, 0.00161233, -0.1591334, -0.07059434, -0.3281861, -0.2653315), _ Array(0.2935686, -0.2896723, 2.240994, -0.04776489, -0.2554733, 0.3384081, -0.02491469, 0.006258452, -0.09076717, 0.4964089, -0.1482256, -0.08823862), _ Array(0.2935686, -0.2896723, -0.820999, -0.0234948, -0.08100998, 0.173025, -0.06197844, -0.0161583, -0.04701683, -0.3481203, 0.4851527, 0.2916291), _ Array(0.2935686, -0.2896723, -0.9068318, -0.08033682, 0.03911572, 0.1141205, -0.05541896, -0.02758029, 0.002431078, 0.2106279, 0.6084323, 0.2775154) _ ) ' All parameters are loaded into matrix theta theta = Array(b1, b2, b3, b4, b5, b6, b7, b8, b9) Dim x(1 To 12) As Double, exp_xbeta(8) As Double, sum_exp_xbeta As Double Dim probs(8) As Double Dim rand As Double, cumsum As Double Dim destreg As Byte '** Loop across all households to process the above selected households For h = 1 To m_hcount If h_abroad(h) = 0 And IsMoving(h) = 1 Then ' Individual specific variables ' NOTE (051027, Matias Eklöf): The age is measured in the current year in the estimates based on 2002 data. This is ' handled below as "i_age(h_idx_headofhh(h))-1" is now "i_age(h_idx_headofhh(h))". x(3) = 1 If (i_age(h_idx_headofhh(h)) - 1) >= 16 Then x(4) = (i_age(h_idx_headofhh(h))) - 16 Else x(4) = 0 If (i_age(h_idx_headofhh(h)) - 1) >= 21 Then x(5) = (i_age(h_idx_headofhh(h))) - 21 Else x(5) = 0 If (i_age(h_idx_headofhh(h)) - 1) >= 25 Then x(6) = (i_age(h_idx_headofhh(h))) - 25 Else x(6) = 0 If (i_age(h_idx_headofhh(h)) - 1) >= 40 Then x(7) = (i_age(h_idx_headofhh(h))) - 40 Else x(7) = 0 If (i_age(h_idx_headofhh(h)) - 1) >= 65 Then x(8) = (i_age(h_idx_headofhh(h))) - 65 Else x(8) = 0 x(9) = (h_inc_disposable1(h) / median_diskpink) If i_born_abroad(h_idx_headofhh(h)) = 0 Then x(10) = 1 Else x(10) = 0 If i_edlevel(h_idx_headofhh(h)) = 0 Then x(11) = 1 Else x(11) = 0 If i_edlevel(h_idx_headofhh(h)) = 1 Then x(12) = 1 Else x(12) = 0 ' Calculate linear (exponentiated) predictors and their sums sum_exp_xbeta = 0 For i = 1 To 8 If i >= h_BB_region(h) Then destreg = i + 1 Else destreg = i ' Target region specific variables x(1) = HPKVM(destreg) / HPKVMnationalAverage x(2) = unemp(destreg) xbeta = 0 For j = 1 To UBound(x) xbeta = xbeta + x(j) * theta(h_BB_region(h))(i)(j) Next exp_xbeta(i) = Exp(mini(700, xbeta)) 'NOTE: OVERFLOW PROTECTION (TP050428) sum_exp_xbeta = sum_exp_xbeta + exp_xbeta(i) Next ' Calculate probabilities For i = 1 To 8 probs(i) = exp_xbeta(i) / sum_exp_xbeta Next '** Randomize households to their new region ' NOTE: the new region cannot be the same as the old region. Because of this the ' diagonal elements of the original 9*9 transition matrix is eliminated resulting ' in the following 9*8 transition matrix: ' [1->2, 1->3, 1->4, 1->5, 1->6, 1->7, 1->8, 1->9, ' 2->1, 2->3, 2->4, 2->5, 2->6, 2->7, 2->8, 2->9, ' 3->1, 3->2, 3->4, 3->5, 3->6, 3->7, 3->8, 3->9, ' 4->1, 4->2, 4->3, 4->5, 4->6, 4->7, 4->8, 4->9, ' 5->1, 5->2, 5->3, 5->4, 5->6, 5->7, 5->8, 5->9, ' 6->1, 6->2, 6->3, 6->4, 6->5, 6->7, 6->8, 6->9, ' 7->1, 7->2, 7->3, 7->4, 7->5, 7->6, 7->8, 7->9, ' 8->1, 8->2, 8->3, 8->4, 8->5, 8->6, 8->7, 8->9, ' 9->1, 9->2, 9->3, 9->4, 9->5, 9->6, 9->7, 9->8] rand = Rnd cumsum = 0 For i = 1 To 8 cumsum = cumsum + probs(i) If rand < cumsum Then If i > h_BB_region(h) Then h_BB_region(h) = i + 1 Else h_BB_region(h) = i End If Exit For End If Next '*** 2b) THE DESTINATION MUNICIPALITY IS DETERMINED WITHIN THE REGION (WITH PROBABILITY '*** PROPORTIONAL TO THE RELATIVE POPULATION FREQUENCY OF THE MUNICIPALITY) cumsum = 0 rand = Rnd * pop_bbreg(h_BB_region(h)) For i = 1 To UBound(pop_munic, 1) cumsum = cumsum + pop_munic(i, h_BB_region(h)) If rand < cumsum Then h_kommunindex(h) = i Exit For End If Next ' Recoding some regional variables h_kommunkod(h) = kommundata(h_kommunindex(h)).kod ' h_la_region(h) = kommundata(h_kommunindex(h)).LA_region End If Next End Sub
'********************* '********************* '*** TENURE CHOICE *** '********************* '********************* ' ' GENERAL COMMENTS: ' - All households that moves during the year has to make a tenure choice. This also applies to ' new households (youngsters leaving home, man leaving household, immigrating households). ' - Tenure choice is simulated using logistic regression models, one model for each type of ' household. Whether or not the household changes its BabyBoom region also decides what model ' is used.
Public Sub TenureChoice() status "Tenure Choice" Printdok "Tenure Choice" Dim count_income As Long, h As Long, i As Long, j As Long, HouseSellingPrice() As Long Dim temp_income1() As Double, temp_income2() As Double, temp_income3() As Double Dim median_diskpink As Double Dim Q_dispinc As Variant, Q_capinc As Variant, Q_diff_dispinc As Variant, temp As Variant Dim reg01_1 As Byte, reg01_2 As Byte, reg01_3 As Byte, reg01_4 As Byte, reg01_5 As Byte Dim reg01_6 As Byte, reg01_7 As Byte, reg01_8 As Byte Dim age02k5_1 As Byte, age02k5_2 As Byte, age02k5_3 As Byte, age02k5_4 As Byte Dim utbtdsim_0 As Byte, utbtdsim_1 As Byte Dim ten01a_1 As Byte, mov01hf_1 As Byte, alos01b_1 As Byte, sex_1 As Byte, sweborn_1 As Byte Dim sex_2 As Byte Dim nsdink01_1 As Byte, nsdink01_2 As Byte, nsdink01_3 As Byte, nsdink01_4 As Byte Dim idnr As Long, addfw As Long, tempfw As Long, oldfw As Long Dim xbeta As Double, prob As Double Dim hhdif02d_2 As Byte, hhdif02d_3 As Byte, hhdif02d_4 As Byte, hhdif02a_5 As Byte Dim hhdif02b_7 As Byte, hhdif02a_8 As Byte Dim h_housetax_postponed1 As Long, h_housetax_postponed As Long, indnr As Long Dim idxnr As Long, i_housetax_postponed1 As Long ReDim HouseSellingPrice(1 To m_icount) ' Calculate quintiles of lagged disposable income, lagged capital income and difference in ' disposable income between last year and the year before that count_income = 0 ReDim temp_income1(1 To m_icount), temp_income2(1 To m_icount), temp_income3(1 To m_icount) For h = 1 To m_hcount h_wealth_financial_sales(h) = 0 If h_abroad(h) = 0 Then count_income = count_income + 1 temp_income1(count_income) = h_inc_disposable1(h) End If Next ReDim Preserve temp_income1(1 To count_income) ' Calculate quintiles and median of taxable income temp = arr_Percentile(temp_income1, 20, 40, 50, 60, 80) Q_dispinc = Array(Array(temp(1, 1), temp(1, 2)), Array(temp(2, 1), temp(2, 2)), _ Array(temp(4, 1), temp(4, 2)), Array(temp(5, 1), temp(5, 2))) median_diskpink = temp(3, 2) '*** Loop across household population For h = 1 To m_hcount '*** Only households living in Sweden that are marked for tenure choice are simulated If h_abroad(h) = 0 And h_new_housing(h) = 1 Then ' If household owns their residence it will new be sold and a selling price ' is calculated as the current market value of the home If h_house_owner(h) = 1 Then HouseSellingPrice(h) = h_wealth_real_home(h) Else HouseSellingPrice(h) = 0 End If ' Dummy variables for regions If h_BB_region(h) = 1 Then reg01_1 = 1 Else reg01_1 = 0 If h_BB_region(h) = 2 Then reg01_2 = 1 Else reg01_2 = 0 If h_BB_region(h) = 3 Then reg01_3 = 1 Else reg01_3 = 0 If h_BB_region(h) = 4 Then reg01_4 = 1 Else reg01_4 = 0 If h_BB_region(h) = 5 Then reg01_5 = 1 Else reg01_5 = 0 If h_BB_region(h) = 6 Then reg01_6 = 1 Else reg01_6 = 0 If h_BB_region(h) = 7 Then reg01_7 = 1 Else reg01_7 = 0 If h_BB_region(h) = 8 Then reg01_8 = 1 Else reg01_8 = 0 ' Dummy variables for quintile of disposable income (lagged) nsdink01_1 = 0: nsdink01_2 = 0: nsdink01_3 = 0: nsdink01_4 = 0 Select Case (h_inc_disposable1(h)) Case Is < Q_dispinc(1)(2) nsdink01_1 = 1 Case Is < Q_dispinc(2)(2) nsdink01_2 = 1 Case Is < Q_dispinc(3)(2) nsdink01_3 = 1 Case Is < Q_dispinc(4)(2) nsdink01_4 = 1 Case Else End Select ' Dummy variable for sex (head of household) If i_sex(h_idx_headofhh(h)) = 1 Then sex_1 = 1 Else sex_1 = 0 sex_2 = sex_1 'Different definition for different model - ask UF to change this!!!!!!! ' Dummy variables for educational attainment (head of household) If i_edlevel(h_idx_headofhh(h)) = 0 Then utbtdsim_0 = 1 Else utbtdsim_0 = 0 If i_edlevel(h_idx_headofhh(h)) = 1 Then utbtdsim_1 = 1 Else utbtdsim_1 = 0 ' Dummy variables for age (head of household) ' Age groups: 0-24, 25-39, 40-64, 65-79, 80+ age02k5_1 = 0: age02k5_2 = 0: age02k5_3 = 0: age02k5_4 = 0 Select Case i_age(h_idx_headofhh(h)) Case Is < 25 age02k5_1 = 1 Case Is < 40 age02k5_2 = 1 Case Is < 65 age02k5_3 = 1 Case Is < 80 age02k5_4 = 1 Case Else End Select ' Dummy variable for nationality (head of household) If i_born_abroad(h_idx_headofhh(h)) = 0 Then sweborn_1 = 1 Else sweborn_1 = 0 ' Dummy variable for home ownership If h_house_owner(h) = 1 Then ten01a_1 = 1 Else ten01a_1 = 0 ' DEMOGRAPHIC EVENTS: the "order of determination" of various demographic events used when ' estimating the models is used also in SESIM. ' Last child moves out If h_childmoveout(h) = 1 And h_n_child(h) = 0 Then hhdif02a_8 = 1 Else hhdif02a_8 = 0 ' Separation If i_year_sep(h_idx_headofhh(h)) = base_year + model_time Then hhdif02d_2 = 1 hhdif02a_8 = 0 Else hhdif02d_2 = 0 End If ' Partner dies If i_widowed(h_idx_headofhh(h)) = base_year + model_time Then hhdif02d_3 = 1 hhdif02a_8 = 0 hhdif02d_2 = 0 Else hhdif02d_3 = 0 End If ' Nestleave (applies to childrens household - not parents) If i_bvux(h_idx_headofhh(h)) = 1 And i_bvux1(h_idx_headofhh(h)) = 0 Then hhdif02d_4 = 1 hhdif02a_8 = 0 hhdif02d_2 = 0 hhdif02d_3 = 0 Else hhdif02d_4 = 0 End If ' Move together If i_civ_stat(h_idx_headofhh(h)) = 1 And i_civ_stat1(h_idx_headofhh(h)) = 0 Then hhdif02a_5 = 1 hhdif02a_8 = 0 hhdif02d_2 = 0 hhdif02d_3 = 0 hhdif02d_4 = 0 Else hhdif02a_5 = 0 End If ' More children If h_n_child(h) > h_n_child1(h) Then hhdif02b_7 = 1 hhdif02a_8 = 0 hhdif02d_2 = 0 hhdif02d_3 = 0 hhdif02d_4 = 0 hhdif02a_5 = 0 Else hhdif02b_7 = 0 End If '*** Determine if the household has moved between BabyBoom-regions during the year If h_BB_region(h) = h_BB_region1(h) Then '*** HOUSEHOLDS THAT MOVE WITHIN THE BABYBOOM REGION '*** Determine type of household - different models for different household types If h_n_adults(h) = 2 Then If h_n_child(h) > 0 Then '*** Cohabiting with children xbeta = -0.15963 + _ age02k5_1 * 0.3737 + age02k5_2 * 1.23008 + _ age02k5_3 * 0.72518 + age02k5_4 * 0.41767 + _ hhdif02a_5 * -0.48757 + hhdif02b_7 * -0.72656 + _ nsdink01_1 * -1.20305 + nsdink01_2 * -0.59498 + _ nsdink01_3 * -0.42345 + nsdink01_4 * -0.30542 + _ ten01a_1 * 1.48937 + _ sweborn_1 * 0.75888 + _ utbtdsim_0 * -0.57927 + utbtdsim_1 * -0.28011 + _ reg01_1 * -0.45728 + reg01_2 * -0.3803 + _ reg01_3 * -0.12005 + reg01_4 * -0.13718 + _ reg01_5 * -0.16328 + reg01_6 * -0.22213 + _ reg01_7 * 0.08486 + reg01_8 * -0.0702 Else '*** Cohabiting without children xbeta = -1.13666 + _ age02k5_1 * 0.27399 + age02k5_2 * 1.21257 + _ age02k5_3 * 0.87788 + age02k5_4 * 0.66383 + _ hhdif02a_5 * -0.00887 + hhdif02a_8 * -0.18453 + _ nsdink01_1 * -1.12792 + nsdink01_2 * -0.80341 + _ nsdink01_3 * -0.38741 + nsdink01_4 * -0.19336 + _ ten01a_1 * 1.66801 + _ sweborn_1 * 0.33276 + _ utbtdsim_0 * -0.23785 + utbtdsim_1 * -0.1329 + _ reg01_1 * 0.23276 + reg01_2 * 0.1204 + _ reg01_3 * 0.28934 + reg01_4 * 0.06082 + _ reg01_5 * 0.18338 + reg01_6 * 0.08738 + _ reg01_7 * 0.32369 + reg01_8 * 0.20273 End If '*** Single households Else If h_n_child(h) > 0 Then '*** Single with children xbeta = 0.23187 + _ age02k5_1 * -1.13445 + age02k5_2 * -0.58979 + _ age02k5_3 * -0.77461 + age02k5_4 * -0.72708 + _ hhdif02d_2 * -0.58767 + hhdif02d_3 * 0.4635 + _ hhdif02b_7 * -0.62199 + _ nsdink01_1 * -0.62141 + nsdink01_2 * -0.34311 + _ nsdink01_3 * -0.21919 + nsdink01_4 * -0.15808 + _ ten01a_1 * 1.12962 + _ sweborn_1 * 0.54241 + _ utbtdsim_0 * -0.58966 + utbtdsim_1 * -0.31956 + _ reg01_1 * 0.03834 + reg01_2 * -0.23401 + _ reg01_3 * 0.13327 + reg01_4 * -0.20143 + _ reg01_5 * -0.07974 + reg01_6 * -0.22358 + _ reg01_7 * -0.07222 + reg01_8 * -0.00669 + _ sex_1 * 0.13533 Else '*** Single without children xbeta = -1.17533 + _ age02k5_1 * 0.67652 + age02k5_2 * 0.9495 + _ age02k5_3 * 0.89913 + age02k5_4 * 0.68718 + _ hhdif02d_2 * -0.41707 + hhdif02d_3 * -0.08882 + _ hhdif02d_4 * -0.51132 + hhdif02a_8 * -0.00475 + _ nsdink01_1 * -0.89644 + nsdink01_2 * -0.92847 + _ nsdink01_3 * -0.61556 + nsdink01_4 * -0.34157 + _ ten01a_1 * 1.07974 + _ sweborn_1 * 0.35482 + _ utbtdsim_0 * -0.21599 + utbtdsim_1 * -0.11382 + _ reg01_1 * 0.08791 + reg01_2 * -0.31017 + _ reg01_3 * 0.06887 + reg01_4 * -0.24269 + _ reg01_5 * 0.00425 + reg01_6 * -0.08877 + _ reg01_7 * -0.01155 + reg01_8 * 0.24349 + _ sex_1 * -0.11115 End If End If ' If h_n_adults(h) = 2 Then Else '*** HOUSEHOLDS THAT MOVE BETWEEN BABYBOOM REGIONS '*** Determine type of household - different models for different household types If h_n_adults(h) = 2 Then If h_n_child(h) > 0 Then '*** Cohabiting with children xbeta = 0.71042 + _ age02k5_1 * -1.08879 + age02k5_2 * -0.27216 + _ age02k5_3 * -0.27313 + age02k5_4 * -0.28572 + _ hhdif02a_5 * -0.43859 + hhdif02b_7 * -0.4427 + _ nsdink01_1 * -1.31596 + nsdink01_2 * -0.59028 + _ nsdink01_3 * -0.43908 + nsdink01_4 * -0.29725 + _ ten01a_1 * 0.88188 + _ sweborn_1 * 0.81226 + _ utbtdsim_0 * -0.15501 + utbtdsim_1 * 0.09775 + _ reg01_1 * -0.22824 + reg01_2 * -0.50192 + _ reg01_3 * -0.19001 + reg01_4 * -0.15215 + _ reg01_5 * -0.05161 + reg01_6 * -0.7463 + _ reg01_7 * 0.27171 + reg01_8 * 0.42735 Else '*** Cohabiting without children xbeta = 0.51556 + _ age02k5_1 * -0.92404 + age02k5_2 * 0.02737 + _ age02k5_3 * 0.45497 + age02k5_4 * 0.2254 + _ hhdif02a_5 * -0.30294 + hhdif02a_8 * 0.19668 + _ nsdink01_1 * -1.44068 + nsdink01_2 * -0.97176 + _ nsdink01_3 * -0.66107 + nsdink01_4 * -0.3793 + _ ten01a_1 * 1.00039 + _ sweborn_1 * 0.31514 + _ utbtdsim_0 * 0.00978 + utbtdsim_1 * 0.15149 + _ reg01_1 * -0.32983 + reg01_2 * -0.73729 + _ reg01_3 * -0.8288 + reg01_4 * -0.462 + _ reg01_5 * -0.20247 + reg01_6 * -0.54908 + _ reg01_7 * -0.06838 + reg01_8 * 0.26955 End If '*** Single households Else If h_n_child(h) > 0 Then '*** Single with children xbeta = 1.40661 + _ age02k5_1 * -1.06868 + age02k5_2 * -0.69853 + _ age02k5_3 * -0.77227 + age02k5_4 * -0.70432 + _ hhdif02d_2 * -0.09932 + hhdif02d_3 * -0.07013 + _ hhdif02b_7 * -0.01496 + _ nsdink01_1 * -0.74398 + nsdink01_2 * -0.54266 + _ nsdink01_3 * -0.44928 + nsdink01_4 * -0.28727 + _ ten01a_1 * 0.73331 + _ sweborn_1 * 0.50947 + _ utbtdsim_0 * -0.60982 + utbtdsim_1 * -0.3813 + _ reg01_1 * -0.95115 + reg01_2 * -1.03354 + _ reg01_3 * -0.75655 + reg01_4 * -0.60974 + _ reg01_5 * -0.6857 + reg01_6 * -1.12042 + _ reg01_7 * -0.24388 + reg01_8 * -0.14885 + _ sex_2 * -0.04506 Else '*** Single without children xbeta = -0.39494 + _ age02k5_1 * -0.09901 + age02k5_2 * 0.24956 + _ age02k5_3 * 0.74499 + age02k5_4 * 0.50965 + _ hhdif02d_2 * -0.08281 + hhdif02d_3 * -0.00179 + _ hhdif02d_4 * -0.52999 + hhdif02a_8 * 0.1309 + _ nsdink01_1 * -0.75568 + nsdink01_2 * -0.82878 + _ nsdink01_3 * -0.61268 + nsdink01_4 * -0.33081 + _ ten01a_1 * 0.50551 + _ sweborn_1 * 0.32678 + _ utbtdsim_0 * 0.05023 + utbtdsim_1 * -0.01583 + _ reg01_1 * 0.19932 + reg01_2 * -0.50965 + _ reg01_3 * -0.26335 + reg01_4 * -0.35329 + _ reg01_5 * -0.13102 + reg01_6 * -0.73265 + _ reg01_7 * 0.18994 + reg01_8 * 0.39618 + _ sex_2 * -0.17153 End If End If ' If h_n_adults(h) = 2 Then End If prob = 1 / (1 + Exp(-xbeta)) If Rnd < prob Then ' The household owns the new residence. h_house_owner(h) = 1 Else ' The household rents the new residence. h_house_owner(h) = 0 End If End If ' If h_abroad(h) = 0 And h_new_housing(h) = 1 Then... Next ' Loop across households ' Impute housing information for households that have changed housing Call ImputeHousingInfo ' Handle capital gain, postponement of taxes and changes in debt/wealth For h = 1 To m_hcount ' Households living in Sweden that has changed residence during the year... If h_abroad(h) = 0 And h_new_housing(h) = 1 Then ' '*** Case 1: Renting --> owning ' If h_house_owner1(h) = 0 And h_house_owner(h) = 1 Then ' ' If h_wealth_financial(h) * 0.4 > h_wealth_real_home(h) * 0.1 Then ' ' ' Updating debts ' h_wealth_debt(h) = h_wealth_debt(h) + _ ' maxi(0, h_wealth_real_home(h) - h_wealth_financial(h) * 0.4) ' ' ' Updating financial wealth ' h_wealth_financial(h) = maxi(h_wealth_financial(h) - h_wealth_real_home(h), _ ' 0.6 * h_wealth_financial(h)) ' ' Else ' ' ' Updating debts ' h_wealth_debt(h) = h_wealth_debt(h) + _ ' maxi(0, h_wealth_real_home(h) - h_wealth_financial(h) * 0.6) ' ' ' Updating financial wealth ' h_wealth_financial(h) = 0.4 * h_wealth_financial(h) ' ' End If ' End If '*** Case 2: Owning --> renting/owning (i.e. a home has been sold) If h_house_owner1(h) = 1 And HouseSellingPrice(h) > 0 Then If h_n_adults(h) = 1 Then If h_indnr_female(h) > 0 Then Call HandleHouseSalesPurchase(indnr2index(h_indnr_female(h)), HouseSellingPrice(h), 1) Else Call HandleHouseSalesPurchase(indnr2index(h_indnr_male(h)), HouseSellingPrice(h), 1) End If Else ' Ownership shares of male/female assumed 65/35 in two-adult-households (the same assumption ' as for total real wealth) Call HandleHouseSalesPurchase(indnr2index(h_indnr_female(h)), HouseSellingPrice(h), 0.35) Call HandleHouseSalesPurchase(indnr2index(h_indnr_male(h)), HouseSellingPrice(h), 0.65) End If ' Individualize household capital income Call Individualize_CapitalIncome(h) End If ' Purchase price of new home h_house_purchase(h) = h_wealth_real_home(h) ' Renewed calculation of individualized financial wealth and debts Call Individualize_FinancialWealth(h) Call Individualize_Debt(h) End If Next End Sub
'******************************************* '******************************************* '*** HANDLING OF HOME SALES AND PURCHASE *** '******************************************* '******************************************* ' ' GENERAL COMMENTS: ' - Sub HandleHouseSalesPurchase calculates postponement of taxes for capital incomes ' due to housesales. ' - The sub also updates household capital incomes, household financial wealth and ' household debt.
Public Sub HandleHouseSalesPurchase(ByVal idxnr As Long, ByVal HouseSellingPrice As Long, _ ByVal share As Double) Dim h As Long, i_housetax_postponed1 As Long, oldfw As Long, addfw As Long Dim oldaddfw As Long h = hhnr2index(i_hhnr(idxnr)) ' Calculate updated postponed tax i_housetax_postponed1 = i_housetax_postponed(idxnr) If ((HouseSellingPrice - h_house_purchase(h)) * share + i_housetax_postponed1 > _ (50000 / m_price99)) Then i_housetax_postponed(idxnr) = mini(1, h_wealth_real_home(h) / HouseSellingPrice) * _ ((HouseSellingPrice - h_house_purchase(h)) * share + i_housetax_postponed1) Else i_housetax_postponed(idxnr) = 0 End If ' Update household capital income h_inc_capital(h) = h_inc_capital(h) + share * (HouseSellingPrice - h_house_purchase(h)) + _ i_housetax_postponed1 - i_housetax_postponed(idxnr) ' Update financial wealth oldfw = h_wealth_financial(h) addfw = share * (HouseSellingPrice - h_wealth_real_home(h)) - 0.3 * (2 / 3#) * _ (share * (HouseSellingPrice - h_house_purchase(h)) + _ i_housetax_postponed1 - i_housetax_postponed(idxnr)) h_wealth_financial_sales(h) = addfw If (addfw >= 0) Then oldaddfw = addfw addfw = maxi(0, addfw - h_wealth_debt(h)) ' h_wealth_financial(h) = h_wealth_financial(h) + 0.8 * addfw ' flood 051112 original value was 0.3 ' If addfw = 0 Then h_wealth_debt(h) = h_wealth_debt(h) - oldaddfw ' If addfw > 0 Then h_wealth_debt(h) = 0 h_wealth_financial_sales(h) = addfw Else ' h_wealth_financial(h) = maxi(0, h_wealth_financial(h) + addfw) ' h_wealth_debt(h) = h_wealth_debt(h) - mini(0, oldfw + addfw) End If End Sub
'*************************************** '*************************************** '*** INITIALIZE HOUSE PURCHASE PRICE *** '*************************************** '*************************************** ' ' GENERAL COMMENTS: ' - House purchase price is initially (at base year) determined as a share of current house ' market value. Further information can be found in ' S:\Projekt\BabyBoom\skattningar\LF\050320\Anskaffningsutgift.doc.
Public Sub InitializeHousePurchasePrice() status "Initializing house purchase prices" Printdok "Initializing house purchase prices" Dim h As Long Dim rvek As Variant Dim idx As Integer ' Vector of estimated house purchase price to house market value ratios rvek = Array(0.97, 0.95, 0.95, 0.94, 0.94, 0.95, 0.88, 0.85, 0.82, 0.83, 0.8, 0.8, 0.79, 0.8) For h = 1 To m_hcount If h_abroad(h) = 0 And h_house_owner(h) = 1 Then idx = Int(get_hh_max(indnr2index(h_first_indnr(h)), "i_age") / 5) - 3 idx = mini(14, maxi(1, idx)) h_house_purchase(h) = rvek(idx) * h_wealth_real_home(h) Else h_house_purchase(h) = 0 End If Next End Sub
'****************************** '*** INTEREST AND DIVIDENDS *** '****************************** ' ' GENERAL COMMENTS: ' - Interests and divideds are simulated as a rate that, multiply to the households financial wealth, ' returns the amount of obtained interests and divideds. Due to difficulties in finding a suitable ' statistican model the rates are simulated from the empirical distribution function of all household ' rates.
Public Sub Interest_Dividends() status "Interest and dividends" Printdok "Interest and dividends" Dim perc As Variant Dim h As Long, indnr As Long, indexnr As Long Dim idx As Byte Dim rand As Double, step As Double, rate As Double ' Estimated percentiles of distribution of rates ' NOTE: maximum of 0.5 assumed (by Anders Klevmarken 050527) perc = Array(0, 0, 0, 0, 0, 0, 0, 0, 0.0003208, 0.0008015, 0.0012416, 0.0016292, 0.0019958, _ 0.0023409, 0.0026704, 0.0029941, 0.0033084, 0.0036192, 0.0039087, 0.004185, 0.004452, _ 0.0047201, 0.0049841, 0.0052317, 0.0054743, 0.0057166, 0.0059519, 0.0061868, 0.0064144, _ 0.0066349, 0.0068421, 0.0070524, 0.0072456, 0.0074504, 0.0076585, 0.0078547, 0.0080559, _ 0.008257, 0.0084583, 0.008659, 0.0088534, 0.0090505, 0.0092509, 0.009449, 0.0096518, _ 0.0098583, 0.010059, 0.0102598, 0.0104677, 0.0106834, 0.0108965, 0.0111082, 0.011327, _ 0.0115495, 0.0117846, 0.0120064, 0.0122311, 0.0124654, 0.0126992, 0.012939, 0.0131741, _ 0.0134233, 0.0136713, 0.0139168, 0.0141651, 0.0144222, 0.0146873, 0.0149495, 0.0151995, _ 0.0154422, 0.0157411, 0.0160605, 0.0163968, 0.016739, 0.0171108, 0.0174936, 0.0179025, _ 0.0183001, 0.0187207, 0.0191676, 0.0196916, 0.0202712, 0.020935, 0.0216796, 0.0224958, _ 0.0234398, 0.0245279, 0.0257028, 0.0271186, 0.0287809, 0.0305894, 0.0327718, 0.0357067, _ 0.0381654, 0.0430359, 0.0505802, 0.0627515, 0.0829224, 0.1232175, 0.2380787, 0.5) For h = 1 To m_hcount h_wealth_InterestDividends(h) = 0 If i_abroad(h) = 0 And h_wealth_financial(h) > 0 Then rand = Rnd ' Vector index idx = Int(rand * 100) + 1 ' Coefficient for linear interpolation between percentiles step = rand * 100 - Int(rand * 100) ' Simulated rate rate = (perc(idx + 1) - perc(idx)) * step + perc(idx) ' Multiply to household financial wealth to get interest/dividend and add to capital incomes ' of houshold h_wealth_InterestDividends(h) = rate * h_wealth_financial(h) h_inc_capital(h) = h_inc_capital(h) + h_wealth_InterestDividends(h) ' Distribute updated capital income in household Call Individualize_CapitalIncome(h) End If Next End Sub
'************ '*** DEBT *** '************ ' ' GENERAL COMMENTS: ' - Debt is simulated using a sequence of two-step models; random effects probit models to determine ' if a debt exists and random effects GLS models to determine the size of debt. ' What model is used is determined by the existence of a debt in the previous year. ' - The models were estimated by Anders Klevmarken (051212)
Public Sub Debt() status "Debt" Printdok "Debt" Dim h As Long, indnr As Long, indexnr As Long Dim d_realestate As Long, counter As Long Dim xbeta_probit As Double, xbeta_reg As Double, rand As Double, step As Double, eps As Double Dim Logh_debt_lag As Double, price_index As Double Dim idx As Byte, age1629 As Byte, age3045 As Byte, age4560 As Byte, age6075 As Byte, age75110 As Byte Dim status2 As Byte Dim i1629lagdebt As Double Dim i3045lagdebt As Double, i4560lagdebt As Double, i6075lagdebt As Double, i75110lagdebt As Double Dim deltah_rw As Double, delta_rh_fw As Double, rh_cdispl_lag As Double, delta_rh_ctxfvi As Double Dim RR As Double, delta_rr As Double Dim perc_e() As Variant, perc_u() As Variant, e As Double ' Estimated percentiles of error distributions. Model: size of debt for households with debt in ' current and previous year perc_e = Array(-2.2, -1.632522, -1.007908, -0.7560505, -0.6192293, -0.5241597, -0.454412, _ -0.400478, -0.358711, -0.3231894, -0.2931235, -0.2673837, -0.2450861, -0.2253371, -0.2073971, _ -0.1913457, -0.1772474, -0.1641547, -0.1524016, -0.1417225, -0.1317627, -0.1224779, -0.1141163, _ -0.1066449, -0.0996022, -0.0927117, -0.0865191, -0.0806883, -0.075098, -0.0699158, -0.065116, _ -0.0604688, -0.0561389, -0.0518774, -0.047776, -0.0438491, -0.0401088, -0.0365014, -0.0329945, _ -0.0295888, -0.0262408, -0.0229912, -0.0198332, -0.0167651, -0.0137459, -0.0107065, -0.0078083, _ -0.0049119, -0.0020511, 0.0007603, 0.0035904, 0.0064112, 0.0091685, 0.0118417, 0.0146142, _ 0.0173151, 0.0200248, 0.0227895, 0.0254967, 0.0283198, 0.0311611, 0.0340057, 0.0369369, _ 0.0399351, 0.0430707, 0.0463993, 0.0497726, 0.0534281, 0.0572134, 0.0613387, 0.0656905, _ 0.0703702, 0.0753817, 0.0810533, 0.0869354, 0.0932957, 0.1002605, 0.1078832, 0.1158744, _ 0.1246694, 0.1341129, 0.1443089, 0.1553145, 0.1675002, 0.1811624, 0.1965761, 0.2136929, _ 0.2334746, 0.2573978, 0.2850099, 0.3167633, 0.3553287, 0.4014091, 0.4567597, 0.5244744, _ 0.6097819, 0.7250075, 0.8829827, 1.114082, 1.510042, 2) perc_u = Array(-1, -0.8749997, -0.6166773, -0.488258, -0.407067, -0.34686, -0.3038039, _ -0.2688512, -0.2402866, -0.2165039, -0.1946903, -0.1767283, -0.1599892, -0.1449258, _ -0.1315351, -0.1190557, -0.1077046, -0.0981968, -0.0888983, -0.0802948, -0.0719454, _ -0.0640536, -0.0564454, -0.0496878, -0.0430818, -0.0368938, -0.0311154, -0.0257504, _ -0.0205458, -0.0154601, -0.0106823, -0.0060852, -0.001522, 0.0028653, 0.006739, 0.0107209, _ 0.0144825, 0.0182207, 0.0217987, 0.0251303, 0.0285471, 0.0318606, 0.0350793, 0.0381505, _ 0.0409789, 0.0439487, 0.0469046, 0.0497719, 0.0526802, 0.0554203, 0.0581723, 0.0608584, _ 0.0635435, 0.0660971, 0.0686847, 0.0712259, 0.0737859, 0.0764464, 0.0789677, 0.0814786, _ 0.0839959, 0.086488, 0.0890822, 0.0916751, 0.0943416, 0.0969111, 0.0994646, 0.102216, _ 0.1047953, 0.1075061, 0.1104328, 0.1135218, 0.1165278, 0.1197155, 0.1228448, 0.1261009, _ 0.1294303, 0.1330314, 0.1367077, 0.1406959, 0.1449014, 0.1493615, 0.1542454, 0.1592097, _ 0.1644052, 0.1704035, 0.1767112, 0.1840147, 0.192242, 0.2011359, 0.2114252, 0.2235294, _ 0.2366007, 0.2521869, 0.2705543, 0.2918376, 0.3171646, 0.349119, 0.3959341, 0.4808748, 0.6) ' Short interest rate (net of inflation) RR = m_interest_short / m_KPI If model_time + base_year = 2000 Then delta_rr = RR - m_interest_short1 Else delta_rr = RR - m_interest_short1 / m_KPI1 End If For h = 1 To m_hcount If h_abroad(h) = 0 Then '*** Calculate covariates ' Age dummies If i_age(h_idx_headofhh(h)) >= 16 And i_age(h_idx_headofhh(h)) < 30 Then _ age1629 = 1 Else age1629 = 0 If i_age(h_idx_headofhh(h)) >= 30 And i_age(h_idx_headofhh(h)) < 45 Then _ age3045 = 1 Else age3045 = 0 If i_age(h_idx_headofhh(h)) >= 45 And i_age(h_idx_headofhh(h)) < 60 Then _ age4560 = 1 Else age4560 = 0 If i_age(h_idx_headofhh(h)) >= 60 And i_age(h_idx_headofhh(h)) < 75 Then _ age6075 = 1 Else age6075 = 0 If i_age(h_idx_headofhh(h)) >= 75 Then age75110 = 1 Else age75110 = 0 ' Civil status If h_n_adults(h) = 2 Then status2 = 0 Else status2 = 1 ' Change in real wealth ' Scaled by 1000SEK in 1999 year prices deltah_rw = h_wealth_real_home(h) + h_wealth_real_other(h) - _ (h_wealth_real_home1(h) + h_wealth_real_other1(h)) deltah_rw = (deltah_rw / 1000) / m_price_change99 ' Change in financial wealth ' Scaled by 1000SEK in 1999 year prices delta_rh_fw = h_wealth_financial(h) - h_wealth_financial1(h) delta_rh_fw = (delta_rh_fw / 1000) / m_price_change99 ' Lagged disposable income ' Scaled by 1000SEK in 1999 year prices rh_cdispl_lag = h_inc_disposable1(h) rh_cdispl_lag = (rh_cdispl_lag / 1000) / m_price_change99 ' Change in taxable income ' Scaled by 1000SEK in 1999 year prices delta_rh_ctxfvi = h_sum_inc_taxable(h) - h_sum_inc_taxable1(h) delta_rh_ctxfvi = (delta_rh_ctxfvi / 1000) / m_price_change99 '*** 1) Households with no debt during the previous year If h_wealth_debt1(h) <= 0 Then '*** Model: random-effects probit for the probability of having a debt ' . *Probability to get a loan if the household did not have one; ' . xtprobit dh_debt age3045 age4560 age6075 age75110 status2 deltah_rw delta_rh_ ' > fw rh_cdispl_lag delta_rh_ctxfvi ' > rr if t>1 & rh_debt_lag==0, re i(bidnrf); ' ' Random-effects probit regression Number of obs = 188536 ' Group variable (i): bidnrf Number of groups = 59976 ' ' Random effects u_i ~ Gaussian Obs per group: min = 1 ' Avg = 3.1 ' max = 4 ' ' Wald chi2(10) = 9645.84 ' Log likelihood = -57830.41 Prob > chi2 = 0.0000 ' ' ------------------------------------------------------------------------------ ' dh_debt | Coef. Std. Err. z P>|z| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' age3045 | -.252183 .0237172 -10.63 0.000 -.2986677 -.2056982 ' age4560 | -.6427651 .0236438 -27.19 0.000 -.6891062 -.5964241 ' age6075 | -1.292196 .0240573 -53.71 0.000 -1.339348 -1.245045 ' age75110 | -2.029838 .026336 -77.07 0.000 -2.081456 -1.97822 ' status2 | -.3758341 .0130081 -28.89 0.000 -.4013295 -.3503387 ' deltah_rw | .0003202 .0000191 16.75 0.000 .0002827 .0003577 ' delta_rh_fw | -.0000144 5.68e-06 -2.53 0.011 -.0000255 -3.22e-06 ' rh_cdispl_~g | .0001062 .0000133 7.96 0.000 .0000801 .0001324 ' delta_rh_c~i | -.0000549 .0000487 -1.13 0.259 -.0001504 .0000405 ' rr | -.2742066 .0102269 -26.81 0.000 -.2942508 -.2541623 ' _cons | .9049433 .0468776 19.30 0.000 .8130649 .9968216 ' -------------+---------------------------------------------------------------- ' /lnsig2u | -.4070438 .0240717 -.4542235 -.3598641 ' -------------+---------------------------------------------------------------- ' sigma_u | .8158523 .0098195 .7968317 .835327 ' rho | .3996212 .0057754 .3883571 .4109925 ' ------------------------------------------------------------------------------ ' Likelihood-ratio test of rho=0: chibar2(01) = 2243.33 Prob >= chibar2 = 0.000 ' Randomize random effects term for "new" households at risk If h_wealth_debt_probit1vc(h) = 0 Then h_wealth_debt_probit1vc(h) = gauss(0, 0.8158523) xbeta_probit = age3045 * -0.252183 + _ age4560 * -0.6427651 + _ age6075 * -1.292196 + _ age75110 * -2.029838 + _ status2 * -0.3758341 + _ deltah_rw * 0.0003202 + _ delta_rh_fw * -0.0000144 + _ rh_cdispl_lag * 0.0001062 + _ delta_rh_ctxfvi * -0.0000549 + _ RR * -0.2742066 + _ 0.9049433 + _ h_wealth_debt_probit1vc(h) 'If h Mod 2 = 0 Then Call Print_to_file("debug_debt1.txt", "N", base_year + model_time, _ PROBIT(xbeta_probit), status2, deltah_rw, delta_rh_fw, rh_cdispl_lag, delta_rh_ctxfvi, RR) ' Determine if debt will be simulated If Rnd < PROBIT(xbeta_probit) Then '*** Model: random effects GLS for the size of the debt ' . xtreg logh_debt age3045 age4560 age6075 age75110 status2 deltah_rw rh_cdispl ' > _lag ' > rr delta_rr ' > if rh_debt>0 & rh_debt_lag==0,re i(bidnrf); ' ' Random-effects GLS regression Number of obs = 21583 ' Group variable (i): bidnrf Number of groups = 20120 ' ' R-sq: within = 0.0350 Obs per group: min = 1 ' between = 0.0627 avg = 1.1 ' overall = 0.0599 max = 2 ' ' Random effects u_i ~ Gaussian Wald chi2(9) = 1377.50 ' corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ' ' ------------------------------------------------------------------------------ ' logh_debt | Coef. Std. Err. z P>|z| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' age3045 | -.3195493 .065004 -4.92 0.000 -.4469548 -.1921439 ' age4560 | -.6601385 .0659832 -10.00 0.000 -.7894633 -.5308138 ' age6075 | -1.258864 .0686488 -18.34 0.000 -1.393413 -1.124315 ' age75110 | -1.848556 .0815654 -22.66 0.000 -2.008421 -1.68869 ' status2 | -.3046791 .0425616 -7.16 0.000 -.3880984 -.2212598 ' deltah_rw | .0009928 .0000526 18.88 0.000 .0008898 .0010959 ' rh_cdispl_~g | .0004495 .0000571 7.88 0.000 .0003377 .0005614 ' rr | -.6097947 .0900257 -6.77 0.000 -.7862418 -.4333476 ' delta_rr | .0721367 .0600092 1.20 0.229 -.0454792 .1897526 ' _cons | 5.192063 .3467835 14.97 0.000 4.51238 5.871746 ' -------------+---------------------------------------------------------------- ' sigma_u | 1.5710742 ' sigma_e | 2.2520348 ' rho | .32736013 (fraction of variance due to u_i) ' ------------------------------------------------------------------------------ ' Randomize random effects term for "new" households at risk If h_wealth_debt_GLS1vc(h) = 0 Then h_wealth_debt_GLS1vc(h) = gauss(0, 1.5710742) xbeta_reg = age3045 * -0.3195493 + _ age4560 * -0.6601385 + _ age6075 * -1.258864 + _ age75110 * -1.848556 + _ status2 * -0.3046791 + _ deltah_rw * 0.0009928 + _ rh_cdispl_lag * 0.0004495 + _ RR * -0.6097947 + _ delta_rr * 0.0721367 + _ 5.192063 + _ h_wealth_debt_GLS1vc(h) + _ gauss(0, 2.2520348) ' NOTE: truncation at 50 millions to prevent overflow If xbeta_reg > Log((50000000 / 1000) / m_price_change99) Then _ xbeta_reg = Log((50000000 / 1000) / m_price_change99) ' Simulated debt (Rescaled to SEK, cumulative price changes since 1999) h_wealth_debt(h) = Exp(xbeta_reg) * 1000 * m_price_change99 'If h Mod 2 = 0 Then Call Print_to_file("debug_debt2.txt", "N", base_year + model_time, _ h_wealth_debt(h), status2, deltah_rw, rh_cdispl_lag, RR, delta_rr) Else h_wealth_debt(h) = 0 End If Else '*** 2) Households with positive debt during the previous year ' Logged lagged debt Logh_debt_lag = Log(h_wealth_debt1(h) / (1000 * m_price_change99)) i1629lagdebt = age1629 * Logh_debt_lag i3045lagdebt = age3045 * Logh_debt_lag i4560lagdebt = age4560 * Logh_debt_lag i6075lagdebt = age6075 * Logh_debt_lag i75110lagdebt = age75110 * Logh_debt_lag '*** Model: random-effects probit for the probability of having a debt ' . *sannolikheten att fortsätta ha skuld; ' . xtprobit dh_debt age3045 age4560 age6075 age75110 i1629lagdebt i3045lagdebt i ' > 4560lagdebt i6075lagdebt i75110lagdebt ' > status2 deltah_rw delta_rh_fw rh_cdispl_lag rr delta_rr ' > if rh_debt_lag>0, re i(bidnrf); ' ' Random-effects probit regression Number of obs = 633616 ' Group variable (i): bidnrf Number of groups = 170037 ' ' Random effects u_i ~ Gaussian Obs per group: min = 1 ' Avg = 3.7 ' max = 4 ' ' Wald chi2(15) = 15754.35 ' Log likelihood = -63941.137 Prob > chi2 = 0.0000 ' ' ------------------------------------------------------------------------------ ' dh_debt | Coef. Std. Err. z P>|z| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' age3045 | -.0773424 .0315178 -2.45 0.014 -.1391162 -.0155685 ' age4560 | -.1883772 .0308683 -6.10 0.000 -.2488779 -.1278765 ' age6075 | -.5061938 .0314836 -16.08 0.000 -.5679006 -.444487 ' age75110 | -.5783564 .0347436 -16.65 0.000 -.6464527 -.5102601 ' i1629lagdebt | .3471621 .0074894 46.35 0.000 .3324832 .3618411 ' i3045lagdebt | .3685064 .0044163 83.44 0.000 .3598505 .3771622 ' i4560lagdebt | .3595495 .0039236 91.64 0.000 .3518595 .3672396 ' i6075lagdebt | .3433604 .0041007 83.73 0.000 .3353231 .3513977 ' i75110lagd~t | .292068 .0056413 51.77 0.000 .2810113 .3031247 ' status2 | -.0884814 .0095803 -9.24 0.000 -.1072583 -.0697044 ' deltah_rw | .0001191 5.21e-06 22.86 0.000 .0001089 .0001294 ' delta_rh_fw | -4.05e-06 2.57e-06 -1.58 0.115 -9.08e-06 9.85e-07 ' rh_cdispl_~g | -5.87e-06 1.78e-06 -3.30 0.001 -9.36e-06 -2.38e-06 ' rr | -.3281657 .0201034 -16.32 0.000 -.3675676 -.2887637 ' delta_rr | .1648704 .0136995 12.03 0.000 .1380199 .1917208 ' _cons | 2.136768 .082629 25.86 0.000 1.974819 2.298718 ' -------------+---------------------------------------------------------------- ' /lnsig2u | -1.34009 .0584108 -1.454573 -1.225607 ' -------------+---------------------------------------------------------------- ' sigma_u | .5116856 .014944 .4832184 .5418297 ' rho | .2074953 .0096051 .1892988 .2269512 ' ------------------------------------------------------------------------------ ' Likelihood-ratio test of rho=0: chibar2(01) = 387.09 Prob >= chibar2 = 0.000 ' Randomize random effects term for "new" households at risk If h_wealth_debt_probit2vc(h) = 0 Then h_wealth_debt_probit2vc(h) = gauss(0, 0.5116856) xbeta_probit = age3045 * -0.0773424 + _ age4560 * -0.1883772 + _ age6075 * -0.5061938 + _ age75110 * -0.5783564 + _ i1629lagdebt * 0.3471621 + _ i3045lagdebt * 0.3685064 + _ i4560lagdebt * 0.3595495 + _ i6075lagdebt * 0.3433604 + _ i75110lagdebt * 0.292068 + _ status2 * -0.0884814 + _ deltah_rw * 0.0001191 + _ delta_rh_fw * -0.00000405 + _ rh_cdispl_lag * -0.00000587 + _ RR * -0.3281657 + _ delta_rr * 0.1648704 + _ 2.136768 + _ h_wealth_debt_probit2vc(h) 'If h Mod 2 = 0 Then Call Print_to_file("debug_debt3.txt", "N", base_year + model_time, _ PROBIT(xbeta_probit), h_wealth_debt1(h), status2, deltah_rw, delta_rh_fw, rh_cdispl_lag, RR, delta_rr) ' Determine if debt will be simulated If Rnd < PROBIT(xbeta_probit) Then '*** Due to severe non-normality of the observed error distribution the error terms '*** are drawn from the estimated error distribution and not from a normal distribution. rand = Rnd idx = Int(rand * 100) + 1 ' Vector index step = rand * 100 - Int(rand * 100) ' Coefficient for linear interpolation between percentiles e = (perc_e(idx + 1) - perc_e(idx)) * step + perc_e(idx) ' Simulated residual ' Randomize random effects term for "new" households at risk If h_wealth_debt_GLS2vc(h) = 0 Then rand = Rnd idx = Int(rand * 100) + 1 step = rand * 100 - Int(rand * 100) h_wealth_debt_GLS2vc(h) = (perc_u(idx + 1) - perc_u(idx)) * step + perc_u(idx) End If '*** Model: random effects GLS for the size of the debt '*** NOTE: it is the log of the ratio between last years debt and the current '*** debt that is estimated! ' > *skuldbelopp om fortsätter att ha skuld; ' . xtreg deltah_logdebt age3045 age4560 age6075 age75110 i1629lagdebt i3045lagde ' > bt i4560lagdebt i6075lagdebt i75110lagdebt ' > deltah_rw rh_cdispl_lag delta_rh_ctxfvi rr delta_rr if rh_debt>0 & rh_debt ' > _lag>10, re i(bidnrf); ' ' Random-effects GLS regression Number of obs = 583688 ' Group variable (i): bidnrf Number of groups = 157016 ' ' R-sq: within = 0.1359 Obs per group: min = 1 ' between = 0.0012 avg = 3.7 ' overall = 0.0144 max = 4 ' ' Random effects u_i ~ Gaussian Wald chi2(14) = 23337.49 ' corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ' ' ------------------------------------------------------------------------------ ' deltah_log~t | Coef. Std. Err. z P>|z| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' age3045 | -.3537891 .0214242 -16.51 0.000 -.3957796 -.3117985 ' age4560 | -.5651263 .0215885 -26.18 0.000 -.6074391 -.5228135 ' age6075 | -.9721283 .0233831 -41.57 0.000 -1.017958 -.9262983 ' age75110 | -1.122363 .0318759 -35.21 0.000 -1.184839 -1.059888 ' i1629lagdebt | -.2209176 .0040826 -54.11 0.000 -.2289195 -.2129158 ' i3045lagdebt | -.1429849 .0015193 -94.11 0.000 -.1459627 -.1400071 ' i4560lagdebt | -.1140345 .0014456 -78.88 0.000 -.1168679 -.1112012 ' i6075lagdebt | -.0609769 .0022637 -26.94 0.000 -.0654136 -.0565401 ' i75110lagd~t | -.0441835 .0050151 -8.81 0.000 -.054013 -.034354 ' deltah_rw | .0000614 1.11e-06 55.14 0.000 .0000593 .0000636 ' rh_cdispl_~g | 5.03e-06 7.66e-07 6.57 0.000 3.53e-06 6.53e-06 ' delta_rh_c~i | 8.34e-06 4.18e-06 2.00 0.046 1.48e-07 .0000165 ' rr | -.0938379 .0033378 -28.11 0.000 -.1003799 -.0872959 ' delta_rr | .041425 .0022538 18.38 0.000 .0370076 .0458423 ' _cons | 1.523352 .0235468 64.69 0.000 1.477201 1.569503 ' -------------+---------------------------------------------------------------- ' sigma_u | .38216933 ' sigma_e | .49174032 ' rho | .37656028 (fraction of variance due to u_i) ' ------------------------------------------------------------------------------ xbeta_reg = age3045 * -0.3537891 + _ age4560 * -0.5651263 + _ age6075 * -0.9721283 + _ age75110 * -1.122363 + _ i1629lagdebt * -0.2209176 + _ i3045lagdebt * -0.1429849 + _ i4560lagdebt * -0.1140345 + _ i6075lagdebt * -0.0609769 + _ i75110lagdebt * -0.0441835 + _ deltah_rw * 0.0000614 + _ rh_cdispl_lag * 0.00000503 + _ delta_rh_ctxfvi * 0.00000834 + _ RR * -0.0938379 + _ delta_rr * 0.041425 + _ 1.523352 + _ h_wealth_debt_GLS2vc(h) + _ e ' NOTE: truncation at 50 millions to prevent overflow If xbeta_reg > Log(50000000 / (h_wealth_debt(h) * m_KPI)) Then _ xbeta_reg = Log(50000000 / (h_wealth_debt(h) * m_KPI)) ' Simulated debt (Rescaled to SEK, Price changes since last year) '*** NOTE: the scale factor of 1000 is cancelled in the ratio between the lagged '*** and current debt. h_wealth_debt(h) = h_wealth_debt(h) * Exp(xbeta_reg) * m_KPI 'If h Mod 2 = 0 Then Call Print_to_file("debug_debt4.txt", "N", base_year + model_time, _ h_wealth_debt(h), h_wealth_debt1(h), deltah_rw, rh_cdispl_lag, delta_rh_ctxfvi, RR, delta_rr) Else h_wealth_debt(h) = 0 End If End If ' Distribute debt in household Call Individualize_Debt(h) Else '*** HOUSHOLDS LIVING ABROAD ARE ASSUMED TO HAVE NO DEBTS (IN SWEDEN) TP050322 h_wealth_debt(h) = 0 End If Next End Sub
'******************** '*** CAPITAL GAIN *** '******************** ' ' GENERAL COMMENTS: ' - Sub CapitalGain simulates capital gains generated from sales of other real estate (i.e. not private ' residence) and shares/bonds etc. Note that capital gains from sales of private residence are handled ' by the administrative routines in Sub TenureChoice. ' - Whether a household has capital gains/losses is simulated using av sequence of (conditional) probit ' models. The actual amount, if positive according to the probit models, is simulated using a robust ' regression approach.
Public Sub CapitalGain() status "Capital gain" Printdok "Capital gain" Dim h As Long, indnr As Long, indexnr As Long Dim xbeta_probit As Double, xbeta_reg As Double, rand As Double, step As Double, eps As Double Dim price_index As Double, drw As Double, dfw As Double, med_grw As Double Dim perc1 As Variant, perc2 As Variant, perc As Variant Dim tempvek1() As Double, tempvek2() As Double, tempvek3() As Double, tempvek4() As Double Dim tempvek5() As Double Dim idx As Byte Dim counter1 As Long, counter2 As Long, counter3 As Long, counter4 As Long, counter5 As Long Dim q_minskr As Variant, q_increasr As Variant, q_minskf As Variant, q_increasf As Variant Dim temp As Variant Dim age3045 As Byte, age4560 As Byte, age6075 As Byte, age75110 As Byte, status2 As Byte Dim minskr_q1 As Byte, minskr_q2 As Byte, minskr_q3 As Byte, minskr_q4 As Byte Dim increasr_q1 As Byte, increasr_q2 As Byte, increasr_q3 As Byte, increasr_q4 As Byte Dim minskf_q1 As Byte, minskf_q2 As Byte, minskf_q3 As Byte, minskf_q4 As Byte Dim increasf_q1 As Byte, increasf_q2 As Byte, increasf_q3 As Byte, increasf_q4 As Byte Dim w18_h_rel As Double Dim GainLoss As Integer ' Gain = 1, Loss = -1 ' Calculation of various quantiles counter1 = 0: counter2 = 0: counter3 = 0: counter4 = 0: counter5 = 0 ReDim tempvek1(1 To m_hcount), tempvek2(1 To m_hcount), tempvek3(1 To m_hcount), _ tempvek4(1 To m_hcount), tempvek5(1 To m_hcount) For h = 1 To m_hcount If h_abroad(h) = 0 Then drw = h_wealth_real_home(h) + h_wealth_real_other(h) - _ (h_wealth_real_home1(h) + h_wealth_real_other1(h)) dfw = h_wealth_financial(h) - h_wealth_financial1(h) If drw < 0 Then counter1 = counter1 + 1 tempvek1(counter1) = drw End If If drw > 0 Then counter2 = counter2 + 1 tempvek2(counter2) = drw End If If dfw < 0 Then counter3 = counter3 + 1 tempvek3(counter3) = dfw End If If dfw > 0 Then counter4 = counter4 + 1 tempvek4(counter4) = dfw End If counter5 = counter5 + 1 tempvek5(counter5) = h_wealth_financial(h) + h_wealth_real_home(h) + _ h_wealth_real_other(h) End If Next ReDim Preserve tempvek1(1 To counter1), tempvek2(1 To counter2), tempvek3(1 To counter3), _ tempvek4(1 To counter4), tempvek5(1 To counter5) temp = arr_Percentile(tempvek1, 25, 50, 75) q_minskr = Array(temp(1, 2), temp(2, 2), temp(3, 2)) temp = arr_Percentile(tempvek2, 25, 50, 75) q_increasr = Array(temp(1, 2), temp(2, 2), temp(3, 2)) temp = arr_Percentile(tempvek3, 25, 50, 75) q_minskf = Array(temp(1, 2), temp(2, 2), temp(3, 2)) temp = arr_Percentile(tempvek4, 25, 50, 75) q_increasf = Array(temp(1, 2), temp(2, 2), temp(3, 2)) med_grw = arr_Percentile(tempvek5, 50)(1, 2) ' Estimated quantiles (MIN, 1, 2, ..., 99, MAX) of residuals from robust regression of ' capital gain (positive values) perc1 = Array(-17645.53, -17645.53, -15440.16, -13831.75, -12937.52, -12226.91, -11658.45, _ -11134.19, -10596.45, -10057.72, -9563.159, -9094.479, -8649.362, -8230.473, -7896.29, _ -7574.753, -7318.493, -7048.616, -6764.846, -6467.34, -6196.564, -5956.864, -5729.793, _ -5499.76, -5282.539, -5073.494, -4858.683, -4630.53, -4414.267, -4225.21, -4051.983, _ -3884.587, -3723.969, -3563.91, -3397.302, -3215.792, -3051.891, -2874.162, -2720.289, _ -2547.869, -2395.248, -2228.408, -2056.876, -1853.211, -1656.344, -1427.533, -1183.443, _ -932.806, -631.2728, -316.3389, 26.61877, 415.165, 821.978, 1252.204, 1692.846, 2193.82, _ 2737.806, 3327.997, 3976.104, 4639.247, 5293.555, 6060.656, 6848.92, 7651.621, 8556.424, _ 9594.382, 10641.4, 11741.83, 12952.97, 14262.69, 15703.46, 17224.94, 18737.52, 20524.97, _ 22409.56, 24447.39, 26670.37, 29053.75, 31659.75, 34614.2, 37864.73, 41714.7, 45731.87, _ 50257.78, 55293.4, 61314.76, 68132.55, 75975.56, 85048.23, 95387.5, 107719.6, 123554.1, _ 143058.8, 165385.9, 195543, 236215, 295900.9, 393952.4, 580808.4, 1129700, 1129700) '997000000) '**************************************************************************************** ' NOTE: THE ESTIMATED MAXIMUM WAS REPLACED BY THE 99:TH PERCENTILE TO AVOID PROBLEMS WITH ' OVERFLOW IN VARIOUS VARIABLES. TP050428 '**************************************************************************************** ' Estimated quantiles (MIN, 1, 2, ..., 99, MAX) or capital loss (positive values). ' NOTE: the estimates are based on data from year 2000. perc2 = Array(0, 4, 7, 11, 16, 22, 28, 35, 44, 50, 59, 69, 78, 88, 100, 112, 124, 140, 153, _ 168, 188, 205, 225, 249, 274, 298.5, 325, 352, 386, 420, 460, 500, 549, 600, 652, 710, 770, _ 835, 904, 980, 1060, 1141, 1242, 1345, 1456, 1553, 1662, 1773, 1894, 2035, 2197, 2347, _ 2500, 2653, 2846, 3060, 3273, 3505, 3754, 4000, 4266, 4543, 4852, 5198, 5566, 5949, 6346, _ 6822, 7336, 7854, 8519, 9087, 9870, 10525, 11344, 12258.5, 13140, 14163, 15300, 16599, _ 17929, 19417, 21080, 23000, 25000, 27300, 29792, 32515, 35119, 38863, 42775, 47616, 53554, _ 61670, 69930, 79975, 95560, 117209, 152274, 243415, 300000) '10600000) '**************************************************************************************** ' NOTE: THE ESTIMATED MAXIMUM WAS REPLACED BY THE AD HOC ESTIMATE 300000 TO AVOID PROBLEMS ' WITH OVERFLOW IN VARIOUS VARIABLES. TP050608 '**************************************************************************************** For h = 1 To m_hcount h_wealth_CapitalGain(h) = 0 ' Households living abroad are not included in the population at risk If h_abroad(h) = 0 Then GainLoss = 0 xbeta_probit = 0 xbeta_reg = 0 eps = 0 drw = h_wealth_real_home(h) + h_wealth_real_other(h) - _ (h_wealth_real_home1(h) + h_wealth_real_other1(h)) dfw = h_wealth_financial(h) - h_wealth_financial1(h) ' Dummy variables for quartiles of decrease of real wealth minskr_q1 = 0: minskr_q2 = 0: minskr_q3 = 0: minskr_q4 = 0 If drw < 0 Then Select Case drw Case Is <= q_minskr(1) minskr_q1 = 1 Case Is <= q_minskr(2) minskr_q2 = 1 Case Is <= q_minskr(3) minskr_q3 = 1 Case Else minskr_q4 = 1 End Select End If ' Dummy variables for quartiles of increase of real wealth increasr_q1 = 0: increasr_q2 = 0: increasr_q3 = 0: increasr_q4 = 0 If drw > 0 Then Select Case drw Case Is <= q_increasr(1) increasr_q1 = 1 Case Is <= q_increasr(2) increasr_q2 = 1 Case Is <= q_increasr(3) increasr_q3 = 1 Case Else increasr_q4 = 1 End Select End If ' Dummy variables for quartiles of decrease of financial wealth minskf_q1 = 0: minskf_q2 = 0: minskf_q3 = 0: minskf_q4 = 0 If dfw < 0 Then Select Case dfw Case Is <= q_minskf(1) minskf_q1 = 1 Case Is <= q_minskf(2) minskf_q2 = 1 Case Is <= q_minskf(3) minskf_q3 = 1 Case Else minskf_q4 = 1 End Select End If ' Dummy variables for quartiles of increase of financial wealth increasf_q1 = 0: increasf_q2 = 0: increasf_q3 = 0: increasf_q4 = 0 If dfw > 0 Then Select Case dfw Case Is <= q_increasf(1) increasf_q1 = 1 Case Is <= q_increasf(2) increasf_q2 = 1 Case Is <= q_increasf(3) increasf_q3 = 1 Case Else increasf_q4 = 1 End Select End If ' Household gross wealth / median If med_grw > 0 Then w18_h_rel = (h_wealth_financial(h) + h_wealth_real_home(h) + _ h_wealth_real_other(h)) / med_grw Else w18_h_rel = 1 End If ' Age dummies If i_age(h_idx_headofhh(h)) >= 30 And i_age(h_idx_headofhh(h)) < 45 Then _ age3045 = 1 Else age3045 = 0 If i_age(h_idx_headofhh(h)) >= 45 And i_age(h_idx_headofhh(h)) < 60 Then _ age4560 = 1 Else age4560 = 0 If i_age(h_idx_headofhh(h)) >= 60 And i_age(h_idx_headofhh(h)) < 75 Then _ age6075 = 1 Else age6075 = 0 If i_age(h_idx_headofhh(h)) >= 75 Then age75110 = 1 Else age75110 = 0 ' Civil status If h_n_adults(h) = 2 Then status2 = 1 Else status2 = 0 '*** Model 1: probability for household to have capital gains ' Probit estimates Number of obs = 245166 ' LR chi2(22) = 63378.64 ' Prob > chi2 = 0.0000 ' Log likelihood = -122636.78 Pseudo R2 = 0.2053 ' ' kv_h_dum Coef. Std. Err. z P>z [95% Conf. Interval] ' ' age3045 -.1440055 .0114272 -12.60 0.000 -.1664024 -.1216086 ' age4560 -.1989093 .0118569 -16.78 0.000 -.2221483 -.1756702 ' age6075 -.3066655 .0127376 -24.08 0.000 -.3316308 -.2817002 ' age75110 -.6224601 .0135169 -46.05 0.000 -.6489526 -.5959675 ' status2 .1807977 .0068127 26.54 0.000 .167445 .1941504 ' minskr_q1 .0901286 .0223211 4.04 0.000 .04638 .1338771 ' minskr_q2 .1890305 .0215274 8.78 0.000 .1468375 .2312235 ' minskr_q3 .2886676 .0208217 13.86 0.000 .2478578 .3294773 ' minskr_q4 .2734998 .0212696 12.86 0.000 .2318121 .3151874 ' increasr_q1 .1367444 .0098005 13.95 0.000 .1175358 .155953 ' increasr_q2 .1779301 .0098689 18.03 0.000 .1585875 .1972727 ' increasr_q3 .2154224 .0099847 21.58 0.000 .1958527 .2349921 ' increasr_q4 .1978226 .0106195 18.63 0.000 .1770088 .2186364 ' minskf_q1 1.689139 .0169398 99.71 0.000 1.655937 1.72234 ' minskf_q2 1.897959 .0169656 111.87 0.000 1.864707 1.931211 ' minskf_q3 2.07617 .0170613 121.69 0.000 2.042731 2.10961 ' minskf_q4 2.360297 .0174826 135.01 0.000 2.326031 2.394562 ' increasf_q1 1.18399 .0165008 71.75 0.000 1.151649 1.216331 ' increasf_q2 1.386444 .0163517 84.79 0.000 1.354396 1.418493 ' increasf_q3 1.585335 .0163046 97.23 0.000 1.553378 1.617291 ' increasf_q4 2.041392 .0165617 123.26 0.000 2.008931 2.073852 ' w18_h_rel .0390131 .0010258 38.03 0.000 .0370026 .0410236 ' _cons -2.120182 .015595 -135.95 0.000 -2.150747 -2.089616 xbeta_probit = age3045 * -0.1440055 + _ age4560 * -0.1989093 + _ age6075 * -0.3066655 + _ age75110 * -0.6224601 + _ status2 * 0.1807977 + _ minskr_q1 * 0.0901286 + _ minskr_q2 * 0.1890305 + _ minskr_q3 * 0.2886676 + _ minskr_q4 * 0.2734998 + _ increasr_q1 * 0.1367444 + _ increasr_q2 * 0.1779301 + _ increasr_q3 * 0.2154224 + _ increasr_q4 * 0.1978226 + _ minskf_q1 * 1.689139 + _ minskf_q2 * 1.897959 + _ minskf_q3 * 2.07617 + _ minskf_q4 * 2.360297 + _ increasf_q1 * 1.18399 + _ increasf_q2 * 1.386444 + _ increasf_q3 * 1.585335 + _ increasf_q4 * 2.041392 + _ w18_h_rel * 0.0390131 + _ -2.120182 If Rnd < PROBIT(xbeta_probit) Then GainLoss = 1 '*** Model 2: robust regression of positive capital gain (conditional on model 1) ' Robust regression estimates Number of obs = 79308 ' f(22, 79285) = 683.03 ' Prob > F = 0.0000 ' ' kv_h Coef. Std. Err. t P>t [95% Conf. Interval] ' ' age3045 -238.4565 189.3444 -1.26 0.208 -609.5703 132.6573 ' age4560 392.1105 194.3119 2.02 0.044 11.26044 772.9606 ' age6075 1648.064 206.4034 7.98 0.000 1243.515 2052.613 ' age75110 2251.644 228.7761 9.84 0.000 1803.244 2700.044 ' status2 333.4027 109.9376 3.03 0.002 117.9256 548.8797 ' minskr_q1 868.964 363.5725 2.39 0.017 156.3641 1581.564 ' minskr_q2 964.6446 329.6812 2.93 0.003 318.4716 1610.818 ' minskr_q3 1645.858 299.5983 5.49 0.000 1058.647 2233.068 ' minskr_q4 950.9883 285.0727 3.34 0.001 392.2476 1509.729 ' increasr_q1 822.737 160.8923 5.11 0.000 507.389 1138.085 ' increasr_q2 949.6092 157.9007 6.01 0.000 640.1247 1259.094 ' increasr_q3 1109.311 155.3954 7.14 0.000 804.7369 1413.885 ' increasr_q4 1228.793 153.5134 8.00 0.000 927.9078 1529.679 ' minskf_q1 -5040.226 450.9957 -11.18 0.000 -5924.175 -4156.277 ' minskf_q2 -1262.763 447.1163 -2.82 0.005 -2139.108 -386.4176 ' minskf_q3 4183.652 444.9242 9.40 0.000 3311.603 5055.701 ' minskf_q4 8891.106 442.7793 20.08 0.000 8023.262 9758.951 ' increasf_q1 -4805.437 456.4842 -10.53 0.000 -5700.143 -3910.731 ' increasf_q2 -3336.774 449.3189 -7.43 0.000 -4217.437 -2456.112 ' increasf_q3 -1394.294 444.9705 -3.13 0.002 -2266.433 -522.1542 ' increasf_q4 1935.805 440.207 4.40 0.000 1073.002 2798.607 ' w18_h .0003325 8.68e-06 38.29 0.000 .0003155 .0003495 ' _cons 7577.536 439.412 17.24 0.000 6716.291 8438.781 '*** NOTE: variable w18_h changed to w18_h_rel and corresponding parameter '*** estimate to 177.1429 xbeta_reg = age3045 * -238.4565 + _ age4560 * 392.1105 + _ age6075 * 1648.064 + _ age75110 * 2251.644 + _ status2 * 333.4027 + _ minskr_q1 * 868.964 + _ minskr_q2 * 964.6446 + _ minskr_q3 * 1645.858 + _ minskr_q4 * 950.9883 + _ increasr_q1 * 822.737 + _ increasr_q2 * 949.6092 + _ increasr_q3 * 1109.311 + _ increasr_q4 * 1228.793 + _ minskf_q1 * -5040.226 + _ minskf_q2 * -1262.763 + _ minskf_q3 * 4183.652 + _ minskf_q4 * 8891.106 + _ increasf_q1 * -4805.437 + _ increasf_q2 * -3336.774 + _ increasf_q3 * -1394.294 + _ increasf_q4 * 1935.805 + _ w18_h_rel * 177.1429 + _ 7577.536 ' Estimated residual distribution perc = perc1 Else '*** Model 3: probability for household to have a capital loss given that it does not '*** have a capital gain (from model 1). ' Probit estimates Number of obs = 165856 ' LR chi2(22) = 7793.75 ' Prob > chi2 = 0.0000 ' Log likelihood = -36001.963 Pseudo R2 = 0.0977 ' ' kf_h_dum Coef. Std. Err. z P>z [95% Conf. Interval] ' ' age3045 -.0550954 .017324 -3.18 0.001 -.0890499 -.021141 ' age4560 -.2074531 .0184964 -11.22 0.000 -.2437054 -.1712009 ' age6075 -.4456731 .0212128 -21.01 0.000 -.4872495 -.4040967 ' age75110 -.7957554 .0245258 -32.45 0.000 -.8438251 -.7476857 ' status2 .0372817 .0114286 3.26 0.001 .0148822 .0596813 ' minskr_q1 .2157006 .0354344 6.09 0.000 .1462504 .2851509 ' minskr_q2 .2825435 .0350301 8.07 0.000 .2138857 .3512013 ' minskr_q3 .3245342 .0350899 9.25 0.000 .2557592 .3933092 ' minskr_q4 .1721921 .0388238 4.44 0.000 .0960987 .2482854 ' increasr_q1 .054609 .0168082 3.25 0.001 .0216654 .0875525 ' increasr_q2 .0641268 .0171499 3.74 0.000 .0305137 .0977399 ' increasr_q3 .0992659 .0173612 5.72 0.000 .0652385 .1332933 ' increasr_q4 .157398 .0182687 8.62 0.000 .1215921 .193204 ' minskf_q1 .7042064 .0238263 29.56 0.000 .6575077 .7509052 ' minskf_q2 .8524911 .0242151 35.20 0.000 .8050304 .8999519 ' minskf_q3 .9660055 .0247467 39.04 0.000 .9175028 1.014508 ' minskf_q4 1.426097 .024946 57.17 0.000 1.377203 1.47499 ' increasf_q1 .6878693 .0203601 33.79 0.000 .6479643 .7277744 ' increasf_q2 .7231771 .0208978 34.61 0.000 .6822182 .764136 ' increasf_q3 .8048313 .0212726 37.83 0.000 .7631377 .8465249 ' increasf_q4 1.043916 .022539 46.32 0.000 .99974 1.088091 ' w18_h_rel .0185019 .0019468 9.50 0.000 .0146862 .0223176 ' _cons -2.130938 .0189599 -112.39 0.000 -2.168099 -2.093778 xbeta_probit = age3045 * -0.0550954 + _ age4560 * -0.2074531 + _ age6075 * -0.4456731 + _ age75110 * -0.7957554 + _ status2 * 0.0372817 + _ minskr_q1 * 0.2157006 + _ minskr_q2 * 0.2825435 + _ minskr_q3 * 0.3245342 + _ minskr_q4 * 0.1721921 + _ increasr_q1 * 0.054609 + _ increasr_q2 * 0.0641268 + _ increasr_q3 * 0.0992659 + _ increasr_q4 * 0.157398 + _ minskf_q1 * 0.7042064 + _ minskf_q2 * 0.8524911 + _ minskf_q3 * 0.9660055 + _ minskf_q4 * 1.426097 + _ increasf_q1 * 0.6878693 + _ increasf_q2 * 0.7231771 + _ increasf_q3 * 0.8048313 + _ increasf_q4 * 1.043916 + _ w18_h_rel * 0.0185019 + _ -2.130938 If Rnd < PROBIT(xbeta_probit) Then GainLoss = -1 '*** Model 4: Capital loss (conditional on model 3) '*** NOTE: no suitable robust regression model was found. Data is drawn directly from '*** the empirical distribution of (nonzero) capital losses. xbeta_reg = 0 ' Estimated "residual" distribution perc = perc2 End If End If ' Realize values from estimated distributions If GainLoss <> 0 Then rand = Rnd ' Vector index idx = Int(rand * 100) + 1 ' Coefficient for linear interpolation between percentiles step = rand * 100 - Int(rand * 100) ' Simulated residual eps = (perc(idx + 1) - perc(idx)) * step + perc(idx) ' Handle simulated capital gains/losses ' NOTE: simulated values (in 2000 year prices) are indexed using cumulative price ' changes since 2000 h_wealth_CapitalGain(h) = GainLoss * (xbeta_reg + eps) * m_price_change00 h_inc_capital(h) = h_inc_capital(h) + h_wealth_CapitalGain(h) ' Redistribute capital income in household Call Individualize_CapitalIncome(h) End If End If 'If h_abroad(h) = 0 Then Next ' For h = 1 To m_hcount End Sub
'********************* '*** DEBT INTEREST *** '********************* ' ' GENERAL COMMENTS: ' - Sub DebtInterest simulated debt interest that is to be deducted from capital income ' before income taxes is calculated. ' - In the first stage a random effects probit model determines whether the household has debt ' interest or not. If household has debt interest the interest is simulated using a random ' effects (GLS) model. This is done separately for households with and without debt interest ' during the previous year. ' NOTE: since buying or selling real estate (own home) can change the household debt ' the lagged value used in the models equals the value after these changes but ' before changes made by simulation (i.e. h_wealth_debt, not h_wealth_debt1).
Public Sub DebtInterest() status "Debt interest" Printdok "Debt interest" Dim counter1 As Long, counter2 As Long, counter3 As Long, counter4 As Long, indnr As Long Dim indexnr As Long, h As Long Dim tempvek1() As Double, tempvek2() As Double, tempvek3() As Double, tempvek4() As Double Dim med_rw As Double, med_hhtaxinc As Double, rand As Double, step As Double, eps As Double Dim med_fw As Double, skuldkvot As Double, relh_rw As Double, relh_ctxfvi As Double Dim med_drw As Double, drw As Double, relh_fw As Double, reldeltah_rw As Double Dim sigma_u As Double, rho As Double, RateIndex As Double Dim xbeta_probit As Double, xbeta_reg As Double, loglagskuldr As Double Dim obestand As Byte, ed1 As Byte, ed2 As Byte, idx As Byte Dim age3045 As Byte, age4560 As Byte, age6075 As Byte, age75110 As Byte, status2 As Byte Dim q_hhtaxinc As Variant, perc As Variant ' Estimated quantiles (MIN, 1, 2, ..., 99, MAX) of residuals from robust regression perc = Array(-10.5136, -7.5483652, -6.90119, -6.6321778, -6.305782, -5.94475, -5.730988, -5.496507, _ -5.2648288, -5.0657671, -4.957182, -4.8627544, -4.76719, -4.3800102, -4.150145, -3.9012855, _ -3.6503852, -3.5739367, -3.5081702, -3.3262253, -3.163464, -2.8849368, -2.5877988, -2.4068454, _ -2.1153776, -1.969675, -1.833475, -1.7092253, -1.5231796, -1.4006537, -1.214721, -1.1190598, _ -1.0370428, -0.9761691, -0.8248536, -0.7747215, -0.7078384, -0.6045345, -0.5271636, -0.440453, _ -0.34926, -0.24405, -0.0654362, 0.05472938, 0.08115028, 0.18016175, 0.27104636, 0.34570687, _ 0.37107952, 0.41155614, 0.4296625, 0.47688281, 0.53068964, 0.58197836, 0.62881736, 0.6608894, _ 0.6994682, 0.73360226, 0.79761176, 0.85839954, 0.9144072, 0.97614816, 1.04676576, 1.0843422, _ 1.09971736, 1.13645035, 1.18058576, 1.20528342, 1.2341836, 1.29908953, 1.3550541, 1.37329286, _ 1.44638688, 1.45794793, 1.48650786, 1.5483815, 1.61496492, 1.66759365, 1.7234054, 1.79005356, _ 1.8677764, 1.92163235, 1.99031, 2.03444297, 2.06540436, 2.13136465, 2.20657406, 2.2861351, _ 2.35050384, 2.49642937, 2.5452392, 2.62466391, 2.88217876, 2.97125151, 3.06841788, 3.29164515, _ 3.42146528, 3.64270188, 3.74074598, 4.75219426, 5.247611) ' Calculation of various quantiles counter1 = 0: counter2 = 0: counter3 = 0: counter4 = 0 ReDim tempvek1(1 To m_hcount), tempvek2(1 To m_hcount), tempvek3(1 To m_hcount), _ tempvek4(1 To m_hcount) For h = 1 To m_hcount If h_abroad(h) = 0 Then ' Real wealth counter1 = counter1 + 1 tempvek1(counter1) = h_wealth_real_home(h) + h_wealth_real_other(h) ' Taxable incomes (household sum) counter2 = counter2 + 1 tempvek2(counter2) = h_sum_inc_taxable(h) ' Financial wealth counter3 = counter3 + 1 tempvek3(counter3) = h_wealth_financial(h) End If Next ReDim Preserve tempvek1(1 To counter1), tempvek2(1 To counter2), tempvek3(1 To counter3) med_rw = arr_Percentile(tempvek1, 50)(1, 2) ' Median real wealth med_fw = arr_Percentile(tempvek3, 50)(1, 2) ' Median financial wealth q_hhtaxinc = arr_Percentile(tempvek2, 25, 50, 75, 90, 95) ' Quantiles of taxable income med_hhtaxinc = q_hhtaxinc(2, 2) ' Median household taxable income ' The ratio between the current short interest and the average short interest in 1999-2002 is ' used for indexation of simulated interest rates RateIndex = m_interest_short / ((parm_macro(1999, 10) + parm_macro(2000, 10) + _ parm_macro(2001, 10) + parm_macro(2002, 10)) / 4) For h = 1 To m_hcount ' Households living abroad is not at risk If h_abroad(h) = 0 Then ' Age dummies If i_age(h_idx_headofhh(h)) >= 30 And i_age(h_idx_headofhh(h)) < 45 Then _ age3045 = 1 Else age3045 = 0 If i_age(h_idx_headofhh(h)) >= 45 And i_age(h_idx_headofhh(h)) < 60 Then _ age4560 = 1 Else age4560 = 0 If i_age(h_idx_headofhh(h)) >= 60 And i_age(h_idx_headofhh(h)) < 75 Then _ age6075 = 1 Else age6075 = 0 If i_age(h_idx_headofhh(h)) >= 75 Then age75110 = 1 Else age75110 = 0 ' Civil status If h_n_adults(h) = 2 Then status2 = 1 Else status2 = 0 ' Educational attainment If i_edlevel(h_idx_headofhh(h)) = 0 Then ed1 = 1 Else ed1 = 0 If i_edlevel(h_idx_headofhh(h)) = 1 Then ed2 = 1 Else ed2 = 0 ' Debt ratio If (h_wealth_financial(h) + h_wealth_real_home(h) + h_wealth_real_other(h) > 0) Then skuldkvot = h_wealth_debt(h) / (h_wealth_financial(h) + h_wealth_real_home(h) + _ h_wealth_real_other(h)) If skuldkvot > 1 Then skuldkvot = 1 Else If h_wealth_debt(h) > 0 Then skuldkvot = 1 Else skuldkvot = 0 End If End If If h_wealth_debt(h) > h_wealth_financial(h) + h_wealth_real_home(h) + h_wealth_real_other(h) Then obestand = 1 Else obestand = 0 End If ' Real wealth / median If med_rw > 0 Then relh_rw = (h_wealth_real_home(h) + h_wealth_real_other(h)) / med_rw Else relh_rw = 1 End If ' Taxable income / median If med_hhtaxinc > 0 Then relh_ctxfvi = h_sum_inc_taxable(h) / med_hhtaxinc Else relh_ctxfvi = 1 End If ' Financial wealth / median If med_fw > 0 Then relh_fw = h_wealth_financial(h) / med_fw Else relh_fw = 1 End If ' Change in real wealth / median of real wealth If med_rw > 0 Then reldeltah_rw = (h_wealth_real_home(h) + h_wealth_real_other(h) - _ (h_wealth_real_home1(h) + h_wealth_real_other1(h))) / med_rw Else reldeltah_rw = 1 End If ' Choice of models is determined by the occurence of debt interest last year If h_wealth_debt_interestrate1(h) > 0 Then '*** Models for households WITH debt interest last year ' 1) Selection by random effects probit ' Random-effects probit Number of obs = 18520 ' Group variable (i) : i Number of groups = 5329 ' ' Random effects u_i ~ Gaussian Obs per group: min = 1 ' Avg = 3.5 ' max = 4 ' ' Wald chi2(12) = 793.88 ' Log likelihood = -3224.6242 Prob > chi2 = 0.0000 ' ' d_skuldranta Coef. Std. Err. z P>z [95% Conf. Interval] ' ' age3045 .6341882 .1071172 5.92 0.000 .4242425 .844134 ' age4560 .7634985 .1121919 6.81 0.000 .5436064 .9833906 ' age6075 .4857018 .1192471 4.07 0.000 .2519817 .7194219 ' age75110 .0002492 .145846 0.00 0.999 -.2856037 .286102 ' ed1 .0815913 .0928089 0.88 0.379 -.1003108 .2634934 ' ed2 .4402071 .0733143 6.00 0.000 .2965137 .5839005 ' status2 -.2035545 .076244 -2.67 0.008 -.3529899 -.054119 ' skuldkvot 5.5443 .2566443 21.60 0.000 5.041286 6.047314 ' obestand -3.88555 .2279271 -17.05 0.000 -4.332279 -3.438821 ' relh_rw .4244935 .0407365 10.42 0.000 .3446514 .5043356 ' relh_fw -.0031601 .0007676 -4.12 0.000 -.0046645 -.0016556 ' relh_ctxfvi .9827117 .07664 12.82 0.000 .8325001 1.132923 ' _cons -.9964717 .1452586 -6.86 0.000 -1.281173 -.7117701 ' ' /lnsig2u .4243733 .1012627 .2259021 .6228445 ' ' sigma_u 1.236379 .0625995 1.119577 1.365366 ' rho .6045293 .0242092 .5562366 .6508652 If h_wealth_debt_interest_varcomp_p(h) = 0 Then _ h_wealth_debt_interest_varcomp_p(h) = gauss(0, 1.236379) xbeta_probit = age3045 * 0.6341882 + _ age4560 * 0.7634985 + _ age6075 * 0.4857018 + _ age75110 * 0.0002492 + _ ed1 * 0.0815913 + _ ed2 * 0.4402071 + _ status2 * -0.2035545 + _ skuldkvot * 5.5443 + _ obestand * -3.88555 + _ relh_rw * 0.4244935 + _ relh_fw * -0.0031601 + _ relh_ctxfvi * 0.9827117 + _ -0.9964717 + _ h_wealth_debt_interest_varcomp_p(h) If Rnd < PROBIT(xbeta_probit) Then ' 2) Debt interest from random effects regression ' Random-effects GLS regression Number of obs = 11954 ' Group variable (i) : i Number of groups = 4247 ' ' R-sq: within = 0.0002 Obs per group: min = 1 ' between = 0.6028 avg = 2.8 ' overall = 0.4520 max = 3 ' ' Random effects u_i ~ Gaussian Wald chi2(9) = 3444.42 ' corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ' ' logskuldr Coef. Std. Err. z P>z [95% Conf. Interval] ' age3045 .3622153 .0499747 7.25 0.000 .2642667 .4601639 ' age4560 .3438514 .0514385 6.68 0.000 .2430337 .4446691 ' age6075 .4020916 .0567729 7.08 0.000 .2908187 .5133645 ' age75110 .4276246 .0843783 5.07 0.000 .2622462 .5930031 ' skuldkvot -.5121762 .0470177 -10.89 0.000 -.6043292 -.4200232 ' obestand -.1043363 .0371539 -2.81 0.005 -.1771567 -.0315159 ' relh_rw -.0405635 .0081581 -4.97 0.000 -.056553 -.024574 ' reldeltah_rw -.1239152 .0136375 -9.09 0.000 -.1506443 -.0971862 ' loglagskuldr .3666306 .0074783 49.03 0.000 .3519733 .3812879 ' _cons -1.871377 .0604057 -30.98 0.000 -1.98977 -1.752985 ' ' sigma_u 0.58070642 ' sigma_e 0.55299879 ' rho .5244253 (fraction of variance due to u_i) If h_wealth_debt_interest_varcomp_r(h) = 0 Then _ h_wealth_debt_interest_varcomp_r(h) = gauss(0, 0.58070642) ' Log of lagged interest rate loglagskuldr = Log(h_wealth_debt_interestrate1(h)) xbeta_reg = age3045 * 0.3622153 + _ age4560 * 0.3438514 + _ age6075 * 0.4020916 + _ age75110 * 0.4276246 + _ skuldkvot * -0.5121762 + _ obestand * -0.1043363 + _ relh_rw * -0.0405635 + _ reldeltah_rw * -0.1239152 + _ loglagskuldr * 0.3666306 + _ -1.871377 + _ h_wealth_debt_interest_varcomp_r(h) + _ gauss(0, 0.55299879) ' The simulated debt interest is multiplied by the current debt and the result is ' subtracted from the capital income h_wealth_debt_interestrate(h) = Exp(xbeta_reg) h_wealth_debt_interestrate(h) = h_wealth_debt_interestrate(h) * RateIndex h_wealth_debt_interestrate(h) = maxi(0, mini(h_wealth_debt_interestrate(h), _ (m_interest_long + m_interest_short) / 200 + 0.15)) h_wealth_debt_interest(h) = h_wealth_debt_interestrate(h) * h_wealth_debt(h) h_inc_capital(h) = h_inc_capital(h) - h_wealth_debt_interest(h) h_wealth_DebtInterest_ind(h) = 1 Else h_wealth_debt_interest(h) = 0 h_wealth_debt_interestrate(h) = 0 h_wealth_DebtInterest_ind(h) = 0 End If Else '*** Models for households WITHOUT debt interest last year ' 1) Selection by random effects probit ' Random-effects probit Number of obs = 2795 ' Group variable (i) : i Number of groups = 1230 ' ' Random effects u_i ~ Gaussian Obs per group: min = 1 ' Avg = 2.3 ' max = 3 ' ' Wald chi2(10) = 208.95 ' Log likelihood = -1266.5118 Prob > chi2 = 0.0000 ' ' d_skuldranta Coef. Std. Err. z P>z [95% Conf. Interval] ' ' age3045 .0371619 .1064698 0.35 0.727 -.1715151 .2458389 ' age4560 -.0261233 .1119289 -0.23 0.815 -.2454999 .1932533 ' age6075 -.3884879 .1241245 -3.13 0.002 -.6317674 -.1452084 ' age75110 -.4257758 .1316724 -3.23 0.001 -.683849 -.1677026 ' ed1 .1066812 .0968515 1.10 0.271 -.0831442 .2965066 ' ed2 .2089397 .0794393 2.63 0.009 .0532415 .3646379 ' skuldkvot 2.455774 .2500278 9.82 0.000 1.965729 2.94582 ' obestand -1.603862 .2263394 -7.09 0.000 -2.047479 -1.160245 ' relh_rw .0682273 .0354059 1.93 0.054 -.001167 .1376217 ' relh_ctxfvi .5124328 .0697655 7.35 0.000 .375695 .6491707 ' _cons -1.409121 .1229242 -11.46 0.000 -1.650048 -1.168194 ' ' /lnsig2u -1.574892 .426881 -2.411563 -.7382205 ' ' sigma_u .4550054 .0971166 .2994579 .6913492 ' rho .1715201 .0606602 .0822952 .3233934 ' ' Likelihood ratio test of rho=0: chibar2(01) = 7.82 Prob >= chibar2 = 0.003 If h_wealth_debt_interest_varcomp_p(h) = 0 Then _ h_wealth_debt_interest_varcomp_p(h) = gauss(0, 0.4550054) xbeta_probit = age3045 * 0.0371619 + _ age4560 * -0.0261233 + _ age6075 * -0.3884879 + _ age75110 * -0.4257758 + _ ed1 * 0.1066812 + _ ed2 * 0.2089397 + _ skuldkvot * 2.455774 + _ obestand * -1.603862 + _ relh_rw * 0.0682273 + _ relh_ctxfvi * 0.5124328 + _ -1.409121 + _ h_wealth_debt_interest_varcomp_p(h) If Rnd < PROBIT(xbeta_probit) Then ' 2) Debt interest from regression ' > rreg logskuldr age3045 age4560 age6075 age75110 ed1 ed2 skuldkvot relh_rw rel ' > h_fw relh_ctxfvi reldeltah_rw if lagskuldranta==0 & skuldranta>0; ' ' Huber iteration 1: maximum difference in weights = .68304844 ' Huber iteration 2: maximum difference in weights = .1178111 ' Huber iteration 3: maximum difference in weights = .04662454 ' Biweight iteration 4: maximum difference in weights = .29165826 ' Biweight iteration 5: maximum difference in weights = .03504769 ' Biweight iteration 6: maximum difference in weights = .01267879 ' Biweight iteration 7: maximum difference in weights = .00606623 ' ' Robust regression estimates Number of obs = 408 ' f(11, 396) = 4.68 ' Prob > F = 0.0000 ' ' ------------------------------------------------------------------------------ ' logskuldr | Coef. Std. Err. t P>|t| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' age3045 | .4000877 .4078325 0.98 0.327 -.4016998 1.201875 ' age4560 | .6203367 .4511762 1.37 0.170 -.2666632 1.507337 ' age6075 | .9068013 .6302284 1.44 0.151 -.3322105 2.145813 ' age75110 | 1.952351 .8817956 2.21 0.027 .2187648 3.685937 ' ed1 | 1.751955 .4768624 3.67 0.000 .8144567 2.689453 ' ed2 | 1.081869 .3296123 3.28 0.001 .4338605 1.729878 ' skuldkvot | -1.34884 .4553077 -2.96 0.003 -2.243962 -.4537176 ' relh_rw | .1486858 .1984496 0.75 0.454 -.2414608 .5388323 ' relh_fw | -.04834 .0223517 -2.16 0.031 -.0922827 -.0043972 ' relh_ctxfvi | .3009336 .315125 0.95 0.340 -.3185934 .9204606 ' reldeltah_rw | .3074559 .4548201 0.68 0.499 -.5867079 1.20162 ' _cons | -5.636688 .556414 -10.13 0.000 -6.730583 -4.542794 ' ------------------------------------------------------------------------------ xbeta_reg = age3045 * 0.4000877 + _ age4560 * 0.6203367 + _ age6075 * 0.9068013 + _ age75110 * 1.952351 + _ ed1 * 1.751955 + _ ed2 * 1.081869 + _ skuldkvot * -1.34884 + _ relh_rw * 0.1486858 + _ relh_fw * -0.04834 + _ relh_ctxfvi * 0.3009336 + _ reldeltah_rw * 0.3074559 + _ -5.636688 rand = Rnd ' Vector index idx = Int(rand * 100) + 1 ' Coefficient for linear interpolation between percentiles step = rand * 100 - Int(rand * 100) ' Simulated residual eps = (perc(idx + 1) - perc(idx)) * step + perc(idx) ' Add randomized error term xbeta_reg = xbeta_reg + eps ' The simulated debt interest is multiplied by the current debt and the result is ' subtracted from the capital income h_wealth_debt_interestrate(h) = Exp(xbeta_reg) h_wealth_debt_interestrate(h) = h_wealth_debt_interestrate(h) * RateIndex h_wealth_debt_interestrate(h) = maxi(0, mini(h_wealth_debt_interestrate(h), _ (m_interest_long + m_interest_short) / 200 + 0.15)) h_wealth_debt_interest(h) = h_wealth_debt_interestrate(h) * h_wealth_debt(h) h_inc_capital(h) = h_inc_capital(h) - h_wealth_debt_interest(h) h_wealth_DebtInterest_ind(h) = 1 Else h_wealth_debt_interest(h) = 0 h_wealth_debt_interestrate(h) = 0 h_wealth_DebtInterest_ind(h) = 0 End If End If ' If h_wealth_DebtInterest_ind1(h) = 1 Then ' Redistribute capital income in household Call Individualize_CapitalIncome(h) ' House loan interest is calculated for house owners with positive total debts If h_house_owner(h) = 1 And h_wealth_debt_interest(h) > 0 Then h_house_interest(h) = HouseInterest(i_age(h_idx_headofhh(h)), q_hhtaxinc, h_sum_inc_taxable(h), _ h_wealth_debt_interest(h)) ' House loan interest (net of 30% tax deduction) is added to the house costs. h_house_cost(h) = h_house_cost(h) + h_house_interest(h) * 0.7 Else h_house_interest(h) = 0 End If Else ' No debt interest for foreign households h_wealth_debt_interestrate(h) = 0 h_wealth_debt_interest(h) = 0 h_wealth_DebtInterest_ind(h) = 0 h_house_interest(h) = 0 End If ' If h_abroad(h) = 0 Then Next End Sub
'*** Function HouseInterest() returns the share of the total debt interest that '*** is paid for house loans. This is used primarily for calculation of housing costs.
Public Function HouseInterest(ByVal HHMaxAge As Integer, ByVal QTaxInc As Variant, _ ByVal HHTaxInc As Long, ByVal HHDebtInterest) As Long Dim i As Integer, j As Integer Dim rMat As Variant ' Matrix of estimated ratios of house interest to total interest (Lennart Flood, 050323). ' The matrix is indexed by agegroup and quantiles of household taxable income rMat = Array(Array(0.81429, 0.83251, 0.76669, 0.6324, 0.6324, 0.6324), _ Array(0.80309, 0.7976, 0.7195, 0.63269, 0.52063, 0.44197), _ Array(0.77703, 0.76943, 0.71132, 0.63157, 0.51537, 0.41055), _ Array(0.74643, 0.74043, 0.69344, 0.61274, 0.51041, 0.39726), _ Array(0.69136, 0.71034, 0.67984, 0.61756, 0.51329, 0.38796), _ Array(0.64928, 0.69768, 0.67232, 0.61464, 0.53871, 0.41205), _ Array(0.64289, 0.70378, 0.66126, 0.6133, 0.54381, 0.43586), _ Array(0.64915, 0.67612, 0.6531, 0.60678, 0.52941, 0.41262), _ Array(0.69075, 0.69732, 0.66299, 0.60207, 0.51724, 0.42566), _ Array(0.75422, 0.68948, 0.64561, 0.55579, 0.49061, 0.42691), _ Array(0.75, 0.6993, 0.6093, 0.516, 0.44614, 0.36919), _ Array(0.74555, 0.68244, 0.56552, 0.48163, 0.42343, 0.37945), _ Array(0.68979, 0.67456, 0.5385, 0.51754, 0.41241, 0.44699)) ' Index for age group: -24 = 1, 25-29 = 2, ..., 75-79 = 12, 80- = 13 i = maxi(1, mini(13, Int(HHMaxAge / 5) - 3)) ' Index for quantile of household taxable income Select Case (HHTaxInc) Case Is <= QTaxInc(1, 2) j = 1 Case Is <= QTaxInc(2, 2) j = 2 Case Is <= QTaxInc(3, 2) j = 3 Case Is <= QTaxInc(4, 2) j = 4 Case Is <= QTaxInc(5, 2) j = 5 Case Else j = 6 End Select HouseInterest = rMat(i)(j) * HHDebtInterest End Function