Does Z-score calculate Anomalies ??

2 Ansichten (letzte 30 Tage)
khan
khan am 30 Mai 2017
Bearbeitet: Walter Roberson am 18 Jun. 2017
Hello,
I am using Precipitation data where i need to calculate Anomalies in Data, i am using Z-score for that purpose. i change the data as
data1=reshape(data,[],22);
then i used
data2=zscore(data1,[],2);
and finally i changed the data again as
data3=reshape(data2,100,150,22);
my output file only contain very strange values, the answer supposed to be changing both spatially and temporally.
Regards and Thanks in advance

Akzeptierte Antwort

John D'Errico
John D'Errico am 30 Mai 2017
Bearbeitet: John D'Errico am 30 Mai 2017
Does zscore calculate anomalies? Um, what do you mean by that? I know what the words mean, but without seeing your data, how can we know what you think is strange? zscore does exactly what it is designed to do.
I might point out that you first say your array is called Data, but then you show what you did to an array named data. There is a difference. Or maybe you are just a sloppy typist in your question. Or possibly you have written files of your own called zscore or reshape, that do something strange. Hard to know without seeing the data.
It is quite easy to save that array (data, or is it Data) into a .mat file. Then attach it to your question, using the paper clip button. Even better, save both data and data3 into a .mat file. Then we know exactly what you saw, and can determine if you did something strange.
Perhaps I can make a guess though. If you have very wild outliers in your data, then you will see something like this:
zscore([randn(1,5),1e6])
ans =
-0.40825 -0.40825 -0.40825 -0.40825 -0.40825 2.0412
Note that the first 5 numbers are entirely random. Yet no matter what they were originally, after zscore is used, the corresponding values will appear as if they are constant.
This happened because the outlier was so far out that zscore essentially had a numerical overflow. If I make the outlier not so strange, then things appear a bit more natural.
zscore([randn(1,5),100])
ans =
-0.44257 -0.37207 -0.39324 -0.40046 -0.43221 2.0406
But this is only a wild guess as to what you did. If you want a better answer, then you need to attach your data to your question, or to a comment on my answer.
  1 Kommentar
khan
khan am 30 Mai 2017
Thank You sir, i got the idea pretty clear , actually my data is (100x120x21), or (lat,lon,timesteps); which is precipitation data for 21 years. i want to see whether Z-score can help me in calculating anomaly (in the context of Climate sciences or meteorology). for that purpose i used reshape command to change my 3d-Matrix (precipitation data), to a 2d matrix, which now contains only total number of pixels and number of time series for each pixel. so instead of looping i used the command data2=zscore(data1,[],2); to make the operation faster. in the attach image i used r1 instead of data1, YES i am Sloppy typist just to make my work easy :);).....because this way i can remember where is my file i need at this moment. Now my values are fine since i read your last comment, By anomaly i want Z-score to show me how my precipitation data is deviating from its expected value thanks Sir, learned a lot from your comment

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!