Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Advanced Simulation Methods > Kalman Filtering

Combining Filtering and Optimization

Scroll Prev Top Next More

The Kalman filter provides a valuable way to make indirect measurement of the behavior of model variables.  We can combine filtering with optimization to get indirect measurements of the structural parameters in the model.  

Suppose that we only have measurements on Workforce, and we want to estimate the underlying parameters time correct inventory and time adjust workforce.  To do this we set up an optimization file (wfkal.voc)

:SENSITIVITY=payoff_value=2

1 <= time_correct_inventory=20 <= 50

1 <= time_adjust_workforce=20 <= 50

The :SENSITIVITY line tells Vensim to find a 95% confidence bound on the estimates.  With this file in place, and again using wfkal2.vpd with Kalman filtering turned on, start an optimization.

An error screen will appear and, after a time, report the results:

Initial point of search

TIME CORRECT INVENTORY = 20

TIME ADJUST WORKFORCE = 20

Simulations = 1

Pass = 0

Payoff = -129.708

---------------------------------

Maximum payoff found at:

TIME CORRECT INVENTORY = 3.88819

*TIME ADJUST WORKFORCE = 12.4016

Simulations = 159

Pass = 3

Payoff = -94.5603

---------------------------------

The :SENSITIVITY command puts output to a file called sensitiv.tab.  This file contains:

:COM The base payoff is     -99.3714

:COM A * Means a bound was reached, i.e. payoff not at criterion.

:SENSITIVITY = PAYOFF_VALUE = 2.000000

2.98486 <= TIME CORRECT INVENTORY =      3.82884 <=      5.04371

10.0239 <= TIME ADJUST WORKFORCE =      12.5768 <=      16.2581

TIME CORRECT INVENTORY was estimated to be 3.8 and, with 95% confidence lies between 3 and 5. TIME ADJUST WORKFORCE was estimated to be 12.6 and, with 95% confidence lies between 10 and 16.  Since we are doing true maximum likelihood, the confidence bounds are not necessarily symmetric.

Optimization Without Filtering

These results are reasonable, and need to be contrasted to the case in which no filtering is in use.  To do this use wfkal_w.vpd for the payoff  and rerun the optimizer with filtering turned off.  The weights in the payoff file have a very different interpretation when using filtering. wfkal_w.prm gives a weight of .12 to MEASURED WORKFORCE - this is 1/standard deviation and is appropriate for a payoff without filtering.==F_33} The results, much more quickly this time are:

Maximum payoff found at:.    

TIME CORRECT INVENTORY = 2.78701

*TIME ADJUST WORKFORCE = 18.5704

Since we are now using sum of squares we can get a 95% confidence bound by setting PAYOFF_VALUE = 4.  When we do this we get confidence bounds that put TIME CORRECT INVENTORY between 2.7 and 2.9 and TIME    ADJUST  WORKFORCE between 18 and 19.  The actual parameters are, of course, well outside of these confidence bounds.  The bottom line is that care needs to be taken when doing simple simulation on systems for which there is extremely limited measurement.