Skip to content

1. Key Changes (2018.03.14)

Hyesop edited this page Jul 20, 2018 · 1 revision

1. Correcting age and education data

  1. Data wrangling Downloaded 2010 Census Age and Education in sub-district(dong) scale: Website http://kosis.kr. Downloaded formats were in .txt.
  2. Decomposing structure: Age file was composed of 3 age groups: under 15, 15-64, over 65. Education file was structured as over 6 (kindergarten), primary-school, middle-school, high-school, college, university, masters, Ph.D and higher.
  3. File restructuring: To make the age structure common, we got rid of ages under 6. We didn't transform education in the model but in the plot as a binary format: education less than middle-school, educated more than middle-school.
  4. 1% Sampling: We only considered 1% sample in the model for the sake of simulation speed. The sampled files are stored in the data folder as 2010 census age.csv and 2010 census edu.csv
  • Note: During the data massage, we noticed that there were two sub-districts in the 2010 Census, Cheongnim and Nanhyang, had been integrated to each adjacent admin area in the 2015 census. To avoid any confusion, we dropped these areas in simulation.

2. Version upgrade: Netlogo 5.2.1 -> Netlogo 6.0.2

The previous version of the Netlogo model was 5.2.1, which was running fine. However, we decided to upgrade it to 6.0.2 because there were difficulties opening Netlogo 5 in MacOS and Ubuntu (probably some additional effort to open the programme). A key difference in version 6 [gis] extension was that the '?' marks were all replaced with '(temporary variable -> " ")'. It looks somewhat verbose at the first instance, but soon reads logically.

3. Codes inside

  1. Reduce needless codes: Instead of creating 'create-districtX', 'create-districtY', 'create-districtZ'... that replicated the same process (and verbose indeed!), we used a common command to create and move agents at their age and education, and assigning their residential ID with a new command. [table] extension was used to type lists. Each district was given a name and its admin code.
  2. Age grouping: ID for age groups were given. ID = 0 is age under 15, ID = 1 is age between 15 and 64, and ID = 2 is age over 65.
  3. Road effect tested: if([road] of patch-here = true)[set health health - 0.01] works fine, but the effect is weak.
  4. calc-pm10 codes cleaned: Before looks like
to calc-pm10
ask patches with [gangnam = true][ifelse (ticks >  0) and (ticks <=   90)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
                                [ifelse (ticks >  90) and (ticks <=  180)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
                                [ifelse (ticks > 180) and (ticks <=  270)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
                                [ifelse (ticks > 270) and (ticks <=  360)[set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]
                                [ifelse (ticks > 360) and (ticks <=  450)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
                                [ifelse (ticks > 450) and (ticks <=  540)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
                                [ifelse (ticks > 540) and (ticks <=  630)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
                                [ifelse (ticks > 630) and (ticks <=  720)[set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]
                                [ifelse (ticks > 720) and (ticks <=  810)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
                                [ifelse (ticks > 810) and (ticks <=  900)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
                                [ifelse (ticks > 900) and (ticks <=  990)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
                                [ifelse (ticks > 990) and (ticks <= 1080)[set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]
                                [ifelse (ticks > 1080) and (ticks <= 1170)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
                                [ifelse (ticks > 1170) and (ticks <= 1260)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
                                [ifelse (ticks > 1260) and (ticks <= 1350)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
                                [ifelse (ticks > 1350) and (ticks <= 1440)[set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]
                                [ifelse (ticks > 1440) and (ticks <= 1530)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
                                [ifelse (ticks > 1530) and (ticks <= 1620)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
                                [ifelse (ticks > 1620) and (ticks <= 1710)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
                                [ifelse (ticks > 1710) and (ticks <= 1800)[set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]
                                [stop]]]]]]]]]]]]]]]]]]]]]

inhalation
dong-plot
end

After correction, it looks like

  to calc-pm10
    ask patches with [gangnam = true]
      [ifelse (ticks mod 360 <  90)[set gangnam_sp (random-float (spr_angle / 90) + gangnam_sp)]
    [ifelse (ticks mod 360 >= 90 and ticks mod 360 < 180)[set gangnam_su (random-float (sum_angle / 90) + gangnam_su)]
    [ifelse (ticks mod 360 >= 180 and ticks mod 360 < 270)[set gangnam_au (random-float (aut_angle / 90) + gangnam_au)]
    [set gangnam_wi (random-float (win_angle / 90) + gangnam_wi)]]]]
inhalation
dong-plot
end