On this Picostat.com statistics page, you will find information about the cities data set which pertains to Distances between 11 US cities. The cities data set is found in the psych R package. You can load the cities data set in R by issuing the following command at the console data("cities"). This will load the data into a variable called cities. If R says the cities data set is not found, you can try installing the package by issuing this command install.packages("psych") and then attempt to reload the data. If you need to download R, you can go to the R project website. You can download a CSV (comma separated values) version of the cities R data set. The size of this file is about 638 bytes.
Distances between 11 US cities
Airline distances between 11 US cities may be used as an example for multidimensional scaling or cluster analysis.
A data frame with 11 observations on the following 11 variables.
Washington, District of Columbia
Los Angeles, California
New York, New York
San Francisco, California
New Orleans, Lousianna
An 11 x11 matrix of distances between major US airports. This is a useful demonstration of multiple dimensional scaling.
city.location is a dataframe of longitude and latitude for those cities.
Note that the 2 dimensional MDS solution does not perfectly capture the data from these city distances. Boston, New York and Washington, D.C. are located slightly too far west, and Seattle and LA are slightly too far south.
city.location[,1] <- -city.location[,1]
#an overlay map can be added if the package maps is available
#title("MultiDimensional Scaling of US cities")
#points(city.location)plot(city.location, xlab="Dimension 1", ylab="Dimension 2",
main ="Multidimensional scaling of US cities")
city.loc <- cmdscale(cities, k=2) #ask for a 2 dimensional solution round(city.loc,0)
city.loc <- -city.loc
city.loc <- rescale(city.loc,apply(city.location,2,mean),apply(city.location,2,sd))
Dataset imported from https://www.r-project.org.