Hi , I have a matrix of intensities (n*p). I want to add an outlier to it. Do you have any idea about how to simulate an outlier? I was thinking to take the mean of matrix and then multiply it to some very high value?
Do you have any idea ?

 採用された回答

Star Strider
Star Strider 2014 年 5 月 22 日

1 投票

I suggest:
M = rand(4,5); % Create data
Msts = [mean(M(:)) std(M(:))];
Outlier = Msts(1)+5*Msts(2);
Define the outlier by a multiple of the standard deviation from the mean. An value of 5*std is quite far out.

8 件のコメント

Niki
Niki 2014 年 5 月 22 日
It does add a value. If I have a matrix of lets say 30 samples (number of sample* number of points) I want to add a row (an outlier sample) which has the dimension of 1%number of points
Star Strider
Star Strider 2014 年 5 月 22 日
This works:
OutRow = Msts(1)+rand(1,30).*5*Msts(2);
I chose 5*std, increase the ‘5’ to get values even further out.
Niki
Niki 2014 年 5 月 22 日
編集済み: Niki 2014 年 5 月 22 日
This generates a random noise. I am not interested in noise Please find attached a example data If you plot it, you can see how they look like >>plot(X')
Star Strider
Star Strider 2014 年 5 月 22 日
I thought you wanted a random vector of outliers.
This will give you a row of constants:
OutRow = Msts(1)+ones(1,30).*5*Msts(2);
Here’s a version using your ‘X’ array from your ‘example.m’ file:
load('example.mat')
OutsX = mean(X(:)) + ones(1,size(X,2)).*5*std(X(:));
figure(1)
mesh([X; OutsX])
Niki
Niki 2014 年 5 月 22 日
Thanks BUT it is not what I am looking for. creating a constant vector is not very hard.
I definitely want a random vector not a constant as your latter post. I want to have more or less the same shape as the example I gave you and generated based on that data. If we have a constant value in a data set, it is very easy to detect it and discard it. It should be an outlier which you cannot detect it easily by naked eye :-)
Star Strider
Star Strider 2014 年 5 月 22 日
See if this does what you want:
load('example.mat')
OutsXR = mean(X,2) + 5*std(X,[],2);
figure(1)
plot([X OutsXR])
Niki
Niki 2014 年 5 月 22 日
Not that one but this one helps
OutsXR = mean(X,1) + 5*std(X,[],1);
however, I accept your answer Thanks
Star Strider
Star Strider 2014 年 5 月 22 日
My pleasure, and thanks!

サインインしてコメントする。

その他の回答 (1 件)

Roger Wohlwend
Roger Wohlwend 2014 年 5 月 22 日

0 投票

Actually you answered your question yourself. Instead of the mean I would use the maximum value of the matrix. Multiply that number by a certain value. That's all. It is quite easy.

1 件のコメント

Niki
Niki 2014 年 5 月 22 日
In fact, I want to know whether it is scientifically correct or not? It is not a number. As I explained it is a matrix of n*p so I wont have a value as outlier but a row which corresponds as an outlier
On the other hand, do you know any way to show it as a outlier ?

サインインしてコメントする。

タグ

質問済み:

2014 年 5 月 22 日

コメント済み:

2014 年 5 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by