This is similar to the model I've shared earlier (viewtopic.php?t=8552). I've noticed that state resetting is applied to all stocks, not just the one I define in the '.prm' file (PN1Stock/sp1_var/init_sp1_var). In these situations, how do I prevent a random stock 'S' getting changed because of the filter?
How do I narrow down the impact of filter?
-
- Senior Member
- Posts: 226
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: How do I narrow down the impact of filter?
You could set the driving noise for that stock to a very small value (not 0).
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 226
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: How do I narrow down the impact of filter?
Thanks a lot, Tom! Very helpful! I have a few other questions:
1. Should I also use 'PN1Stock | S/ COVAR' too? Or, is 'S/1e-10/1e-10' enough?
2. In general, when should we actually use 'Lev_1 | Lev_2/ LEV_1_2_COVAR'? When there are two process noise inputs?
3. How would you define 'LEV_1_2_COVAR'? Based on the variances of both stocks?
Thank you so much!
Ali
1. Should I also use 'PN1Stock | S/ COVAR' too? Or, is 'S/1e-10/1e-10' enough?
2. In general, when should we actually use 'Lev_1 | Lev_2/ LEV_1_2_COVAR'? When there are two process noise inputs?
3. How would you define 'LEV_1_2_COVAR'? Based on the variances of both stocks?
Thank you so much!
Ali
Re: How do I narrow down the impact of filter?
I think 'S/1e-10/1e-10 is enough.
The default assumption for off-diagonal covariance is 0. You only want to specify this term if there's plausible correlation between the noise affecting two states, which is not that common.
I'm not fully up on the math, but one situation might be as follows:
[stockA] -> flow -> [stockB]
If noise enters through the (unmeasured) flow, then disturbances to A and B are anticorrelated. However, if the situation is:
[stockA] -> flow -> [stockB] -> flow2
If there is also noise from flow2, the disturbance to A is only partly correlated with B.
The default assumption for off-diagonal covariance is 0. You only want to specify this term if there's plausible correlation between the noise affecting two states, which is not that common.
I'm not fully up on the math, but one situation might be as follows:
[stockA] -> flow -> [stockB]
If noise enters through the (unmeasured) flow, then disturbances to A and B are anticorrelated. However, if the situation is:
[stockA] -> flow -> [stockB] -> flow2
If there is also noise from flow2, the disturbance to A is only partly correlated with B.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 226
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: How do I narrow down the impact of filter?
This makes a lot of sense. Thank you so much, Tom!
Re: How do I narrow down the impact of filter?
The issue seems to be that when you leave off a stock from the kalman.prm file, Vensim assumes the initial Var for that stock to be 1, and the driving noise var to be 1e-6 (this is based on a quick comparison on a simple model like the above). I don't know if this assumption is well documented in the help, but could be consequential if people are not aware of it. It also requires one to add all non-affected stocks in the prm file with very small variances for driving noise/initial variance, which is a pain.
Tom, if 0 values for variances are problematic for numerical reasons, would it be possible to specify alternative default values somewhere (rather than listing all unaffected stocks in the prm file)?
Tom, if 0 values for variances are problematic for numerical reasons, would it be possible to specify alternative default values somewhere (rather than listing all unaffected stocks in the prm file)?