Page 1 of 1

Normalizing Variables

Posted: Tue May 30, 2023 3:33 am
by geo_curious
Hi All,

I would like to normalize a variable output from 0 to 1. The formula for this is normalized_var = (var - min_var) / (max_var - min_var)

How do I implement this in DSS? The subscript protocol is not entirely clear to me for iterating. MIN and MAX take two variables and their use is not appropriate in this case.

I found very little on the forum about this, but it is a pretty standard operation. Perhaps I missed something. I just need to know the implementation formulas in Vensim DSS.

Thanks!

Re: Normalizing Variables

Posted: Tue May 30, 2023 7:27 am
by Administrator
I think we need more info.

When you mention min_var and max_var, are you referring to the min/max of a variable over the entire simulation?

The following is perfectly valid Vensim syntax, so I'm not sure why it's troublesome to just use this.
normalized_var = (var - min_var) / (max_var - min_var)

Re: Normalizing Variables

Posted: Tue May 30, 2023 5:02 pm
by geo_curious
The problem is that there is no way to search for the min and max, from what I can see in the documentation. If someone could provide the built-in formula for how to find the min and max of a variable output, then I could use the equation.
Thank you!

Re: Normalizing Variables

Posted: Tue May 30, 2023 5:23 pm
by Administrator

Re: Normalizing Variables

Posted: Wed May 31, 2023 10:49 am
by geo_curious
Interesting. The MIN(A, B) must be MIN(self1,self1) for that to work. The “minimum of two alternatives.” That is a bit of nonsense but I can guess and check.

Re: Normalizing Variables

Posted: Wed May 31, 2023 2:11 pm
by Administrator
I'm very confused by this thread.

If you want the min/max during a simulation, you can use those two functions.

If you want the min/max once a simulation has ended, the stats tool will give you these.

Does this solve the problem?