Attribute VB_Name = "b02_education" Option Explicit Option Base 1 '**************************************************************************************** ' New routine for education decisions. Handles high school, MAE and university education. ' Based on six different probability models. '**************************************************************************************** '** ' Routine for education decisions. Handles high school, MAE and university education. ' Based on six different probability models. ' Public Sub education() status "Education" Printdok " -- education" Dim i As Long Dim pihat As Double, rndnr As Double, A As Double, B As Double, C As Double Dim q25 As Double Dim q50 As Double Dim q75 As Double Dim changed As Boolean 'To prevent the possibility to change education level 'twice during the same year Call income_quartiles(q25, q50, q75) 'Räknar ut gränserna för inkomstkvartiler Dim antal As Long Dim last_edyears As Integer antal = 0 For i = 1 To m_icount '*** Individuals at risk: living in Sweden, non-disabled and without newborn '*** children (for women) If i_abroad(i) = 0 And i_new_fp(i) <> 1 And (i_status(i) <> 4 Or i_new_fp(i) = -1) _ And (exist_newborn(i_hhnr(i)) = 0 Or i_sex(i) = 1) Then changed = False last_edyears = i_edyears(i) 'The next condition is necessary to make people leave school after 7 years 'of education are reached If i_edlevel(i) = 2 Then i_student(i) = 0 End If 'Thp 020625 i_student(i) sätts till 1 för 16 o 17 åringar, nollas om dom hoppar av If i_age(i) = 16 And model_time = 1 Then i_student(i) = 1 If i_age(i) = 17 And model_time = 1 Then i_edyears(i) = 1 i_student(i) = 1 pihat = Ed_Mod1(i, q25, q50, q75) 'probability of dropout pihat = 1 - Abs((pihat - 1)) ^ (1 / 3) 'Annual probability of dropout, see separate paper '*** Randomize from multinomial - see documentation for Model 1 *** rndnr = Rnd A = (1 - pihat) ^ 3 B = pihat C = pihat * (1 - pihat) If rndnr < (A + B) Then i_hsdropout(i) = 0 If rndnr >= (A + B) And rndnr < (A + B + C) Then i_hsdropout(i) = 17 If rndnr >= (A + B + C) Then i_hsdropout(i) = 18 End If If i_age(i) = 18 And model_time = 1 Then i_edyears(i) = 2 i_student(i) = 1 pihat = Ed_Mod1(i, q25, q50, q75) 'probability of dropout pihat = 1 - Abs((pihat - 1)) ^ (1 / 3) 'Annual probability of dropout, see separate paper '*** Randomize from multinomial - see documentation for Model 1 *** rndnr = Rnd A = (1 - pihat) ^ 3 B = pihat C = pihat * (1 - pihat) If rndnr < (A + B + C) Then i_hsdropout(i) = 0 If rndnr >= (A + B + C) Then i_hsdropout(i) = 18 End If If i_age(i) = 19 And model_time = 1 Then i_edyears(i) = 3 i_edlevel(i) = 1 i_student(i) = 0 End If '*** Removed temporary - check before permanent removal ' '*** edlevel 1 is assumed to be reached after one year of studies at the MAE. ' If i_student(i) = 2 And model_time = 1 Then ' i_edlevel(i) = 1 ' End If '** 'Model 1 - dropout from high school *** If i_age(i) = 16 Then pihat = Ed_Mod1(i, q25, q50, q75) 'probability of dropout pihat = 1 - Abs((pihat - 1)) ^ (1 / 3) 'Annual probability of dropout, see separate paper '*** Randomize from multinomial - see documentation for Model 1 *** rndnr = Rnd A = (1 - pihat) ^ 3 B = pihat C = pihat * (1 - pihat) If rndnr < A Then i_hsdropout(i) = 0 If rndnr >= A And rndnr < (A + B) Then i_hsdropout(i) = 16 If rndnr >= (A + B) And rndnr < (A + B + C) Then i_hsdropout(i) = 17 If rndnr >= (A + B + C) Then i_hsdropout(i) = 18 End If '*** timing of dropout *** If i_age(i) >= 16 And i_age(i) <= 18 And changed = False Then If i_age(i) = 16 Then i_student(i) = 1 If i_age(i) = i_hsdropout(i) Or i_student(i) = 0 Then i_student(i) = 0 Else i_edyears(i) = i_edyears(i) + 1 End If changed = True End If '*** Model 2 - continue to university from high school *** '*** NOTE: THIS MODEL IS ALIGNED - SEE MODEL DEFINITION '*** NOTE2: THE SECOND CONDITION REFERS TO BIRTH COHORT 1980 OF WHICH SOME ARE '*** MISSCLASIFIED AS KOMVUX STUDENTS IN BASE DATA. If (i_age(i) = 19 And i_edlevel(i) = 1 And changed = False) Or _ (model_time = 1 And i_age(i) = 20 And i_student(i) = 2 And changed = False) Then pihat = Ed_Mod2(i) rndnr = Rnd If rndnr < pihat Then i_student(i) = 3 i_edyears(i) = i_edyears(i) + 1 Else i_student(i) = 0 End If changed = True End If '*** Model 3 - dropout university studies (or continue) *** '*** NOTE: THIS MODEL IS ALIGNED - SEE MODEL DEFINITION If i_age(i) >= 20 And i_student(i) = 3 And i_edlevel(i) < 2 And changed = False Then pihat = Ed_Mod3(i) rndnr = Rnd If rndnr > pihat Then i_edyears(i) = i_edyears(i) + 1 Else i_student(i) = 0 End If changed = True End If '*** Model 4 - from labor market to university *** '*** NOTE: THIS MODEL IS ALIGNED - SEE MODEL DEFINITION If i_age(i) >= 20 And i_edlevel(i) = 1 And i_student(i) = 0 And changed = False Then pihat = Ed_Mod4(i) rndnr = Rnd If rndnr < pihat Then i_student(i) = 3 i_edyears(i) = i_edyears(i) + 1 changed = True End If End If '*** Model 5 - from labor market to MAE *** If i_age(i) >= 20 And i_age(i) <= 64 And i_edlevel(i) = 0 And _ i_student(i) = 0 And changed = False Then pihat = Ed_Mod5(i) rndnr = Rnd If rndnr < pihat Then i_student(i) = 2 i_edyears(i) = i_edyears(i) + 1 changed = True End If End If '*** Continue one additional year of MAE *** If i_student(i) = 2 And i_edyears(i) < 3 And changed = False Then i_student(i) = 2 i_edyears(i) = i_edyears(i) + 1 changed = True End If '*** Model 6 - continue to university from MAE *** '*** NOTE: THIS MODEL IS ALIGNED - SEE MODEL DEFINITION If i_student(i) = 2 And i_edlevel(i) = 1 And changed = False Then pihat = Ed_Mod6(i) rndnr = Rnd If rndnr < pihat Then i_student(i) = 3 i_edyears(i) = i_edyears(i) + 1 Else i_student(i) = 0 End If changed = True End If '*** Updating the education level variable '*** NOTE: university degrees can be obtained after three or four '*** years of studies. Dropout from the third year is assumed '*** to be the equivalent of getting a degree from a three- '*** year program '*** high school degree If i_edyears(i) = 3 Then i_edlevel(i) = 1 '*** University degree - three years If i_edyears(i) = 7 And i_student(i) = 0 And changed = False Then i_edlevel(i) = 2 End If '*** University degree - four years If i_edyears(i) = 7 Then i_edlevel(i) = 2 Else i_student(i) = 0 '*** if living abroad End If '*** Update the maximum educational attainment of household If i_edlevel(i) > h_max_edlevel(hhnr2index(i_hhnr(i))) Then _ h_max_edlevel(hhnr2index(i_hhnr(i))) = i_edlevel(i) Next i End Sub
'** 'Function for simulating dropout from secondary school. '@param indnr Required. Long '@param q25 Required. Double. Is the first income quartile '@param q50 Required. Double. Is the second income quartile '@param q75 Required. Double. Is the third income quartile ' '@return Double ' '@includesourcecode yes '@author Fredrik Jansson Function Ed_Mod1(ByVal indnr As Long, ByVal q25 As Double, ByVal q50 As Double, ByVal q75 As Double) As Double Const a0 As Single = -1.2344 'Intercept Const a1 As Single = 0.3658 'Sex: male Const a2 As Single = 0.4092 'Parents education: basic school Const a3 As Single = 0.211 'Parents education: high-school Const a4 As Single = 0.295 'Parents age: -39 Const a5 As Single = -0.0494 'Parents age: 40-49 Const a6 As Single = -0.4371 'Nationality: Swedish Const a7 As Single = 0.4968 'Parents have divorced Const a8 As Single = 0.2253 'Parents income: lowest quartile Const a9 As Single = -0.0865 'Parents income: second quartile Const a10 As Single = -0.0814 'Parents income: third quartile Const a11 As Single = 0.0751 'Nuber of children (in the family) Dim v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 As Byte Dim ex As Double Dim h_income As Double Dim ed_max Dim age_max v1 = Abs(i_sex(indnr) - 2) 'Kolla så att kön definierats rätt. Här man=1, kvinna=0 ed_max = h_max_edlevel(hhnr2index(i_hhnr(indnr))) If ed_max = 0 Then v2 = 1 Else v2 = 0 If ed_max = 1 Then v3 = 1 Else v3 = 0 age_max = h_max_age(hhnr2index(i_hhnr(indnr))) If age_max < 40 Then v4 = 1 Else v4 = 0 If age_max > 39 And age_max < 50 Then v5 = 1 Else v5 = 0 v6 = Abs(i_born_abroad(indnr) - 1) If h_n_adults(hhnr2index(i_hhnr(indnr))) > 1 Then v7 = 0 Else v7 = 1 h_income = get_hh_sum(indnr, "i_inc_taxable1") If h_income <= q25 Then v8 = 1 Else v8 = 0 If h_income > q25 And h_income <= q50 Then v9 = 1 Else v9 = 0 If h_income > q50 And h_income <= q75 Then v10 = 1 Else v10 = 0 v11 = h_n_child(hhnr2index(i_hhnr(indnr))) 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) Ed_Mod1 = ex / (1 + ex) End Function
Function Ed_Mod2(ByVal indnr As Long) As Double Const a0 As Single = 0.5889 'Intercept Const a1 As Single = -0.3285 'Sex: male Const a2 As Single = -0.9086 'Nationality: Swedish Const a3 As Single = -0.3199 'Living with parents Const a4 As Single = -2.0108 'Having children Const a5 As Single = 0.0114 'Living in a bigger city Const a6 As Single = -0.2725 'Unemployment rate Dim v1, v2, v3, v4, v5 As Byte Dim v6 As Single Dim ex As Double Dim kommun As Integer v1 = Abs(i_sex(indnr) - 2) 'Kolla så att kön definierats rätt. Här man=1, kvinna=0 v2 = Abs(i_born_abroad(indnr) - 1) If i_bvux(indnr) = 0 Then v3 = 1 Else v3 = 0 If i_bvux(indnr) = 1 And h_n_child(hhnr2index(i_hhnr(indnr))) > 0 Then v4 = 1 Else v4 = 0 'Stockholm(17), Göteborg(163), Malmö(115) kommun = h_kommunindex(hhnr2index(i_hhnr(indnr))) If kommun = 17 Or kommun = 163 Or kommun = 115 Then v5 = 1 Else v5 = 0 ' Assumed unemployment rate constant, could be calculated using status ' unemployment and status work. v6 = 4# ex = Exp(a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6) Ed_Mod2 = ex / (1 + ex) '*** Alignment ****************** '*** Due to difficulties in the estimation process the calculated '*** probabilities of dropout generates dropout rates that are not '*** consistent with the historically observed rates. This is solved '*** (temporarily) by a proportional reduction of the calculated '*** probabilities. '*** TP030121 Ed_Mod2 = Ed_Mod2 * 1.5 End Function
Function Ed_Mod3(ByVal indnr As Long) As Double Const a0 As Single = -2.3043 'Intercept Const a1 As Single = 0.0178 'Sex: male Const a2 As Single = -0.1356 'Nationality: Swedish Const a3 As Single = -0.0849 'Single Const a5 As Single = 0.0456 'Age Const a6 As Single = -0.0131 'Children Const a7 As Single = 0.0374 'Living in a bigger city Dim v1, v2, v3, v5, v6, v7 As Byte Dim kommun As Integer Dim ex As Double v1 = Abs(i_sex(indnr) - 2) 'Kolla så att kön definierats rätt. Här man=1, kvinna=0 v2 = Abs(i_born_abroad(indnr) - 1) If h_n_adults(hhnr2index(i_hhnr(indnr))) > 1 Then v3 = 0 Else v3 = 1 v5 = i_age(indnr) v6 = 0 If h_n_child(hhnr2index(i_hhnr(indnr))) > 0 Then v6 = 1 'Stockholm(17), Göteborg(163), Malmö(115) kommun = h_kommunindex(hhnr2index(i_hhnr(indnr))) If kommun = 17 Or kommun = 163 Or kommun = 115 Then v7 = 1 Else v7 = 0 ex = Exp(a0 + a1 * v1 + a2 * v2 + a3 * v3 + a5 * v5 + a6 * v6 + a7 * v7) Ed_Mod3 = ex / (1 + ex) '*** Alignment ****************** '*** Due to difficulties in the estimation process the calculated '*** probabilities of dropout generates dropout rates that are not '*** consistent with the historically observed rates. This is solved '*** (temporarily) by a proportional reduction of the calculated '*** probabilities. '*** TP030121 Ed_Mod3 = Ed_Mod3 * 0.3 End Function
Function Ed_Mod4(ByVal indnr As Long) As Double Const a0 As Single = -0.2534 'Intercept Const a1 As Single = -0.7925 'Sex: male Const a2 As Single = -0.7769 'Nationality: Swedish Const a3 As Single = 0.071 'GDP growth rate Const a4 As Single = 0.000167 'Years after high-school exam Const a5 As Single = -0.096 'Age Const a6 As Single = -0.025 'Single Const a7 As Single = 0.0376 'Number of children Const a8 As Single = 0.0641 'Single*number of children Dim v1 As Byte, v2 As Byte, v4 As Byte, v5 As Byte, v6 As Byte Dim v7 As Byte, v8 As Byte Dim v3 As Single Dim ex As Double v1 = Abs(i_sex(indnr) - 2) 'Kolla så att kön definierats rätt. Här man=1, kvinna=0 v2 = Abs(i_born_abroad(indnr) - 1) v3 = 2# v5 = i_age(indnr) v4 = v5 - 18 If h_n_adults(hhnr2index(i_hhnr(indnr))) > 1 Then v6 = 0 Else v6 = 1 v7 = h_n_child(hhnr2index(i_hhnr(indnr))) v8 = v6 * v7 ex = Exp(a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + a7 * v7 + a8 * v8) Ed_Mod4 = ex / (1 + ex) '*** Alignment *** '*** TP030130 Ed_Mod4 = Ed_Mod4 * 1.3 End Function
Function Ed_Mod5(ByVal indnr As Long) As Double Const a0 As Single = 0.9625 'Intercept Const a1 As Single = -0.7617 'Sex: male Const a2 As Single = -0.4172 'Nationality: Swedish Const a3 As Single = 0.00495 'GDP growth rate Const a4 As Single = -0.00012 'Years after high-school exam Const a5 As Single = -0.1282 'Age Const a6 As Single = 0.1298 'Single Const a7 As Single = 0.1372 'Number of children Const a8 As Single = 0.2265 'Single*number of children Dim v1 As Byte, v2 As Byte Dim v3 As Single Dim v4 As Byte, v5 As Byte, v6 As Byte, v7 As Byte, v8 As Byte Dim ex As Double v1 = Abs(i_sex(indnr) - 2) 'Kolla så att kön definierats rätt. Här man=1, kvinna=0 v2 = Abs(i_born_abroad(indnr) - 1) v3 = 2# v5 = i_age(indnr) v4 = v5 - 18 If h_n_adults(hhnr2index(i_hhnr(indnr))) > 1 Then v6 = 0 Else v6 = 1 v7 = h_n_child(hhnr2index(i_hhnr(indnr))) v8 = v6 * v7 ex = Exp(a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + a7 * v7 + a8 * v8) Ed_Mod5 = ex / (1 + ex) End Function
Function Ed_Mod6(ByVal indnr As Long) As Double Const a0 As Single = 0.7146 'Intercept Const a1 As Single = 0.1996 'Sex: male Const a2 As Single = -0.4163 'Nationality: Swedish Const a3 As Single = -0.1282 'Age Const a4 As Single = -0.7074 'Single Const a5 As Single = -0.3589 'Number of children Const a6 As Single = -0.4571 'Single*number of children Const a7 As Single = -0.366 'Living in a bigger city Const a8 As Single = -0.0544 'GDP Growth Dim v1 As Byte, v2 As Byte, v3 As Byte, v4 As Byte, v5 As Byte Dim v6 As Byte, v7 As Byte Dim v8 As Single Dim ex As Double Dim kommun As Integer v1 = Abs(i_sex(indnr) - 2) 'Kolla så att kön definierats rätt. Här man=1, kvinna=0 v2 = Abs(i_born_abroad(indnr) - 1) v3 = i_age(indnr) If h_n_adults(hhnr2index(i_hhnr(indnr))) > 1 Then v4 = 0 Else v4 = 1 v5 = h_n_child(hhnr2index(i_hhnr(indnr))) v6 = v4 * v5 'Stockholm(17), Göteborg(163), Malmö(115) kommun = h_kommunindex(hhnr2index(i_hhnr(indnr))) If kommun = 17 Or kommun = 163 Or kommun = 115 Then v7 = 1 Else v7 = 0 v8 = 2# 'm_realwage 'Assuming that GDP Growth and real wage growth are the same for the time _ being. ex = Exp(a0 + a1 * v1 + a2 * v2 + a3 * v3 + a4 * v4 + a5 * v5 + a6 * v6 + a7 * v7 + a8 * v8) Ed_Mod6 = ex / (1 + ex) '*** Alignment ****************** '*** Due to difficulties in the estimation process the calculated '*** probabilities of dropout generates dropout rates that are not '*** consistent with the historically observed rates. This is solved '*** (temporarily) by a proportional reduction of the calculated '*** probabilities. '*** TP030121 Ed_Mod6 = Ed_Mod6 * 1.5 End Function
'Subrutinen räknar ut kvartilinkomster. Public Sub income_quartiles(ByRef q25 As Double, ByRef q50 As Double, ByRef q75 As Double) ReDim h_income(1 To m_hcount) As Double Dim hhnr As Long Dim inr As Long Dim perc() As Double For hhnr = 1 To m_hcount inr = indnr2index(h_first_indnr(hhnr)) h_income(hhnr) = h_max_inc_taxable(hhnr) Next perc = arr_Percentile(h_income, 25, 50, 75) q25 = perc(1, 2) q50 = perc(2, 2) q75 = perc(3, 2) End Sub
'*** Imputation of educational attainment for elderly. '*** The 1999 panel of the LINDA database contains educational attainment for ages up to 75. By '*** using historical data educational attainment is retrieved for individuals up to 82 years of '*** age. From ages 83 educational attainment is imputed using multinomial logit models. '*** The imputation models were estimated by Anders Klevmarken 051212. '*** NOTE: a corresponding imputation is done when producing the SESIM base dataset. The only reason '*** to call Sub ImputeEducation() is therefore if one wishes to study the Monte Carlo contribution '*** of the imputation. TP 051212 Public Sub ImputeEducation() Dim i As Long Dim xbeta(3) As Double, prob(3) As Double, DENOM As Double For i = 1 To m_icount '*** Population at risk: individuals living in sweden above age 82 If i_abroad(i) = 0 And i_age(i) >= 83 Then '*** Separate models for men and women If i_sex(i) = 1 Then ' . mlogit i_edlevel i_age i_age_sq i_inc_taxable i_tax_wealth if i_abroad==0 & i ' > _age>39 & i_age<=75 & i_sex==1; ' ' Iteration 0: Log likelihood = -22796.601 ' Iteration 1: Log likelihood = -21113.08 ' Iteration 2: Log likelihood = -20945.143 ' Iteration 3: Log likelihood = -20933.789 ' Iteration 4: Log likelihood = -20933.331 ' Iteration 5: Log likelihood = -20933.33 ' ' Multinomial logistic regression Number of obs = 21222 ' LR chi2(8) = 3726.54 ' Prob > chi2 = 0.0000 ' Log likelihood = -20933.33 Pseudo R2 = 0.0817 ' ' ------------------------------------------------------------------------------ ' i_edlevel | Coef. Std. Err. z P>|z| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' 0 | ' i_age | .0844615 .0200658 4.21 0.000 .0451332 .1237898 ' i_age_sq | -.0003582 .0001756 -2.04 0.041 -.0007023 -.0000141 ' i_inc_taxa~e | -3.21e-06 1.58e-07 -20.34 0.000 -3.52e-06 -2.90e-06 ' i_tax_wealth | -.0000202 2.77e-06 -7.29 0.000 -.0000256 -.0000148 ' _cons | -3.008245 .5595866 -5.38 0.000 -4.105015 -1.911476 ' -------------+---------------------------------------------------------------- ' 2 | ' i_age | -.044003 .0229844 -1.91 0.056 -.0890516 .0010457 ' i_age_sq | .0004062 .0002058 1.97 0.048 2.74e-06 .0008096 ' i_inc_taxa~e | 3.98e-06 1.38e-07 28.77 0.000 3.71e-06 4.25e-06 ' i_tax_wealth | 2.03e-06 1.05e-06 1.93 0.054 -3.23e-08 4.08e-06 ' _cons | -.4096329 .624681 -0.66 0.512 -1.633985 .8147193 ' ------------------------------------------------------------------------------ ' (i_edlevel==1 is the base outcome) xbeta(1) = i_age(i) * 0.0844615 + (i_age(i) ^ 2) * -0.0003582 + _ i_inc_taxable(i) * -0.00000321 + i_tax_wealth(i) * -0.0000202 + -3.008245 xbeta(2) = 0 xbeta(3) = i_age(i) * -0.044003 + (i_age(i) ^ 2) * 0.0004062 + _ i_inc_taxable(i) * 0.00000398 + i_tax_wealth(i) * 0.00000203 + -0.4096329 Else ' . mlogit i_edlevel i_age i_age_sq i_inc_taxable i_tax_wealth if i_abroad==0 & i ' > _age>39 & i_age<=75 & i_sex==2; ' ' Iteration 0: Log likelihood = -23332.887 ' Iteration 1: Log likelihood = -20778.731 ' Iteration 2: Log likelihood = -20612.976 ' Iteration 3: Log likelihood = -20609.232 ' Iteration 4: Log likelihood = -20609.214 ' ' Multinomial logistic regression Number of obs = 21614 ' LR chi2(8) = 5447.35 ' Prob > chi2 = 0.0000 ' Log likelihood = -20609.214 Pseudo R2 = 0.1167 ' ' ------------------------------------------------------------------------------ ' i_edlevel | Coef. Std. Err. z P>|z| [95% Conf. Interval] ' -------------+---------------------------------------------------------------- ' 0 | ' i_age | .0128661 .0203252 0.63 0.527 -.0269705 .0527027 ' i_age_sq | .0003296 .0001765 1.87 0.062 -.0000163 .0006756 ' i_inc_taxa~e | -5.00e-06 2.39e-07 -20.95 0.000 -5.47e-06 -4.54e-06 ' i_tax_wealth | -.0000294 4.46e-06 -6.60 0.000 -.0000382 -.0000207 ' _cons | -1.282745 .5700108 -2.25 0.024 -2.399945 -.1655444 ' -------------+---------------------------------------------------------------- ' 2 | ' i_age | .0131296 .0236868 0.55 0.579 -.0332956 .0595549 ' i_age_sq | -.0002081 .0002136 -0.97 0.330 -.0006268 .0002106 ' i_inc_taxa~e | 7.96e-06 2.43e-07 32.77 0.000 7.48e-06 8.43e-06 ' i_tax_wealth | .00002 2.81e-06 7.14 0.000 .0000145 .0000255 ' _cons | -2.04841 .6381236 -3.21 0.001 -3.299109 -.7977111 ' ------------------------------------------------------------------------------ ' (i_edlevel==1 is the base outcome) xbeta(1) = i_age(i) * 0.0128661 + (i_age(i) ^ 2) * 0.0003296 + _ i_inc_taxable(i) * -0.000005 + i_tax_wealth(i) * -0.0000294 + -1.282745 xbeta(2) = 0 xbeta(3) = i_age(i) * 0.0131296 + (i_age(i) ^ 2) * -0.0002081 + _ i_inc_taxable(i) * 0.00000796 + i_tax_wealth(i) * 0.00002 + -2.04841 End If ' Calculation of probabilities DENOM = Exp(xbeta(1)) + Exp(xbeta(2)) + Exp(xbeta(3)) prob(1) = Exp(xbeta(1)) / DENOM prob(2) = Exp(xbeta(2)) / DENOM prob(3) = Exp(xbeta(3)) / DENOM ' Randomization of educational attainment Select Case Rnd Case Is <= prob(1) i_edlevel(i) = 0 Case Is <= prob(1) + prob(2) i_edlevel(i) = 1 Case Else i_edlevel(i) = 2 End Select End If Next End Sub