[R-sig-Geo] How to Import Distance Band .gwt Matrix
Roger Bivand
Roger.Bivand at nhh.no
Sun Aug 10 11:43:16 CEST 2008
On Sat, 9 Aug 2008, adjemian wrote:
> List,
>
> I'm having some trouble importing a Geoda generated distance
> band weight matrix into R for use with the spdep regression
> tools. The "read.gwt2nb" function does not work, and even
> when I try to import a manually created version of the
> matrix, I cannot seem to get it into the right format to
> avoid frame errors when attempting to estimate lag/error
> models.
In general, it is sensible to include the verbatim command and error
messages from your console. The output of sessionInfo() is also helpful,
as it shows what platform you are using, and what the versions of loaded
packages are.
My guess is that you need to pay attention to the arguments to
read.gwt2nb(). Have you tried the example provided on the help page? Note
that the function only reads the neighbour links into an nb object, and
you have to retrieve the distances as shown in the example. It may help to
copy preceding commands in your question too, so that the origin og the
values given to the arguments is made plain. str() of those objects may
also help, if not too bulky.
I think that the errors in the model fitting functions will go away when
the weights are read in correctly. Once they are imported, it may be
interesting to re-create them with dnearneigh() and nbdist() within R,
just for safety's sake.
Hope this helps,
Roger
> Once I import the data in properly, I intend to
> perform a test of the common factor hypothesis, which is
> unavailable in Geoda.
>
> Up to this point, I've tried to use "mat2listw", but the
> program returns a faulty "matrix not standardized" warning,
> and then produces the frame errors after regression
> commands. So, I have two questions:
>
> 1) Is there a pre-packaged "read.gwt2..." function that
> imports distance based weight matrices into R for use with
> spdep?
> 2) Failing that, how can I import a distance band weight
> matrix into R (for use with spdep) while avoiding frame
> errors?
>
> Thanks in advance for your help!
> -Mike Adjemian
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list