Connecting Tech Pros Worldwide Forums | Help | Site Map

A simple question about "clustering" ...

Lakesider
Guest
 
Posts: n/a
#1: Sep 12 '07

Hi NG,

I have a question about data: I have travel-times from A to B like
this

from | to | sec.
A B 17
A B 18
A B 30
A B 32
A B 32
A B 33
A B 34
A B 35
A B 36
A B 37
A B 50
A B 71
A B 1895

I want to answer the question: "How long did most of the cars take?".
In this case, beetween 30 and 37 seconds, or simply 33 as an average
value. A simple average value is bad because of values like the last
one ...

How would you do this?

Thank you very much,

Rudi


Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#2: Sep 12 '07

re: A simple question about "clustering" ...


On Sep 12, 10:32 am, Lakesider <i...@rudolfball.comwrote:
Quote:
I have a question about data: I have travel-times from A to B like
this
>
from | to | sec.
A B 17
A B 18
A B 30
A B 32
A B 32
A B 33
A B 34
A B 35
A B 36
A B 37
A B 50
A B 71
A B 1895
>
I want to answer the question: "How long did most of the cars take?".
In this case, beetween 30 and 37 seconds, or simply 33 as an average
value. A simple average value is bad because of values like the last
one ...
>
How would you do this?
A common way is to remove the best 10% and the worst 10% - you can
then give the results either as a range or the average of the rest.
The "10%" can vary however you want, of course. No doubt someone with
a better stats background than me could give you good reasons for
taking particular values.

Jon

JS
Guest
 
Posts: n/a
#3: Sep 12 '07

re: A simple question about "clustering" ...


Or use the median, which is 34 in your example.

Lakesider
Guest
 
Posts: n/a
#4: Sep 12 '07

re: A simple question about "clustering" ...


On 12 Sep., 11:46, JS <jnospams...@gmail.comwrote:
Quote:
Or use the median, which is 34 in your example.
Thank you. Unfortunately the median is not a good way for me, because
there can be a lot of values out of the "cluster point".

=?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=
Guest
 
Posts: n/a
#5: Sep 12 '07

re: A simple question about "clustering" ...


Clustering usually is not the solution where you wish to get a single value.
Clustering will return the set of values where observations happen
approximately. In your case I would suspect four clusters are appropriate,
and they appear to be centered at 17.5, 33.5, 60.5, and 1895. The sample
size is very small so the analysis would be suspect...

To find the cluster centers for an arbitrary number of clusters you minimize
the sum of the distances for each observation to it's cluster center. There
are algorithms out there that we have used in the past. I think we used
K-Means clustering for the project we did, and you should be able to find
papers on it on the net. This may be overkill as the method was not treating
clustering of observations with one value, but rather observations with many
values. We clustered weather data where the centroid was a temperature,
windspeed, humidity, cloudcover object.

If you are trying to code to a set where you don't know the number of
clusters you wish to get out, which is much more common, then you would set
up a loop over the number of clusters (maximum) and find each solution for
cluster count = 2..n. The optimal solution has the lowest distance for any
observation to it's mean.

If in your example, you are really searching for a single value
representative in the data, then I believe the suggestion of removing the top
and bottom extremes. The ammount of data to remove really depends on whether
the data is normally distributed (famous bell curve) or some other
distribution method. From the data provided it would be hard to state that
it was normally distributed.

"Lakesider" wrote:
Quote:
On 12 Sep., 11:46, JS <jnospams...@gmail.comwrote:
Quote:
Or use the median, which is 34 in your example.
>
Thank you. Unfortunately the median is not a good way for me, because
there can be a lot of values out of the "cluster point".
>
>
Ben Voigt [C++ MVP]
Guest
 
Posts: n/a
#6: Sep 12 '07

re: A simple question about "clustering" ...



"Lakesider" <info@rudolfball.comwrote in message
news:1189589545.723283.141020@50g2000hsm.googlegro ups.com...
Quote:
>
Hi NG,
>
I have a question about data: I have travel-times from A to B like
this
>
from | to | sec.
A B 17
A B 18
A B 30
A B 32
A B 32
A B 33
A B 34
A B 35
A B 36
A B 37
A B 50
A B 71
A B 1895
>
I want to answer the question: "How long did most of the cars take?".
In this case, beetween 30 and 37 seconds, or simply 33 as an average
value. A simple average value is bad because of values like the last
one ...
Often one finds the mean (mu) and standard deviation (sigma). Discard any
values outside the interval (mu - 3*sigma, mu + 3*sigma), these are known as
outliers. The remaining values should be more meaningful, any of the
various averages should be pretty good when taken over the filtered set.


Closed Thread