Statistics

Use this forum to post Vensim related questions.
Post Reply
burley
Junior Member
Posts: 4
Joined: Fri Sep 18, 2009 12:47 pm

Statistics

Post by burley »

I need to assess a minimum required simulation length from the convergence profile of mean and variance values of a simulated variable. The variable in case is an "item" variable created by a pulse (of value 1 and short duration) and residing in a queue. The statistics I need (for each time) is the average number of items (up to that time) in the queue (so it's actually a discrete counting counting problem that I need simulated in Vensim).

This is what I have done: I have created two stocks for mean and variance:

Mean (stock) = INTEG ( XIDZ(x, Time, 0) )

Var (stock) = INTEG ( XIDZ( (x - Mean)^2, Time, 0) )

Even simulation over long duration does not provide the desired convergence property, can there be any "creep" in the above equations? More to the point: is this the right way of calculating statistical properties of time series in Vensim? Thanks.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

The equation for mean value of the variable x (assuming difference equations) would be

mean value x = (accumulated x + x*TIME STEP)/(Time-INITIAL TIME+TIME STEP) ~ Widget
accumulated x = INTEG(x,0) ~Widget * Month

for variance you need to use the fact that (x-xbar)^2 = x^2 -2*x*xbar + xbar^2 and since xbar is constant x*xbar just gets you back to xbar*xbar so you have

accumulated xsquare = INTEG(x*x,0) ~Widget*Widget*Month
variance x = (accumulated xsquare + x*x*TIME STEP)/(Time - INITIAL TIME + TIME STEP) - mean value x^2 ~Widget*Widget

I didn't test these, but they should work. If your model is continuous, or you don't care about the first time step then you can drop the + x*TIME STEP and just use Time-INITIAL TIME with a zidz function - same for variance.
Post Reply