[R] data(eurodist) and PCA ??
Dan Bolser
dmb at mrc-dunn.cam.ac.uk
Wed Oct 13 16:47:19 CEST 2004
On 13 Oct 2004, Jari Oksanen wrote:
>On Wed, 2004-10-13 at 09:51, Prof Brian Ripley wrote:
>> On Wed, 13 Oct 2004, Dan Bolser wrote:
>
>> > I have a complex distance matrix, and I am thinking about how to cluster
>> > it and how to visualize the quality of the resulting clusters.
>>
>> Using PCA and plotting the first two components is classical
>> multi-dimensional scaling, as implemented by cmdscale(). Look up MDS
>> somewhere (e.g. in MASS). It is exact if the distances are Euclidean in
>> 2D. However, eurodist gives road distances on the surface of sphere.
>>
>> Classic examples for the illustration of MDS are departements of France
>> based on proximity data and cities in the UK based on road distances.
>>
>These road distances seem to be very non-Euclidean indeed (even
>non-metric). It seems to be 2282km from Athens to Milan if you go
>directly, but if you go via Rome it is only 1403km:
All roads lead to rome? Aparently that is true if you ever try to get out
of the place in rush hour.
>> trip <- c("Athens", "Rome", "Milan")
>> as.matrix(eurodist)[trip, trip]
> Athens Rome Milan
>Athens 0 817 2282
>Rome 817 0 586
>Milan 2282 586 0
>> 817 + 586
>[1] 1403
>
>I thought that World is non-Euclidean, but not that obviously.
yes, especially not europe on its own. My geography is worse than my
statistics, but it looked a bit mangled up even to me.
Thanks very much both again,
Dan.
>
>cheers, jari oksanen
>
>
>
More information about the R-help
mailing list