Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Creating a matrix from an excel table


From   Diego Canales <[email protected]>
To   [email protected]
Subject   st: Creating a matrix from an excel table
Date   Thu, 31 Mar 2011 19:08:28 -0700

Hi everyone,

I'm working with a network spatial weights matrix brought into excel which basically tells me the distance among my 200 observations. It is not laid out in matrix format since it was built like the gwt files from Geoda but with actual distances.

First row is just a formatting issue for gwt, but starting from row two, the first column is the ID for my first variable, the second column is the ID of the other matching variables, and the third column is the distance.

Here is how it looks like.

0 40000
1	56	298.5816873
1	55	466.3318352
1	2	537.7437382
1	3	736.950696
1	58	761.8313998
1	141	820.9843873
1	57	832.6894503
1	13	893.208735
1	135	896.4010734

I am trying to figure out how to bring it into Stata so I can perform a multidimensional scaling and create new latitudes and longitudes for my observations in order to run a K-means cluster algorithm, which uses either euclidian distances or manhattan distances as their default (I want to use my own network distances).

Does anyone know how could I import my data as a matrix into Stata, or Mata I guess? I'm aware that I am constrained with the matrix size (I have Stata SE, so 11,000 matrix maximum), so I'm planning on deleting observations that are above a certain threshold and come up with a smaller matrix.

Thanks,
Diego
---------------------------------------------------------------
Diego Canales
Master of City Planning | MCP'11
University of California at Berkeley
(415) 971-2916

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index