**From:** Christian Hennig (*fm3a004@math.uni-hamburg.de*)

**Date:** Wed 05 May 2004 - 00:36:49 EST

**Next message:**Martin Henry H. Stevens: "[R] degrees of freedom in lm() treatment contrasts"**Previous message:**Adaikalavan Ramasamy: "Re: [R] more on lm(y~x) question: removing NA´s"**Next in thread:**Roger Bivand: "Re: [R] spdep question"**Reply:**Roger Bivand: "Re: [R] spdep question"

Message-id: <Pine.GSO.3.95q.1040504163459.29042E-100000@sun11.math.uni-hamburg.de>

Dear list,

(also sent to Roger Bivand, but perhaps somebody of you can help me also)

I am trying to use package spdep for fitting an SAR model with errorsarlm.

However, I am not sure how to make a valid nb object out of my

neighborhood. As far as I have seen, there is no documentation for

nb.object.

I have done the following:

class(pschmid$nb) <- "nb"

# pschmid is a prab object as generated from function prabinit, package

# prabclus, and the neighborhood looks as follows:

*> unclass(pschmid$nb)
*

[[1]]

[1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

[[2]]

[1] 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

[[3]]

[1] 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

(...and so on, a list of 65 integer vectors, up to...)

[[65]]

[1] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

60 61

[26] 62 63 64

# This looks more or less like the example (cal.gol.nb), apart from some

# attribs which I do not understand, and it is exactly

# how an nb object is described in help(read.gal). But...

*> summary(pschmid$nb)
*

Neighbour list object:

Number of regions: 65

Number of nonzero links: 0

Percentage nonzero weights: 0

Average number of links: 0

65 regions with no links:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

54 55 56 57 58 59 60 61 62 63 64 65

Link number distribution:

0

65

# Why are there no links? Do I understand properly what a link is?

# 1 is a neighbor of 2 and vice versa, so I consider them linked?

Can somebody tell me how to turn my neighborhood into an object errorsarlm

and nb2listw (do I need that?) can handle!

Best,

Christian

***********************************************************************

Christian Hennig

Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg

hennig@math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/

#######################################################################

ich empfehle www.boag-online.de

______________________________________________

R-help@stat.math.ethz.ch mailing list

https://www.stat.math.ethz.ch/mailman/listinfo/r-help

PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

**Next message:**Martin Henry H. Stevens: "[R] degrees of freedom in lm() treatment contrasts"**Previous message:**Adaikalavan Ramasamy: "Re: [R] more on lm(y~x) question: removing NA´s"**Next in thread:**Roger Bivand: "Re: [R] spdep question"**Reply:**Roger Bivand: "Re: [R] spdep question"

*
This archive was generated by hypermail 2.1.3
: Mon 31 May 2004 - 23:05:07 EST
*