[R-sig-Geo] Question about sum of dissimilarity command in spdep (ssw)

Roger Bivand Roger.Bivand at nhh.no
Wed Aug 12 20:40:39 CEST 2009


On Tue, 11 Aug 2009, Motamed, Mesbah J wrote:

> Dear Users,
>
>
>
> May I ask if more information is available concerning the ssw command in
> spdep? Within the spdep documentation, no references appear, and as such
> I'm having trouble understanding exactly what is meant by the term
> "dissimilarity" as well as the methods of distance it describes. If
> somebody could kindly offer a description of the formula underlying the
> sum of dissimilarity I would be sincerely grateful.
>

Please see:

      Assuncao, R. M, Neves, M. C., Camara, G. and Freitas, C. da C.
      (2006). Efficient regionalization techniques for socio-economic
      geographical units using minimum spanning trees. International
      Journal of Geographical Information Science Vol. 20, No. 7, August
      2006, 797-811

refered to in ?skater, which uses ssw(). In fact, the code of ssw is very 
explicit:

> ssw
function (data, id, method = c("euclidean", "maximum", "manhattan",
     "canberra", "binary", "minkowski", "mahalanobis", "other"),
     p = 2, cov, inverted = FALSE, otherfun)
{
     method <- match.arg(method)
     if (method == "other")
         return(otherfun(data, id))
     if (method == "mahalanobis")
         return(sum(mahalanobis(data[id, , drop = FALSE], colMeans(data[id,
             , drop = FALSE]), cov, inverted)))
     else return(sum(dist(rbind(colMeans(data[id, , drop = FALSE]),
         data[id, , drop = FALSE]), method, p = p)[1:length(id)]))
}
<environment: namespace:spdep>

so see ?mahalanobis and ?dist for the underlying explanations of the 
method= argument.

>
>
> On a related note, I would like to ask whether spdep can calculate a
> local measure of the Sokal statistic (close relative to the Moran's I
> and Geary's C). At present, it's not apparent to me whether this
> capability exists within the package, and to that end, if any guidance
> could be offered towards obtaining either a package or R code that can
> calculate the Sokal statistic, it would be much appreciated.
>

See ?sp.mantel.mc for an implementation, type="sokal". There may be others 
in ade4 or similar packages, there is a mantel() function in vegan; you'd 
need to construct the matrices yourself for this.

>
>
> Finally, since this is my first time using this list serve, may I ask
> whether a "search" feature for this list serve is available? I would
> hate to add already-answered questions to the pile.
>

Presently, use search on the full archive of the list in Nabble. 
Previously, RSiteSearch() on the command line also covered this list, but 
resources became overstretched at the search engine administrator's 
department. In fact pre-pending the list name in Google or other search 
engines should work too.

Hope this helps,

Roger

>
>
> With sincere thanks in advance for your responses,
>
>
>
> Mesbah J. Motamed
>
> Ph.D. Candidate
>
> Department of Agricultural Economics
>
> Purdue University
>
> http://web.ics.purdue.edu/~mmotamed
> <http://web.ics.purdue.edu/~mmotamed>
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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