[R-sig-Geo] listw spatial weights for panel data

Roger Bivand Roger.Bivand at nhh.no
Wed Aug 15 08:39:11 CEST 2012


On Wed, 15 Aug 2012, Jerg Gutmann wrote:

> Dear all,
>
>
>
> I would like to append a listw object to another listw object such that I
> can keep it in its format. The idea is creating a spatial weights list for
> countries and years based on cshapes.

Why? Simply appending listw objects will lead to wring indexing, won't it, 
as the listw objects only index 1:n for their sets of spatial 
observations. Your approach will not show how say France 1949 relates to 
Spain 1962 (which should have different indices), will it?

If you need a collection of listw objects, put them in a list, and access 
them from that. This is what is done for multiple lag orders, see ?nblag, 
but there the numbers and indices of spatial observations do not change, 
while yours change over time (Czechoslovakia -> Czech Republic and 
Slovakia). You need to think through the consequences of your 
representation - appending listw objects is not the right question.

Hope this clarifies,

Roger

> However, I was not able to combine two
> listw objects without turning them into a regular list. Is there any simple
> trick or is what I would like to do anyway useless for current spatial
> analysis packages (e.g. splm or spdep)? I am relatively new to both R and
> spatial analysis and would be happy about any comments!
>
>
>
> Jerg
>
>
>
> result0 <- distmatrix(as.Date("1950-6-30"), type="capdist", useGW=T)
>
> result0 <- 1/result0
>
> diag(result0) <- 0
>
> result <- mat2listw(result0)
>
> result$year <- 1950
>
> # loop
>
> for (year in 1951:1960) {
>
>   date.current <- paste(year, "6", "30", sep="-")
>
>   result.current <- distmatrix(as.Date(date.current), type="capdist",
> useGW=T)
>
>   result.current <- 1/result.current
>
>   diag(result.current) <- 0
>
>   result.current2 <- mat2listw(result.current)
>
>   result.current2$year <- year
>
>   result <- #???#(result, result.current2) }
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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