Hello! I'm on sabbatical and trying to learn NetLogo and ABMs - apologies for the clueless question.
I made a few small modifications to the Simple Economy model that comes with NetLogo, to incorporate individual ability, public goods, and a tax/transfer scheme. Wasn't sure how best to do it so I coded the Transact routine 2 different ways. I thought they'd differ maybe in speed, but otherwise do the same thing. But they seem to be giving me very different outputs.
So my question is: Do the following blocks of code do the same thing, or have I made a mistake with the ifelse commands?
Here is one of the 2 models attached in its entirety. They only differ in the transact routine.
__________________________________________________________________________________
to transact
;; give money to another turtle; richest also pay transfer, poorest receive transfer
(ifelse
wealth >= mean [ wealth ] of max-n-of (count turtles * 0.333) turtles [ wealth ]
[ set wealth wealth - 1 - transfer ]
wealth <= mean [ wealth ] of min-n-of (count turtles * 0.333) turtles [ wealth ]
[ set wealth wealth - 1 + transfer ]
[ set wealth wealth - 1 ] )
ask one-of other turtles [ set wealth wealth + price + pub-good ]
end
_______________________________________________________________________________________
to transact
;; give money to another turtle
set wealth wealth - 1
ask one-of other turtles [ set wealth wealth + price + pub-good ]
if wealth >= mean [ wealth ] of max-n-of (count turtles * 0.333) turtles [ wealth ]
[ set wealth wealth - transfer ]
if wealth <= mean [ wealth ] of min-n-of (count turtles * 0.333) turtles [ wealth ]
[ set wealth wealth + transfer ]
end
_________________________________________________________________
Thanks so much!
JP