471,354 Members | 1,487 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

A simple question about "clustering" ...


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

Sep 12 '07 #1
5 1946
On Sep 12, 10:32 am, Lakesider <i...@rudolfball.comwrote:
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

Sep 12 '07 #2
JS
Or use the median, which is 34 in your example.

Sep 12 '07 #3
On 12 Sep., 11:46, JS <jnospams...@gmail.comwrote:
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".

Sep 12 '07 #4
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:
On 12 Sep., 11:46, JS <jnospams...@gmail.comwrote:
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".

Sep 12 '07 #5

"Lakesider" <in**@rudolfball.comwrote in message
news:11**********************@50g2000hsm.googlegro ups.com...
>
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.
Sep 12 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.