Monday, March 26, 2007

Making musical sense by email, appendix B

Here is the second of the two models I did in support of the dialog Greg Sandow and I had on the future of classical music. This one models the added effect that might occur if people stop attending concerts after they turn 30. Some stop forever, while others return when they turn 50. I left the model as close as I could to the previous one.


States = {
twenties, thirties, forties, fifties, sixties,
thirtiesNOGO, fortiesNOGO
};

Inputs = {
newpa, # Number of young people becoming concert-goers pa
};

Outputs = {
input,
avgage,
total
};

decade = 10.0;
bins = 5.0; # no. of decades modeled
population = 1.0e6; # total initial concertgoers

fractionNOGO = 0.50; # fraction of twenties who leave for two decades
fractionQUIT = 0.20; # fraction of twenties who leave forever

Initialize{
twenties = (population / bins) * (1 + fractionQUIT);
thirties = (population / bins) * (1 - fractionNOGO);
thirtiesNOGO = (population / bins) * fractionNOGO;
forties = (population / bins) * (1 - fractionNOGO);
fortiesNOGO = (population / bins) * fractionNOGO;
fifties = population / bins;
sixties = population / bins;
}

Dynamics{
from20spa = twenties / decade;
to40spa = thirties / decade;
to50spa = forties / decade;
to60spa = fifties / decade;
endingpa = sixties / decade;

quittingpa = fractionQUIT * from20spa;
hiatuspa = fractionNOGO * from20spa;
to30spa = from20spa - (quittingpa + hiatuspa);

to40NOGOpa = thirtiesNOGO / decade;

returningpa = fortiesNOGO / decade;

dt(twenties) = newpa - (to30spa + quittingpa + hiatuspa);
dt(thirties) = to30spa - to40spa;
dt(thirtiesNOGO) = (hiatuspa - to40NOGOpa);
dt(forties) = to40spa - to50spa;
dt(fortiesNOGO) = (to40NOGOpa - returningpa);
dt(fifties) = (to50spa + returningpa) - to60spa;
dt(sixties) = to60spa - endingpa;
}

CalcOutputs{
input = newpa;
total = twenties + thirties + forties + fifties + sixties;
avgage = (25.0 * twenties + 35 * thirties + 45 * forties
+ 55 * fifties + 65 * sixties) / total;
}


If the last model was quick and simple, perhaps this one is quick and dirty, for it had much less testing than the other one. I did it primarily to start a conversation we haven't finished yet, and I'll spruce up this model and test it more adequately as we go.

The reason to show this to you is to show how easy it is to change such a model to incorporate new conjectures. What's more, because these are text models, it's quite easy to use diff to see what's changed between the two. Because the entire model is in text, you can see the entire thing at one glance.

Here's the associated simulation file that describes the experiments. As you can see, it's almost like the other one; I just had to add the new parameters.


Integrate(Lsodes, 1e-6, 1e-6, 1);
OutputFile("simplerun02.out");
StartTime(0.0);
fractionNOGO = 0.50;
fractionQUIT = 0.20;

Simulation{
newpa = NDoses(2,20000.0,10000.0,0.0,10.0);
PrintStep(input,0.0,200.0,1.0);
PrintStep(total,0.0,200.0,1.0);
PrintStep(avgage,0.0,200.0,1.0);
}

Simulation{
newpa = PerExp(20000.0, 400.0, 0.0, 0.010);
PrintStep(input,0.0,200.0,1.0);
PrintStep(total,0.0,200.0,1.0);
PrintStep(avgage,0.0,200.0,1.0);
}

Simulation{
newpa = NDoses(2,20000.0,0.0,0.0,10.0);
PrintStep(input,0.0,200.0,1.0);
PrintStep(total,0.0,200.0,1.0);
PrintStep(avgage,0.0,200.0,1.0);
}
END.


For more on the syntax used in these files, see the documentation for MCSim.

Eagle-eyed readers will catch a spelling error and a mistake in the version I published previously. I've fixed those problems in the model shown here. Interestingly, the simulation outputs only change slightly, and their shape is the same, both because the dynamics are heavily controlled by the main aging chain and the cutoff of new attendees and because the mistake substituted a variable with a similar value. Thus I'm not providing new graphs.

In actually working on this model, I found it faster to print all the stocks and flows and then use the analysis program to select which variables to explore. In this appendix, I'm only showing print statements for the key variables used to produce the graphs in the report, so you have less text to read.

Labels: , ,

0 Comments:

Post a Comment

<< Home