WealthModel - RePast netstart

(Last update April, 2009)


This is an example of a stand-alone network accessible RePast model. It was built using RePast 3.0, followed with the JarBuilder package. You can give it a try by clicking on the .jnlp file here. (Note: in order to run, it will download a 4 megabyte file . . .). (It will ask you if you want to trust me -- I guess that will be up to you :-)


It is possible you will have to find the file and fire it up with a Java Web Start application (e.g., Safari under MacOSX just downloads WealthModel.jnlp to my Desktop . . .)

The .jar file (4 megabytes) (which can also serve as a stand-alone version of the model that can run natively on your machine) is here:


The Java source is here:

WealthModel Java source

There are two basic "wealth" models here (with an extra bonus of a "synchronization" model :-)

The first wealth model is a very simple (!!!) "exchange" model. Each agent starts with (essentially) the same amount of wealth (by default, about 100 "dollars"). Then, during each time step, each agent chooses another agent at random, and gives that agent a dollar. The only other rule is that agents are not allowed to go totally broke or into debt -- i.e., if an agent has only one dollar, they just sit and wait for someone else to give them a dollar. Then they proceed as before.

The second wealth model is a very simple (!!!) "investment" model. Again, each agent starts with (essentially) the same amount of wealth. Then, during each time step, each agent "invests" their entire wealth, and makes a "return" r on their investment, which is normally distributed around RoiM (Return on investment Mean -- detrended . . .) with standard deviation RoiSD (Return on investment Standard Deviation). Their new wealth is just:

wealth <- wealth * exp(r)

where r is their individual return on investment rate for this time step.

That's it for the wealth models. (With the "Both" option, each agent does both things each time step . . .)

(Sometime I'll get around to writing about the "Sync" model . . .)

 // default and modifiable parameters of the model 

boolean Both = true; // Combine exchange and investment economies
boolean DeathTax = false; // Implement "death tax"
int LogLogBins = 20; // Number of bins for log:log plot
int MaxAge = 1200; // Age for "death tax" (if turned on)
int MaxInitialWealth = 110; // Maximum initial wealth for agents
int MinInitialWealth = 90; // Minimum initial wealth for agents
double MinWealth = 1.0; // Minimum wealth
boolean Moving = false; // Do agents move (for exchange or "synch" models)
int NumAgents = 1500; // Total number of agents (must be <= 2500)
int PlainBins = 100; // Number of bins for plain plot
int PlainPlotXMax = 300.0; // Maximum X (wealth) plotted in plain plot (-1 = any)
int PlainPlotYMax = -1.0; // Maximum Y (P_i) plotted in plain plot (-1 = any)
boolean PlotLogLog = true; // Whether to display log:log plot
boolean PlotPlain = true; // Whether to display plain plot
boolean ROI = false; // Whether to do investment economy (only)
boolean RandomWalk = false // Whether to do exchange or individual random walk
double RoiM = 0.00; // Mean return on investment
double RoiSD = 0.05; // Standard deviation of normal dist. of return
boolean Sync = false; // Whether to run the sync model instead
int SyncMax = 150; // Max value in sync model
boolean SyncRegion = false // Do agents affect only nearbys or everybody (in sync model)
int TaxPCT = 10; // Tax rate for death tax
boolean ViewStats = false; // Whether to show average wealth of all agents
boolean WriteStats = false // Whether to write stats out to a file on pause or stop

Colors of the agents:
if (wealth > 250)
      Color = magenta;
    else if (wealth > 200)
      Color = pink;
    else if (wealth > 150)
      Color = red);
    else if (wealth > 12)
      Color = orange;
    else if (wealth > 100)
      Color = yellow;
    else if (wealth > 75)
      Color = cyan;
    else if (wealth > 50)
      Color = blue;
    else if (wealth > 30)
      Color = green;
    else if (wealth > 20)
      Color = lightGray;
    else if (wealth > 10)
      Color = gray;
    else if (wealth > 5)
      Color = darkGray;
      Color = black;