|
|
BoxPlot Outliers Values Detection
I am using boxplot function to identify outliers.
I am using it in the format boxplot(Demand,Prices).
I need to get the values of the outliers as a list (Demand1,Price1)
How can I do that without using gname as am running on a huge data file so interactively naming it won't be realistic!
|
|
0
|
|
|
|
Reply
|
Essraa
|
10/20/2010 12:48:03 PM |
|
> I am using boxplot function to identify outliers.
> I am using it in the format boxplot(Demand,Prices).
>
> I need to get the values of the outliers as a list (Demand1,Price1)
>
> How can I do that without using gname as am running on a huge data file so
> interactively naming it won't be realistic!
There may be easier ways, but this is what comes to mind. Find the handles
of all the outliers. Concatenate the data into vectors. Remove NaNs if you
want, corresponding to groups without outliers. For example:
load carsmall
boxplot(Weight,Origin)
h = findobj(gcf,'tag','Outliers');
xc = get(h,'XData');
yc = get(h,'YData');
x = horzcat(xc{:});
y = horzcat(yc{:});
At this point x will contain group numbers, and y will contain data values.
Both may also contain NaNs.
-- Tom
|
|
0
|
|
|
|
Reply
|
Tom
|
10/20/2010 4:42:32 PM
|
|
Dear Tom,
Thanks for your prompt reply. It yielded what I needed.
I was wondering if you knew about the know how to get it through a good book or tutorial or by trial and error and experience.
Thanks again,
Essraa
"Tom Lane" <tlane@mathworks.nospam.com> wrote in message <i9n65o$i2s$1@fred.mathworks.com>...
> > I am using boxplot function to identify outliers.
> > I am using it in the format boxplot(Demand,Prices).
> >
> > I need to get the values of the outliers as a list (Demand1,Price1)
> >
> > How can I do that without using gname as am running on a huge data file so
> > interactively naming it won't be realistic!
>
> There may be easier ways, but this is what comes to mind. Find the handles
> of all the outliers. Concatenate the data into vectors. Remove NaNs if you
> want, corresponding to groups without outliers. For example:
>
> load carsmall
> boxplot(Weight,Origin)
> h = findobj(gcf,'tag','Outliers');
> xc = get(h,'XData');
> yc = get(h,'YData');
> x = horzcat(xc{:});
> y = horzcat(yc{:});
>
> At this point x will contain group numbers, and y will contain data values.
> Both may also contain NaNs.
>
> -- Tom
|
|
0
|
|
|
|
Reply
|
Essraa
|
10/21/2010 7:55:11 AM
|
|
|
2 Replies
983 Views
(page loaded in 0.044 seconds)
|
|
|
|
|
|
|
|
|