; Town-based Accent Formation Model ; hughstimson.org/projects/tafmo ; written for the netlogo 4.0 modeling environment ; variables ; ========================= globals [ atotal ftotal itotal ototal utotal ; used in calculate-vowel-averages a-average f-average i-average o-average u-average ; used in calculate-vowel-averages avg-vowel-SD ; used in avg-vowel-sds a-sd f-sd i-sd o-sd u-sd ; standard deviations of the vowel positions seed ; used so the monitor can display the current seed, except that doesn't work serial# ; used as a surrogate for the buggy seed thing max-dist ; in setup, stores maximum distance across world sv-list ; used in semivariance, stores list of pairwise distances and differences sv-list-a sv-list-f sv-list-i sv-list-o sv-list-u near-diffs far-diffs far-to-near ; used in semivariance to report semivariance outcome length-sv-list ; used in semivariance to report semivariance outcome far-near-index ; used in semivariance to report semivariance outcome moransI-avg ; global autocorrelation statistic from calculate-moransI moransI-a moransI-f moransI-i moransI-o moransI-u expected var Z-a Z-f Z-i Z-o Z-u Z-avg abs-Z-avg ] turtles-own [ a f i o u ; 'f' stands in for 'e' (which is a reserved constant) apull fpull ipull opull upull ; used in calculate-pulls and apply-pulls apush fpush ipush opush upush ; used in calculate-pushess and apply-pushes rvowel bvowel gvowel ; used in colorize ] ; setup and its procedures ; ========================= to setup clear-all set seed new-seed ; done in 2 steps so "seed" random-seed seed ; can be reported on interface set serial# random 99999 if demo = 1 [ random-seed -378565792 set seed -378565792 set #towns 40 set enunciation 1.00 set size-wt 1.0 set falloff 20.1 set horizon 200 set push-method "settle out" ] if demo = 2 [ random-seed -378565792 set seed -378565792 set #towns 40 set enunciation 1.00 set size-wt 1.0 set falloff 5.1 set horizon 200 set push-method "settle out" ] if demo = 3 [ random-seed -380851167 set seed -380851167 set #towns 60 set enunciation 0.10 set size-wt 1.0 set falloff 1.6 set horizon 25 set push-method "avoid others" set debug 0 ] set max-dist sqrt ( world-width ^ 2 + world-height ^ 2 ) ; calculated here so it doesn't have to be recalculated every loop setup-patches setup-turtles ifelse headless [] [ calculate-vowel-averages colourtron4000 update-plots ] end to setup-turtles create-turtles #towns randomize-sizes randomize-locations label-towns randomize-vowels set-default-shape turtles "circle" end to label-towns ask turtles with [ who < 5 ] [ set label who set label-color black ] end to randomize-locations ask turtles [ setxy random-xcor random-ycor ] end to randomize-vowels ask turtles [ set a random-float 1 set f random-float 1 set i random-float 1 set o random-float 1 set u random-float 1 ] end to randomize-sizes ifelse size-distribution [ ; ask turtles [ set size random-poisson 0.5 ] ask turtles [ set size random-gamma 2 1 ] ] [ ask turtles [ set size random 5 ] ] end to setup-patches ask patches [ set pcolor 9.5] end ;go and it's procedures ;======================== to go tick if pulls = 1 [ calculate-pulls ] if pushes = 1 [ calculate-pushes ] if pulls = 1 [ apply-pulls ] if pushes = 1 [ apply-pushes ] ifelse headless [] [ colourtron4000 statsify update-plots ] if ticks = last-tick [ statsify stop ] end ; create a list of turtles ; loop through it, ; for each one check location of a relative other town's a's. ; calculate a pull based on all of those ; do the math to determine the new vowel position (dont' move it yet) to calculate-pulls ask turtles [ without-interruption [ ; model should run the same without the without-interpution, only used for debug msg continuity set apull 0 set fpull 0 set ipull 0 set opull 0 set upull 0 let #nbrs 1 ; sets #nbrs to the number of turtles within range of the focal turtle if count turtles in-radius horizon > 1 [ set #nbrs ( count turtles in-radius horizon - 1 ) ] ; set here and not in create-turtles in case horizon slider gets bumped ; has > 1 if so that 1-town worlds don't crash on divide by zero ask turtles in-radius horizon [ if debug > 0 [ type "focal town " type [who] of myself type "'s A is " type precision [a] of myself 2 type " and neighbour town (" type who type ") A is " type precision a 2 type ". dist is " type distance myself type ". apull used to be " type precision [apull] of myself 2 type ","] set [apull] of myself [apull] of myself + ( ( a - [a] of myself ) * wt [who] of myself who distance myself ) if debug > 0 [ type " now apull is " type precision [apull] of myself 2 type "." print "" ] if debug > 1 [ type "focal town " type [who] of myself type "'s E is " type precision [f] of myself 2 type " and neighbour town (" type who type ") E is " type precision f 2 type ". fpull used to be " type precision [fpull] of myself 2 type ","] set [fpull] of myself [fpull] of myself + ( ( f - [f] of myself ) * wt [who] of myself who distance myself ) if debug > 1 [ type " now fpull is " type precision [fpull] of myself 2 type "." print "" ] set [ipull] of myself [ipull] of myself + ( ( i - [i] of myself ) * wt [who] of myself who distance myself ) set [opull] of myself [opull] of myself + ( ( o - [o] of myself ) * wt [who] of myself who distance myself ) set [upull] of myself [upull] of myself + ( ( u - [u] of myself ) * wt [who] of myself who distance myself ) ] if debug > 0 [ type who type "'s " type "apull of " type precision apull 2 type " / #nbrs of " type #nbrs ] set apull ( apull / #nbrs ) if debug > 0 [ type " = " type precision apull 3 print "." print "" ] if debug > 1 [ type who type "'s " type "fpull of " type precision fpull 2 type " / #nbrs of " type #nbrs ] set fpull ( fpull / #nbrs ) if debug > 1 [ type " = " type precision fpull 3 print "." print "" ] set ipull ( ipull / #nbrs ) set opull ( opull / #nbrs ) set upull ( upull / #nbrs ) ] ] end to apply-pulls ask turtles [ without-interruption [ set a ( a + apull ) if debug > 0 [ type "focal town(" type who type")'s new A pulled to " type precision a 2 print "." print""] set f ( f + fpull ) if debug > 1 [ type "focal town(" type who type")'s new E pulled to " type precision f 2 print "." print""] set i ( i + ipull ) set o ( o + opull ) set u ( u + upull ) ] ] end to calculate-pushes if push-method = "avoid others" [ ask turtles [ without-interruption [ ; model should run the same without the without-interpution, only used for debug msg continuity set apush 0 set fpush 0 set ipush 0 set opush 0 set upush 0 if debug > 1 [ type "apush for " type who type " was... " type precision apush 2 ] set apush mouth a f i o u if debug > 1 [ type " ...now apush for " type who type " is " type precision apush 2 print "." ] if debug > 1 [ type "fpush for " type who type " was " type precision fpush 2 type " now it's " ] set fpush mouth f a i o u if debug > 1 [ type precision fpush 2 print "." ] set ipush mouth i a f o u set opush mouth o a f i u set upush mouth u a f i o ] ] ] if push-method = "settle out" [ ask turtles [ without-interruption [ set apush 0 set fpush 0 set ipush 0 set opush 0 set upush 0 let unsorted-vowels [ ] set unsorted-vowels lput a unsorted-vowels set unsorted-vowels lput f unsorted-vowels set unsorted-vowels lput i unsorted-vowels set unsorted-vowels lput o unsorted-vowels set unsorted-vowels lput u unsorted-vowels let sorted-vowels sort unsorted-vowels if debug > 2 [ type "town " type who type " a " type precision a 2 type " f " type precision f 2 type " i " type precision i 2 type " o " type precision o 2 type " u " type precision u 2 print"" ] if debug > 2 [ show unsorted-vowels ] if debug > 2 [ show sorted-vowels ] let a-order position a sorted-vowels + 1 ; if a = 0 [ set a-order random-float 1 ] ; maybe necessary because multiple vowels likely to have a value of 0 ; if a = 1 [ set a-order 4 - random-float 1 ] ; likewise with 1. should set to between ( 0 and 1 ) and ( 3 and 4 ). ; maybe not necessary because vowels that have 1 or 0 can simply end up with equivalent pushes without a disaster let f-order position f sorted-vowels + 1 ; if f = 0 [ set f-order random-float 1 ] ; if f = 1 [ set f-order 4 - random-float 1 ] let i-order position i sorted-vowels + 1 ; if i = 0 [ set i-order random-float 1 ] ; if i = 1 [ set i-order 4 - random-float 1 ] let o-order position o sorted-vowels + 1 ; if o = 0 [ set o-order random-float 1 ] ; if o = 1 [ set o-order 4 - random-float 1 ] let u-order position u sorted-vowels + 1 ; if u = 0 [ set u-order random-float 1 ] ; if u = 1 [ set u-order 4 - random-float 1 ] set sorted-vowels fput 0 sorted-vowels set sorted-vowels lput 1 sorted-vowels if debug > 2 [ type "a-order " type precision a-order 2 type " f-order " type precision f-order 2 type " i-order " type precision i-order 2 type " o-order " type precision o-order 2 type " u-order " type precision u-order 2 print "." ] ; show sort-by [?1 < ?2] [ value-from a value-from f value-from i value-from o value-from u] let a-desire ( ( item ( a-order - 1 ) sorted-vowels + item ( a-order + 1 ) sorted-vowels ) / 2 ) let f-desire ( ( item ( f-order - 1 ) sorted-vowels + item ( f-order + 1 ) sorted-vowels ) / 2 ) let i-desire ( ( item ( i-order - 1 ) sorted-vowels + item ( i-order + 1 ) sorted-vowels ) / 2 ) let o-desire ( ( item ( o-order - 1 ) sorted-vowels + item ( o-order + 1 ) sorted-vowels ) / 2 ) let u-desire ( ( item ( u-order - 1 ) sorted-vowels + item ( u-order + 1 ) sorted-vowels ) / 2 ) if debug > 2 [ type "a desire " type a-desire type " f-desire " type f-desire type " i-desire " type i-desire type " o-desire " type o-desire type " u-desire " type u-desire print" ." print "" ] set apush ( a-desire - a ) * enunciation set fpush ( f-desire - f ) * enunciation set ipush ( i-desire - i ) * enunciation set opush ( o-desire - o ) * enunciation set upush ( u-desire - u ) * enunciation ] ] ] end to apply-pushes ask turtles [ without-interruption [ set a ( a + apush ) if a > 1 [ set a 1 ] ; is this a total kludge? if a < 0 [ set a 0 ] ; it certainly isn't elegant if debug > 0 [ type "focal town(" type who type")'s new A pushed to " type precision a 2 print "." print""] set f ( f + fpush ) if f > 1 [ set f 1 ] if f < 0 [ set f 0 ] if debug > 1 [ type "focal town(" type who type")'s new E pushed to " type precision f 2 print "." print""] set i ( i + ipush ) if i > 1 [ set i 1 ] if i < 0 [ set i 0 ] set o ( o + opush ) if o > 1 [ set o 1 ] if o < 0 [ set o 0 ] set u ( u + upush ) if u > 1 [ set u 1 ] if u < 0 [ set u 0 ] ] ] end ; figure out what colour each town will display based on it's vowel positions to colourtron4000 ; first map the display choices from the chooser boxes to the vowel variables to be used ask turtles [ if red-vowel = "a" [ set rvowel a ] if red-vowel = "e" [ set rvowel f ] if red-vowel = "i" [ set rvowel i ] if red-vowel = "o" [ set rvowel o ] if red-vowel = "u" [ set rvowel u ] if green-vowel = "a" [ set gvowel a ] if green-vowel = "e" [ set gvowel f ] if green-vowel = "i" [ set gvowel i ] if green-vowel = "o" [ set gvowel o ] if green-vowel = "u" [ set gvowel u ] if blue-vowel = "a" [ set bvowel a ] if blue-vowel = "e" [ set bvowel f ] if blue-vowel = "i" [ set bvowel i ] if blue-vowel = "o" [ set bvowel o ] if blue-vowel = "u" [ set bvowel u ] ] ; then translate the three vowel positions into a the NetLogo colorspace version ; of an rgb display of those three vowel positions ask turtles [ set rvowel rvowel * 255 set bvowel bvowel * 255 set gvowel gvowel * 255 set color rgb rvowel gvowel bvowel if debug > 0 [ type who type "'s A is " type precision a 2 print"." ] if debug > 0 [ type who type "'s rvowel is " type rvowel print "." print "" ] if debug > 1 [ type who type "'s I is " type precision i 2 print"." ] if debug > 1 [ type who type "'s bvowel is " type bvowel print "." print "" ] ] end ; statsify ; ; container for calling various statistics to statsify calculate-vowel-averages if toggle-sd [ avg-vowel-sds ] if toggle-semivariance [ semivariance ] if toggle-moransI [ calculate-moransI calculate-expected calculate-significance ] end to calculate-vowel-averages set atotal 0 set ftotal 0 set itotal 0 set ototal 0 set utotal 0 ask turtles [ set atotal ( atotal + a ) set ftotal ( ftotal + f ) set itotal ( itotal + i ) set ototal ( ototal + o ) set utotal ( utotal + u ) ] set a-average ( atotal / #towns ) set f-average ( ftotal / #towns ) set i-average ( itotal / #towns ) set o-average ( ototal / #towns ) set u-average ( utotal / #towns ) end ; avg-vowel-sds ; ; calculates the average of the standard deviations of each of the 5 vowel-position distributions to avg-vowel-sds set a-sd standard-deviation [ a ] of turtles set f-sd standard-deviation [ f ] of turtles set i-sd standard-deviation [ i ] of turtles set o-sd standard-deviation [ o ] of turtles set u-sd standard-deviation [ u ] of turtles let total-std-dev ( a-sd + f-sd + i-sd + o-sd + u-sd ) set avg-vowel-SD ( total-std-dev / 5 ) end ; semivariance ; ; creates semivariance lists, ; that is: lists of pairwise comparisons of towns, with distance between ; and vowel position difference between recorded for each comparison. ; when complete should produce six lists -- 1 for each vowel (for plots) ; and one with all comparison (for stats). ; note!: this procedure is inneficient - each comparison is run twice, ; (between turtle p and q, and again between q and p) when only once is necessary. to semivariance set sv-list [] set sv-list-a [] set sv-list-f [] set sv-list-i [] set sv-list-o [] set sv-list-u [] ask n-of ( sample-size * #towns ) turtles [ ask turtles with [ who > [who] of myself and distance myself < ( max-dist / 2 ) ] [ ; who >... should eliminates pairs (thanks Jim Lyon!), max-dist/2 good practice for semivariance. (thanks Pierre Gooevarts!) let dist precision distance myself 1 ; sets dist to the distance between the pair of turtles, to 1 decimal place let diff-a abs precision ( a - [a] of myself ) 8 ; sets diff to the absolute value of the difference between the a positions of the turtles, to 8 decimal places let diff-f abs precision ( f - [f] of myself ) 8 let diff-i abs precision ( i - [i] of myself ) 8 let diff-o abs precision ( o - [o] of myself ) 8 let diff-u abs precision ( u - [u] of myself ) 8 set sv-list-a lput list dist diff-a sv-list-a set sv-list-f lput list dist diff-f sv-list-f set sv-list-i lput list dist diff-i sv-list-i set sv-list-o lput list dist diff-o sv-list-o set sv-list-u lput list dist diff-u sv-list-u set sv-list lput list dist diff-a sv-list set sv-list lput list dist diff-f sv-list set sv-list lput list dist diff-i sv-list set sv-list lput list dist diff-o sv-list set sv-list lput list dist diff-u sv-list if debug > 1 [ type "sv-list-a: " type sv-list-a print "." print "" ] if debug > 2 [ type "sv-list-u: " type sv-list-u print "." print "" ] if debug > 3 [ type "sv-list: " type sv-list print "." print "" ] ] ] if debug > 0 [ type "sv-list-a: " type sv-list-a print "." print "" ] if debug > 1 [ type "sv-list: " type sv-list print "." print "" ] set sv-list sort-by [ item 0 ?1 < item 0 ?2 ] sv-list ; holy crap it works. sorts sv-list by dist values if debug > 0 [ type "sorted (?) sv-list: " type sv-list print "." print "" ] let index 0 set near-diffs 0 while [ index < ( length sv-list / 2 ) ] [ let pair item index sv-list set near-diffs near-diffs + item 1 pair set index index + 1 ] set sv-list reverse sv-list if debug > 0 [ type "sorted (?) sv-list: " type sv-list print "." print "" ] set index 0 set far-diffs 0 while [ index < ( length sv-list / 2 ) ] [ ; note that this double counts the middle value in an odd-numbered list let pair item index sv-list set far-diffs far-diffs + item 1 pair set index index + 1 ] ifelse near-diffs != 0 [ ; !=0 ifelse is kludge for div/0 error set far-to-near far-diffs / near-diffs ] [ set far-to-near far-diffs / 0.00001 ] set length-sv-list length-sv-list set far-near-index ( ( far-diffs - near-diffs ) / length sv-list ) end ; calculate-moransI ; ; calculate Moran's I statistic, a measure of global spatial autocorrelation ; note this version has a potential flaw: the statistic is calculated using the global vowel ; averages, from calculate-average-vowels, but unless sample-size is set to all (1.0), the ; average vowels positions for the subset used in the calculations will presumably be different ; than the global average. I don't know how much this screws up the results. ; also, for computing speed and coding simplicity, the variance measurement used in the calculation ; of expected values is derived only from the a vowels, but used for calculating the expected ; value for each value distribution. This is very dodgy. to calculate-moransI let spatial-weight 0 let total-spatial-weight 0 let second-numerator-a 0 let second-numerator-f 0 let second-numerator-i 0 let second-numerator-o 0 let second-numerator-u 0 let second-denominator-a 0 let second-denominator-f 0 let second-denominator-i 0 let second-denominator-o 0 let second-denominator-u 0 let p 0 let q 0 ; adding up denominator of first term (EE wpq) while [ p < #towns ] [ set q 0 while [ q < #towns ] [ if debug = 2 [ type "p:" type p type " q:" type q type " " type total-spatial-weight type " + " ] set spatial-weight wpq p q set total-spatial-weight total-spatial-weight + spatial-weight if debug = 2 [ type spatial-weight type " = " print total-spatial-weight ] set q q + 1 ] set p p + 1 ] if debug = 2 [ type "final total-spatial-weight: " print total-spatial-weight ] if debug = 1 [ type "EE wpq = " type total-spatial-weight print "" ] ; adding up numerator of second term ((EE wpq(xp - xmean)(xq-xmean)) set p 0 set q 0 while [ p < #towns ] [ set q 0 while [ q < #towns ] [ ask turtle p [ set spatial-weight wpq p q ] let p-offaverage-a ( [a] of turtle p - a-average ) let q-offaverage-a ( [a] of turtle q - a-average ) let p-offaverage-f ( [a] of turtle p - f-average ) let q-offaverage-f ( [a] of turtle q - f-average ) let p-offaverage-i ( [a] of turtle p - i-average ) let q-offaverage-i ( [a] of turtle q - i-average ) let p-offaverage-o ( [a] of turtle p - o-average ) let q-offaverage-o ( [a] of turtle q - o-average ) let p-offaverage-u ( [a] of turtle p - u-average ) let q-offaverage-u ( [a] of turtle q - u-average ) let pq-second-numerator-a ( spatial-weight * p-offaverage-a * q-offaverage-a ) let pq-second-numerator-f ( spatial-weight * p-offaverage-f * q-offaverage-f ) let pq-second-numerator-i ( spatial-weight * p-offaverage-i * q-offaverage-i ) let pq-second-numerator-o ( spatial-weight * p-offaverage-o * q-offaverage-o ) let pq-second-numerator-u ( spatial-weight * p-offaverage-u * q-offaverage-u ) set second-numerator-a second-numerator-a + pq-second-numerator-a set second-numerator-f second-numerator-f + pq-second-numerator-a set second-numerator-i second-numerator-i + pq-second-numerator-a set second-numerator-o second-numerator-o + pq-second-numerator-a set second-numerator-u second-numerator-u + pq-second-numerator-a set q q + 1 ] set p p + 1 ] if debug = 1 [ type "EE wpq(xp - xmean)(xq-xmean) = " type second-numerator-a print "" ] ; adding up denominator of 2nd term. Duplicates part of above, but simpler this way. ask turtles [ let offaverage-a ( a - a-average ) if debug = 6 [ type who type "'s a: " type a type " - " type a-average type " = offaverage-a " print offaverage-a ] let offaverage-f ( f - f-average ) if debug = 6 [ type who type "'s f: " type f type " - " type f-average type " = offaverage-f " print offaverage-f ] let offaverage-i ( i - i-average ) let offaverage-o ( o - o-average ) let offaverage-u ( u - u-average ) set second-denominator-a second-denominator-a + ( offaverage-a * offaverage-a ) set second-denominator-f second-denominator-f + ( offaverage-f * offaverage-f ) set second-denominator-i second-denominator-i + ( offaverage-i * offaverage-i ) set second-denominator-o second-denominator-o + ( offaverage-o * offaverage-o ) set second-denominator-u second-denominator-u + ( offaverage-u * offaverage-u ) ] if debug = 1 [ type "E(xp-xbar)^2 = " type second-denominator-a print "" print "" ] carefully [ set moransI-a ( ( #towns / total-spatial-weight) * ( second-numerator-a / second-denominator-a ) ) set moransI-f ( ( #towns / total-spatial-weight) * ( second-numerator-f / second-denominator-f ) ) set moransI-i ( ( #towns / total-spatial-weight) * ( second-numerator-i / second-denominator-i ) ) set moransI-o ( ( #towns / total-spatial-weight) * ( second-numerator-o / second-denominator-o ) ) set moransI-u ( ( #towns / total-spatial-weight) * ( second-numerator-u / second-denominator-u ) ) ] [ print "" type error-message print " in I final calculation." type "total-spatial weight: " print total-spatial-weight type " second-denominator-a: " print second-denominator-a type " second-denominator-f: " print second-denominator-f type " second-denominator-i: " print second-denominator-i type " second-denominator-o: " print second-denominator-o type " second-denominator-u: " print second-denominator-u print "**************" ] set moransI-avg ( ( moransI-a + moransI-f + moransI-i + moransI-o + moransI-u ) / 5 ) end ; calculate-expected ; ; used to assess significance of measured Moran's I statistic. to calculate-expected set expected ( 1 / (#towns - 1) ) end to calculate-significance ; S1,2,3,4,5 and K are all subcomponents of the rather complicated process of measuring variance ; S3 and S5 are used in oregon formulation only ; K is used in santabarbara formulation only let S1 0 let S2 0 let S3 0 let S4 0 let S5 0 let K 0 let p 0 let q 0 ;S1 let total-squared-duplicate-spatial-weight 0 while [ p < #towns ] [ set q 0 while [ q < #towns ] [ let spatial-weight 0 ask turtle p [ set spatial-weight wpq p q ] let duplicate-spatial-weight ( spatial-weight + spatial-weight ) let squared-duplicate-spatial-weight ( duplicate-spatial-weight * duplicate-spatial-weight ) set total-squared-duplicate-spatial-weight total-squared-duplicate-spatial-weight + squared-duplicate-spatial-weight set q q + 1 ] set p p + 1 ] set S1 ( total-squared-duplicate-spatial-weight / 2 ) if debug = 3 [ print "" type "S1: " type S1 print "" ] ;S2 let total-squared-duplicate-total-spatial-weight 0 let total-spatial-weight 0 ; here or in loop? set p 0 set q 0 while [ p < #towns ] [ set q 0 set total-spatial-weight 0 while [ q < #towns ] [ let spatial-weight 0 ask turtle p [ set spatial-weight wpq p q ] set total-spatial-weight total-spatial-weight + spatial-weight set q q + 1 ] let duplicate-total-spatial-weight total-spatial-weight * 2 let squared-duplicated-total-spatial-weight duplicate-total-spatial-weight * duplicate-total-spatial-weight set total-squared-duplicate-total-spatial-weight total-squared-duplicate-total-spatial-weight + squared-duplicated-total-spatial-weight set p p + 1 ] set S2 total-squared-duplicate-total-spatial-weight if debug = 3 [ type "S2: " type S2 print ""] ; S3 ; S3 is broken up into an operation on a couple of sub-summations (sigmas) let sigma1 0 let sigma2 0 ; sigma1 let total-cubed-offaverage-a 0 ask turtles [ let offaverage-a a - a-average let cubed-offaverage-a offaverage-a * offaverage-a * offaverage-a * offaverage-a set total-cubed-offaverage-a total-cubed-offaverage-a + cubed-offaverage-a ] set sigma1 total-cubed-offaverage-a if debug = 3 [ type "sigma1: " type sigma1 print ""] ; sigma2 let total-squared-offaverage-a 0 ask turtles [ let offaverage-a a - a-average let squared-offaverage-a offaverage-a * offaverage-a set total-squared-offaverage-a total-squared-offaverage-a + squared-offaverage-a ] set sigma2 total-squared-offaverage-a if debug = 3 [ type "sigma2: " type sigma2 print ""] carefully [ set S3 ( ( 1 / #towns ) * sigma1 ) / ( ( ( 1 / #towns ) * sigma2 ) *( ( 1 / #towns ) * sigma2 ) ) ] [ print "" type error-message print " in S3 summation." type "sigma2: " print sigma2 print "**************" ] if debug = 3 [ type "S3: " type S3 print "" ] ;S4 ;sigma3 let sigma3 0 set total-spatial-weight 0 set p 0 while [ p < #towns ] [ set q 0 while [ q < #towns ] [ let spatial-weight 0 ask turtle p [ set spatial-weight wpq p q ] set total-spatial-weight total-spatial-weight + spatial-weight if debug = 4 [ type "total-spatial-weight: " type total-spatial-weight type " + spatial-weight " type p type "->" type q type " " type spatial-weight type " = " type total-spatial-weight print "" ] set q q + 1 ] set sigma3 total-spatial-weight set p p + 1 ] if debug = 3 [ type "sigma3: " type sigma3 print ""] set S4 ( ( ( #towns * #towns ) - 3 * #towns + 3 ) * S1 - #towns * S2 + 3 * ( sigma3 * sigma3 ) ) if debug = 3 [ type "S4: " type S4 print "" ] ;S5 ; IThere is a typo in the oregon formulation, I've ; made a guess about how to correct it here. set S5 ( S1 - 2 * #towns * S1 + 6 * ( sigma3 * sigma3 ) ) if debug = 3 [ type "S5: " type S5 print "" ] ;K ;K reuses sigma1 and sigma2 from S3 carefully [ set K ( ( #towns * sigma1 ) / ( sigma2 * sigma2 ) ) ] [ type error-message type " in set K. " type "sigma 1: " type sigma1 type "sigma 2:" print sigma2 print "**********************" print "" ] if debug = 3 [ type "K: " type K print "" ] ;var set var ( ( ( 1 / ( ( sigma3 * sigma3 ) * ( #towns * 2 - 1 ) ) ) * ( ( #towns * #towns ) * S1 - #towns * S2 + 3 * ( sigma3 * sigma3 ) ) ) - ( expected * expected ) ) if debug = 3 [ type "var: " type var print "" print "" ] ;Z set Z-a ( ( moransI-a - expected ) / var ) set Z-f ( ( moransI-f - expected ) / var ) set Z-i ( ( moransI-i - expected ) / var ) set Z-o ( ( moransI-o - expected ) / var ) set Z-u ( ( moransI-u - expected ) / var ) set Z-avg ( ( Z-a + Z-f + Z-i + Z-o + Z-u ) / 5 ) set abs-Z-avg abs Z-avg end ; wpq ; ; takes p and q as identifiers for two turtles ; calculates weighting factor between them ; used in calculate-significance for Moran's I to-report wpq [ p q ] let spatial-distance 0 ask turtle p [ set spatial-distance distance turtle q ] ifelse spatial-distance = 0 [ report 1 ] ; this is flawed - adjacent and overlapping pairs recieve the same weighting [ report ( 1 / spatial-distance ) ] end ; update-plots ; ; container for all plotting activities to update-plots plot-vowel-averages plot-sample-As plot-sample-Us if toggle-sd [ plot-avg-vowel-sds ] if toggle-moransI [ plot-moransI-Zs ] plot-individual-towns if ticks > 0 and toggle-semivariance [ plot-semivariogram plot-far-near-index ] end ; plot-vowel-average ; ; makes the vowel average plot to plot-vowel-averages set-current-plot "vowel position avg.s" set-current-plot-pen "A avg" plot a-average set-current-plot-pen "E avg" plot f-average set-current-plot-pen "I avg" plot i-average set-current-plot-pen "O avg" plot o-average set-current-plot-pen "U avg" plot u-average end ; make the sample A position plot to plot-sample-As set-current-plot "sample A positions" ; note: these are set up as ifs so it doesnt bail out while checking for the a of ; a town that doesn't exist, when # of towns is set below 9 if count turtles > 0 [ set-current-plot-pen "town0" plot [a] of turtle 0 ] if count turtles > 1 [ set-current-plot-pen "town1" plot [a] of turtle 1 ] if count turtles > 2 [ set-current-plot-pen "town2" plot [a] of turtle 2 ] if count turtles > 3 [ set-current-plot-pen "town3" plot [a] of turtle 3 ] if count turtles > 4 [ set-current-plot-pen "town4" plot [a] of turtle 4 ] if count turtles > 5 [ set-current-plot-pen "town5" plot [a] of turtle 5 ] if count turtles > 6 [ set-current-plot-pen "town6" plot [a] of turtle 6 ] if count turtles > 7 [ set-current-plot-pen "town7" plot [a] of turtle 7 ] if count turtles > 8 [ set-current-plot-pen "town8" plot [a] of turtle 8 ] if count turtles > 9 [ set-current-plot-pen "town9" plot [a] of turtle 9 ] end to plot-sample-Us set-current-plot "sample U positions" ; note: these are set up as ifs so it doesnt bail out while checking for the a of ; a town that doesn't exist, when # of towns is set below 9 if count turtles > 0 [ set-current-plot-pen "town0" plot [u] of turtle 0 ] if count turtles > 1 [ set-current-plot-pen "town1" plot [u] of turtle 1 ] if count turtles > 2 [ set-current-plot-pen "town2" plot [u] of turtle 2 ] if count turtles > 3 [ set-current-plot-pen "town3" plot [u] of turtle 3 ] if count turtles > 4 [ set-current-plot-pen "town4" plot [u] of turtle 4 ] if count turtles > 5 [ set-current-plot-pen "town5" plot [u] of turtle 5 ] if count turtles > 6 [ set-current-plot-pen "town6" plot [u] of turtle 6 ] if count turtles > 7 [ set-current-plot-pen "town7" plot [u] of turtle 7 ] if count turtles > 8 [ set-current-plot-pen "town8" plot [u] of turtle 8 ] if count turtles > 9 [ set-current-plot-pen "town9" plot [u] of turtle 9 ] end to plot-individual-towns if count turtles > 0 [ set-current-plot "town0" set-current-plot-pen "a-pos" plot [a] of turtle 0 set-current-plot-pen "e-pos" plot [f] of turtle 0 set-current-plot-pen "i-pos" plot [i] of turtle 0 set-current-plot-pen "o-pos" plot [o] of turtle 0 set-current-plot-pen "u-pos" plot [u] of turtle 0 set-current-plot "town1" ] ; next town if count turtles > 1 [ set-current-plot-pen "a-pos" plot [a] of turtle 1 set-current-plot-pen "e-pos" plot [f] of turtle 1 set-current-plot-pen "i-pos" plot [i] of turtle 1 set-current-plot-pen "o-pos" plot [o] of turtle 1 set-current-plot-pen "u-pos" plot [u] of turtle 1 ] ; next town if count turtles > 2 [ set-current-plot "town2" set-current-plot-pen "a-pos" plot [a] of turtle 2 set-current-plot-pen "e-pos" plot [f] of turtle 2 set-current-plot-pen "i-pos" plot [i] of turtle 2 set-current-plot-pen "o-pos" plot [o] of turtle 2 set-current-plot-pen "u-pos" plot [u] of turtle 2 ] ; next town if count turtles > 3 [ set-current-plot "town3" set-current-plot-pen "a-pos" plot [a] of turtle 3 set-current-plot-pen "e-pos" plot [f] of turtle 3 set-current-plot-pen "i-pos" plot [i] of turtle 3 set-current-plot-pen "o-pos" plot [o] of turtle 3 set-current-plot-pen "u-pos" plot [u] of turtle 3 ] ; next town if count turtles > 4 [ set-current-plot "town4" set-current-plot-pen "a-pos" plot [a] of turtle 4 set-current-plot-pen "e-pos" plot [f] of turtle 4 set-current-plot-pen "i-pos" plot [i] of turtle 4 set-current-plot-pen "o-pos" plot [o] of turtle 4 set-current-plot-pen "u-pos" plot [u] of turtle 4 ] end to plot-avg-vowel-sds set-current-plot "Avg. Vowel SDs" set-current-plot-pen "avgSD" plot avg-vowel-SD set-current-plot-pen "a-sd" plot a-sd set-current-plot-pen "f-sd" plot f-sd set-current-plot-pen "i-sd" plot i-sd set-current-plot-pen "o-sd" plot o-sd set-current-plot-pen "u-sd" plot u-sd end to plot-moransI set-current-plot "Moran's I" set-current-plot-pen "a" plot moransI-a set-current-plot-pen "e" plot moransI-f set-current-plot-pen "i" plot moransI-i set-current-plot-pen "o" plot moransI-o set-current-plot-pen "u" plot moransI-u set-current-plot-pen "avg" plot moransI-avg end to plot-moransI-Zs set-current-plot "Moran's I Z values" set-current-plot-pen "a" plot Z-a set-current-plot-pen "e" plot Z-f set-current-plot-pen "i" plot Z-i set-current-plot-pen "o" plot Z-o set-current-plot-pen "u" plot Z-u set-current-plot-pen "avg" plot Z-avg end ; plot-semivariogram to plot-semivariogram set-current-plot "semivariogram" clear-plot set-current-plot-pen "a" foreach sv-list-a [ plotxy item 0 ? item 1 ? ] set-current-plot-pen "e" foreach sv-list-f [ plotxy item 0 ? item 1 ? ] set-current-plot-pen "i" foreach sv-list-i [ plotxy item 0 ? item 1 ? ] set-current-plot-pen "o" foreach sv-list-o [ plotxy item 0 ? item 1 ? ] set-current-plot-pen "u" foreach sv-list-u [ plotxy item 0 ? item 1 ? ] end to plot-far-near-index set-current-plot "far-near-index" set-current-plot-pen "fni" plot far-near-index end ; reporters ; =============================== to-report mouth [ focal vwl1 vwl2 vwl3 vwl4 ] let thispush 0 let allpush 0 let push1 0 let push2 0 let push3 0 let push4 0 if debug > 1 [ print "" type "given " type "focal " type precision focal 2 type " vwl1 " type precision vwl1 2 type " vwl2 " type precision vwl2 2 type " vwl 3 " type precision vwl3 2 type " vwl4 " print precision vwl4 2 ] if focal < vwl1 [ set push1 ( - 1 * ( 1 + ( focal - vwl1 ) ) ) ] if focal > vwl1 [ set push1 ( 1 + ( vwl1 - focal ) ) ] if focal = vwl1 [ ifelse random-float 1 >= 0.5 [ set push1 -0.25 ] [ set push1 0.25 ] ] if focal < vwl2 [ set push2 ( -1 * ( 1 + ( focal - vwl2 ) ) ) ] if focal > vwl2 [ set push2 ( 1 + ( vwl2 - focal ) ) ] if focal = vwl2 [ ifelse random-float 1 >= 0.5 [ set push2 -0.25 ] [ set push2 0.25 ] ] if focal < vwl3 [ set push3 ( -1 * ( 1 + ( focal - vwl3 ) ) ) ] if focal > vwl3 [ set push3 ( 1 + ( vwl3 - focal ) ) ] if focal = vwl3 [ ifelse random-float 1 >= 0.5 [ set push3 -0.25 ] [ set push3 0.25 ] ] if focal < vwl4 [ set push4 ( -1 * ( 1 + ( focal - vwl4 ) ) ) ] if focal > vwl4 [ set push4 ( 1 + ( vwl4 - focal ) ) ] if focal = vwl4 [ ifelse random-float 1 >= 0.5 [ set push4 -0.25 ] [ set push4 0.25 ] ] set allpush ( push1 + push2 + push3 + push4 ) set thispush ( allpush * enunciation ) if debug > 1 [ type "push1 ( " type precision push1 2 type ") + " type "push2 ( " type precision push2 2 type ") + " type "push3 ( " type precision push3 2 type ") + " type "push4 ( " type precision push4 2 type ") = " type precision allpush 2 print "." ] report thispush end ; wt ; ; weight strenghts of pulls based on size of pulling ; town and distance between the towns to-report wt [ focal compared dist ] let dist-fx 0 if debug > 1 [ type "weights between focal ( " type turtle focal type " ) and compared ( " type turtle compared print " ) : " ] let size-fx [size] of turtle compared * size-wt if debug > 1 [ type "size of compared: " type [size] of turtle compared type " x size-wt " type size-wt type " = " print size-fx ] if falloff-fn = "classic" [ if fast-falloff = 1 [ set dist-fx ( ( max-dist - dist ) / max-dist ) / falloff if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) / " type precision max-dist 2 type " / falloff ( " type falloff type " ) = " print precision dist-fx 2 ] ] if fast-falloff = 2 [ let max-dist-sqrd max-dist * max-dist let dist-sqrd dist * dist set dist-fx ( ( max-dist-sqrd - dist-sqrd ) / max-dist-sqrd ) / falloff if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) / " type precision max-dist 2 type " / falloff ( " type falloff type " ) = " print precision dist-fx 2 ] ] if fast-falloff = 3 [ let max-dist-cbd max-dist * max-dist * max-dist let dist-cbd dist * dist * dist set dist-fx ( ( max-dist-cbd - dist-cbd ) / max-dist-cbd ) / falloff if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) / " type precision max-dist 2 type " / falloff ( " type falloff type " ) = " print precision dist-fx 2 ] ] ] if falloff-fn = "sqr-inv-dist" [ let inv-norm-dist ( max-dist - dist ) / max-dist ; let inv-norm-dist 1 - norm-dist let inv-norm-dist-sqrd inv-norm-dist * inv-norm-dist let inv-norm-dist-cbd inv-norm-dist * inv-norm-dist * inv-norm-dist let inv-norm-dist-^4 inv-norm-dist * inv-norm-dist * inv-norm-dist * inv-norm-dist let inv-norm-dist-^5 inv-norm-dist * inv-norm-dist * inv-norm-dist * inv-norm-dist * inv-norm-dist let inv-norm-dist-^6 inv-norm-dist * inv-norm-dist * inv-norm-dist * inv-norm-dist * inv-norm-dist * inv-norm-dist if fast-falloff = 1 [ set dist-fx inv-norm-dist if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) inversed and normed ( " type precision dist-fx 2 ] ] if fast-falloff = 2 [ set dist-fx inv-norm-dist-sqrd if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) inversed and normed and squared ( " type precision dist-fx 2 ] ] if fast-falloff = 3 [ set dist-fx inv-norm-dist-cbd if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) inversed and normed and cubed ( " type precision dist-fx 2 ] ] if fast-falloff = 4 [ set dist-fx inv-norm-dist-^4 if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) inversed and normed and ^4ed ( " type precision dist-fx 2 ] ] if fast-falloff = 5 [ set dist-fx inv-norm-dist-^5 if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) inversed and normed and ^5ed ( " type precision dist-fx 2 ] ] if fast-falloff = 6 [ set dist-fx inv-norm-dist-^6 if debug > 1 [ type " ( max-dist " type precision max-dist 2 type " - distance " type precision dist 2 type " ) inversed and normed and ^6ed ( " type precision dist-fx 2 ] ] set dist-fx dist-fx / falloff if debug > 1 [ type " / falloff ( " type falloff type " ) = " print precision dist-fx 2 print ""] ] let weight size-fx * dist-fx if debug > 1 [ type "all makes a weight of " type size-fx type " x " type precision dist-fx 2 type " = " print precision weight 2 print "" ] report weight end @#$#@#$#@ GRAPHICS-WINDOW 486 10 986 531 -1 -1 4.9 1 10 1 1 1 0 0 0 1 0 99 0 99 1 1 1 ticks CC-WINDOW 5 1025 1482 1120 Command Center 0 BUTTON 8 10 71 43 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 79 10 142 43 NIL go T 1 T OBSERVER NIL NIL NIL NIL BUTTON 151 11 226 44 go once go NIL 1 T OBSERVER NIL NIL NIL NIL SLIDER 387 11 479 44 #towns #towns 1 100 25 1 1 NIL HORIZONTAL CHOOSER 868 949 960 994 debug debug 0 1 2 0 SLIDER 626 905 718 938 horizon horizon 0 200 200 1 1 NIL HORIZONTAL CHOOSER 387 51 479 96 red-vowel red-vowel "a" "e" "i" "o" "u" 0 CHOOSER 386 152 478 197 blue-vowel blue-vowel "a" "e" "i" "o" "u" 4 CHOOSER 386 101 478 146 green-vowel green-vowel "a" "e" "i" "o" "u" 2 SWITCH 728 905 854 938 size-distribution size-distribution 1 1 -1000 PLOT 10 759 282 966 vowel position avg.s time vowels 0.0 10.0 -0.1 1.1 true true PENS "A avg" 1.0 0 -2674135 true "E avg" 1.0 0 -10899396 true "I avg" 1.0 0 -11221820 true "O avg" 1.0 0 -13345367 true "U avg" 1.0 0 -5825686 true MONITOR 293 915 343 960 A avg a-average 3 1 11 MONITOR 350 915 400 960 E avg f-average 3 1 11 MONITOR 408 916 458 961 I avg i-average 3 1 11 MONITOR 465 915 515 960 O avg o-average 3 1 11 MONITOR 520 915 570 960 U avg u-average 3 1 11 PLOT 206 399 396 538 sample A positions time A positions 0.0 10.0 -0.1 1.1 true false PENS "town0" 1.0 0 -2674135 true "town1" 1.0 0 -955883 true "town2" 1.0 0 -6459832 true "town3" 1.0 0 -1184463 true "town4" 1.0 0 -10899396 true "town5" 1.0 0 -13840069 true "town6" 1.0 0 -14835848 true "town7" 1.0 0 -11221820 true "town8" 1.0 0 -13791810 true "town9" 1.0 0 -8630108 true PLOT 296 757 553 907 Avg. Vowel SDs time avg SD 0.0 10.0 0.0 0.35 true true PENS "avgSD" 1.0 0 -16777216 true "a-sd" 1.0 0 -2674135 true "f-sd" 1.0 0 -10899396 true "i-sd" 1.0 0 -11221820 true "o-sd" 1.0 0 -5825686 true "u-sd" 1.0 0 -955883 true PLOT 7 398 197 538 sample U positions time U positions 0.0 10.0 -0.1 1.1 true false PENS "town0" 1.0 0 -2674135 true "town1" 1.0 0 -955883 true "town2" 1.0 0 -6459832 true "town3" 1.0 0 -1184463 true "town4" 1.0 0 -10899396 true "town5" 1.0 0 -13840069 true "town6" 1.0 0 -14835848 true "town7" 1.0 0 -11221820 true "town8" 1.0 0 -13791810 true "town9" 1.0 0 -8630108 true CHOOSER 729 799 821 844 pushes pushes 0 1 1 CHOOSER 730 851 822 896 pulls pulls 0 1 1 SLIDER 102 70 229 103 enunciation enunciation 0 1 1 0.05 1 NIL HORIZONTAL SLIDER 626 756 984 789 size-wt size-wt 1 5 1 0.1 1 NIL HORIZONTAL SLIDER 104 112 232 145 falloff falloff 1.0 20.1 5 0.5 1 NIL HORIZONTAL PLOT 202 548 398 698 town1 time vowel positions 1.0 10.0 -0.1 1.1 true true PENS "a-pos" 1.0 0 -2674135 true "e-pos" 1.0 0 -10899396 true "i-pos" 1.0 0 -11221820 true "o-pos" 1.0 0 -13345367 true "u-pos" 1.0 0 -5825686 true PLOT 406 548 599 698 town2 time vowel positions 0.0 10.0 -0.1 1.1 true true PENS "a-pos" 1.0 0 -2674135 true "e-pos" 1.0 0 -10899396 true "i-pos" 1.0 0 -11221820 true "o-pos" 1.0 0 -13345367 true "u-pos" 1.0 0 -5825686 true PLOT 607 548 793 698 town3 time vowel positions 0.0 10.0 -0.1 1.1 true true PENS "a-pos" 1.0 0 -2674135 true "e-pos" 1.0 0 -10899396 true "i-pos" 1.0 0 -11221820 true "o-pos" 1.0 0 -13345367 true "u-pos" 1.0 0 -5825686 true PLOT 802 548 990 698 town4 time vowel positions 0.0 10.0 -0.1 1.1 true true PENS "a-pos" 1.0 0 -2674135 true "e-pos" 1.0 0 -10899396 true "i-pos" 1.0 0 -11221820 true "o-pos" 1.0 0 -13345367 true "u-pos" 1.0 0 -5825686 true PLOT 4 548 196 698 town0 time vowel positions 0.0 10.0 -0.1 1.1 true true PENS "a-pos" 1.0 0 -2674135 true "e-pos" 1.0 0 -10899396 true "i-pos" 1.0 0 -11221820 true "o-pos" 1.0 0 -13345367 true "u-pos" 1.0 0 -5825686 true CHOOSER 628 853 720 898 push-method push-method "avoid others" "settle out" 1 MONITOR 406 966 463 1011 avgSD avg-vowel-sd 3 1 11 MONITOR 866 799 986 844 NIL seed 3 1 11 CHOOSER 628 800 720 845 demo demo "off" 1 2 3 4 5 6 7 8 9 10 0 CHOOSER 6 69 98 114 fast-falloff fast-falloff 1 2 3 4 5 6 2 SLIDER 8 716 983 749 last-tick last-tick 0 1000 45 1 1 NIL HORIZONTAL PLOT 1006 576 1297 722 semivariogram distance vowel difference 0.0 75.0 0.0 1.0 true true PENS "a" 1.0 2 -2674135 true "e" 1.0 2 -10899396 true "i" 1.0 2 -11221820 true "o" 1.0 2 -13345367 true "u" 1.0 2 -5825686 true MONITOR 1090 487 1167 532 NIL far-to-near 3 1 11 MONITOR 1174 488 1253 533 NIL far-diffs 3 1 11 MONITOR 1261 485 1340 530 NIL near-diffs 3 1 11 MONITOR 1007 488 1084 533 far-near-index far-near-index 8 1 11 CHOOSER 627 948 719 993 falloff-fn falloff-fn "classic" "sqr-inv-dist" 1 SLIDER 1132 539 1224 572 sample-size sample-size 0.1 1 1 0.1 1 NIL HORIZONTAL PLOT 1307 578 1473 720 far-near-index time fni 0.0 10.0 -0.0010 1.0E-4 true false PENS "fni" 1.0 0 -16777216 true SWITCH 476 966 572 999 toggle-sd toggle-sd 0 1 -1000 SWITCH 1006 539 1127 572 toggle-semivariance toggle-semivariance 0 1 -1000 SWITCH 8 169 130 202 toggle-moransI toggle-moransI 0 1 -1000 SWITCH 728 947 832 980 headless headless 0 1 -1000 MONITOR 138 169 221 214 NIL moransI-avg 3 1 11 PLOT 6 239 394 389 Moran's I Z values I time 0.0 10.0 0.0 1.0 true true PENS "avg" 1.0 0 -16777216 true "a" 1.0 0 -2674135 true "e" 1.0 0 -10899396 true "i" 1.0 0 -13791810 true "o" 1.0 0 -13345367 true "u" 1.0 0 -5825686 true MONITOR 233 169 303 214 NIL abs-Z-avg 4 1 11 @#$#@#$#@ WHAT IS IT? ----------- This section could give a general understanding of what the model is trying to show or explain. HOW IT WORKS ------------ This section could explain what rules the agents use to create the overall behavior of the model. HOW TO USE IT ------------- This section could explain how to use the model, including a description of each of the items in the interface tab. THINGS TO NOTICE ---------------- This section could give some ideas of things for the user to notice while running the model. THINGS TO TRY ------------- This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model. EXTENDING THE MODEL ------------------- This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc. NETLOGO FEATURES ---------------- This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features. RELATED MODELS -------------- This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest. CREDITS AND REFERENCES ---------------------- This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 link true 0 Line -7500403 true 150 0 150 300 link direction true 0 Line -7500403 true 150 150 30 225 Line -7500403 true 150 150 270 225 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 4.0 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go avg-vowel-SD setup go avg-vowel-SD setup go avg-vowel-SD setup go avg-vowel-SD setup go avg-vowel-SD setup go count turtles setup go avg-vowel-sd setup go far-to-near far-diffs near-diffs avg-vowel-sd seed setup go far-to-near far-diffs near-diffs avg-vowel-sd seed setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed serial# far-near-index moransI-avg expected Z-avg setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed near-diffs far-diffs far-near-index setup go avg-vowel-SD seed serial# far-near-index moransI-avg expected Z-avg @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ @