Error Messages/42652
Example Warning Message
- A result computed differs from what would be computed by releases before Analytica 4.4. The function Sum was applied to an array containing only Null values. The Analytica 4.4 result is Null, while 4.3 and earlier releases return 0.
Cause
Bug fixes in Analytica 4.4 implement a more uniformly consistent treatment of the case in which functions are applied to arrays containing only Null values. The general principle that has been followed by most Analytica functions is that the result of applying an array function to an array of Null values should be Null. However, up through 4.3, several legacy functions lingered that did not abide by this principle.
The fact that this has occurred might not have any impact on your final results, and indeed often it does not. In other cases, it may trigger an error that was not previous reported, or you may see Null values propagate to your final result where 0s existed previously. This warning is helpful for finding where these cases occur.
Consistent treatment
Suppose A := Array(I,[Null,Null,Null]). Then a consistent behavior by array functions (i.e., Analytica 4.4) would be:
Sum(A,I) → NullMax(A,I) → NullArgMax(A,I) → NullProduct(A,I) → NullAverage(A,I) → NullNpv(2%,A,I) → NullSDeviation(A,I) → NullArea(A,I) → Null- etc
Inconsistent cases pre-4.4
In pre-4.4 releases, not all functions treated the all-Null case in this fashion. Here are the values returned for each case in Analytica 4.3:
Function call
result
(A is all-Null)
result
(when Size(I)==0)
Sum(A,I)
→
0
Product(A,I)
→
1
Area(A,I)
→
0
Average(A,I)
→
NaN
SDeviation(A,I)
→
NaN
Undefined
Variance(A,I)
→
NaN
0
Skewness(A,I)
→
NaN
0
Kurtosis(A,I)
→
NaN
0
ArgMin(A,I)
→
Size(I)
Null
ArgMax(A,I)
→
Size(I)
Null
Remedy
Several remedies are possible:
- Visit the place in the model where this occurs and ensure that your model does the right thing when Null is returned.
- Turn off just this warning, use the consistent Null result computed by Analytica 4.4.
- Ignore all warnings (not recommended)
- Set a system variable to return the Analytica 4.3 result values for full backward compatibility.
Doing both Options 1 and 2 is the recommended course of action. If this is causing changes to your end results, then Option 4 is the easy way to achieve quick backward compatibility; however, we recommend that you take option 1 & 2 instead when possible.
Model fixes
In many cases, the fact that a given function is returning Null in the all-Null case will not actually impact your final result. For example:
This evaluates the same in both cases, when Sum(A,I)→0 and when Sum(A,I)→Null. This is because the outer Sum either adds 0 for the second item, which has no impact on the total sum, or ignores the Null, which also has no impact on the total sum.
However, when the result is subjected to binary operators, +, -, *, /, or ^, or comparisons, <, ≤, <>, or =, then the net result will be Null. Binary operators return Null when either value is Null. It is predominantly these cases that could impact your model's end results.
7 + Sum(A,I) |
→ Null | { in Analytica 4.4 } | |
7 + Sum(A,I) |
→ 7 | { in Analytica 4.3 } |
Turning off warnings
The flag to warn about this situation is enabled when you load a legacy model into Analytica 4.4 (i.e., a model that had been created in Analytica 4.3 or earlier). Once you are confident that this condition does not impact your model's results, you will want to turn it off. This is done from typescript. Press F12, then type:
Sys_AllNullTreatment : 0
A value of 1 enables this set of warnings, while 0 turns them off.
Using Legacy results
If you decide you want to stick with the pre-4.4 results for full easy backward compatibility (and the less-consistent treatment of Nulls), then you can set a flag for this from typescript. Press F12 then type:
Sys_AllNullTreatment : 2
Enable comment auto-refresher