Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reduce to zero
Message
From
05/02/2009 16:38:10
 
 
To
05/02/2009 12:42:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01379529
Message ID:
01379657
Views:
15
>Dave,
>
>The problem I have is this: I get sent some data from a 3rd party. Values are in the range from 0 to +/-1000 or so. Sometimes the 3rd party makes a mistake and a data element may be accidentally set to zero. Then the next day I may get a non-zero value again, going back to the correct data range. This creates a data spike to zero which looks bad on a line chart (each individual point is not particularly important per se – rather the general trend of the data is).
>
>So I want to say if the data today is zero, but the previous point is not, then assume the zero value is an error. To avoid a spike just reduce the previous value by some amount. If the next day the value is zero again then I will again reduce the previous value (already reduced) by some amount. If the data has truly fallen to zero then within a finite/limited number of steps the data will reduce steadily to zero as well and no spike in the plot is shown rather the data just trails off to zero.
>
>I don’t know if the previous data point has already been reduced or not and I don’t know when the first zero value occurred (unless I program and store additional info which I dont want to do). Hence I need a formula to just reduce a previous value by some amount if the current value is zero. And to be able to repeat that process a finite number of times so that eventually, if the data truly is now zero, that the data will fall to zero. The purpose here is to avoid data spikes caused by errors in the data.

If the chart is being used for decision-making, I'd suggest the worst thing you could do would be to manufacture data points as you are proposing. If you do that, in future there's no way to distinguish between real data points and those you've manufactured, which will in the general case affect the overall trend you're trying to determine/show.

It sounds as though the data value may sometimes actually be zero, but there may be a lot of reasons why a zero value may be an error. Probably the best option is to let your users decide for themselves.
I'd recommend giving your users two charting options e.g. "Raw Data" and "Zeroes Filtered Out". Then they'd be able to see for themselves if it was a one-time glitch, the 3rd-party data analyst went on holiday for a week or whatever. As long as they can see the raw data, no-one can complain they don't have all the information, which is usually what's important to decision-makers.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform