search for: poly2nb

Displaying 6 results from an estimated 6 matches for "poly2nb".

2011 May 07
1
spdep::poly2nb problem
...into my working directory. Then in R (version 12.2.0 for ms-win32): library(rgdal) # Version: 0.6-28 library(spdep) # Version: 0.5-24 (loads sp: Version: 0.9-72) # read in the data states<-readOGR(".","s_01de10") summary(states) # now create a neighbors list states_nb<-poly2nb(states) # create a 0/1 matrix of the neighbors nb_mat<-nb2mat(states_nb,style="B",zero.policy=TRUE) # add names nms<-as.character(states$NAMES) # set the matrix names dimnames(nb_mat)<-list(nms,nms) # now see which states have no neighbors rowSums(nb_mat) # it turns out that Fl...
2013 Aug 20
1
obtener matriz de contactos
Hola Freddy. Yo parto de un shape en que tengo los típicos archivos .shp, .sbx, .sbn, .shx y .dbf. En la tabla tengo el área de los poligonos en m2, el perímetro, el estado y el código ISO del estado dispuesto por el SGM. ¿Me puedes orientar un poco más? Gracias, Sebastían. El 14 de agosto de 2013 16:19, Freddy Omar López Quintero < freddy.vate01@gmail.com> escribió: > Hola
2004 Feb 19
1
How to create a "nb" object?
Hi group, I'd like to do spatial analysis of my data using the spdep package. It appears that a file of class nb is necessary, but I do not find what that should look like and if there is a function that creates such file for me. How can I create a nb-object of my data points? Thanks, René Eschen. [[alternative HTML version deleted]]
2011 Jun 27
0
OpenBUGS and glmmBUGS package
...pping package document: ---------------------------------------- library(diseasemapping) data(popdata) data(casedata) model = getRates(casedata, popdata, ~age*sex, breaks=seq(0, 90, by=10) ) ontario = getSMR(popdata,model, casedata) spplot(ontario, 'SMR') library(spdep) popDataAdjMat = poly2nb(ontario, ontario[["CSDUID"]]) library(glmmBUGS) forBugs = glmmBUGS(formula=observed + logExpected ~ 1, effects="CSDUID", family="poisson", spatial=popDataAdjMat, data=ontario at data, modelFile="model.txt") startingValues = forBugs$startingValues source(&...
2018 Jan 27
0
GAM: mismatch between nb/polys supplied area names and data area names
..."01", "02",..."50" #read in the shapefile and create the neighborhood object nb, #names(nb) must correspond to the levels of the covariate of the smooth (i.e. the area labels) shape<-readOGR(dsn="~/Long/MENHShape",layer=("MENHShape2")) nb <- poly2nb(shape, queen = TRUE, snap=100, row.names=datawide$id) names(nb) <- attr(nb, "region.id") #run GAM spatial neighbors plus covariates gamspcov <- gam(y2008_2014rate~s(id, bs="mrf", xt = list(nb = nb), k=20) + s(deermi2) + s(t14), family=nb( ), data=datawide, method="ML...
2013 Apr 16
1
Spatial Ananlysis: zero.policy=TRUE doesn't work for no neighbour regions??
...tial Weights Matrix. *I us the following code to create the Neighbourslist:* >library(maptools) >library(spdep) >library(rgdal) >location_County<- readShapePoly("....") >proj4string(location_County)<- CRS("+proj=longlat ellps=WGS84") >location_nbq<- poly2nb(location_County) >summary(location_nbq) *And get this Output:* Neighbour list object: Number of regions: 3109 Number of nonzero links: 18246 Percentage nonzero weights: 0.1887671 Average number of links: 5.868768 4 regions with no links: 35 689 709 881 Link number distribution: 0 1...