search for: dnearneigh

Displaying 20 results from an estimated 22 matches for "dnearneigh".

2007 Oct 26
1
Help needed on calculation of Moran's I
Hi, I am trying to calculate Moran's I test for the residuals for a regression equation, but I have trouble converting my coordinates into nb format. I have used the dnearneigh() funtion now with an arbitrarily high upper distance to make it include all plots. However, when I do the lm.morantest() I get a Moran's I value which is the same as the expected value and a P-value of 1. I have used the following code: >attach(lowland) >coords <- as.matrix(cbind(lon...
2007 Oct 15
1
Distance matrix in SpDep-package
...s and the Getis-Ord statistics) in R for analysing my data. However, I don't have x-y coordinates, but my data is in a distance matrix format. Is it possible to use the SpDep package with predefined distances as well instead of letting the program determining the distance itself by the function dnearneigh based on x-y coordinates. Or is there another package that can transform a distance matrix into "fake" x-y coordinates, so that the SpDep-package can work with it? Thank you very much for your answer. Kind regards, Elke Moons __________________________________ Elke Moo...
2005 Mar 04
1
R: Moran's I
Hi- I would like to assign distance classes (lags) to the moran''s I test in R. I don¹t have equally spaced points since I was mapping shrubs across a landscape (vs. an experiment or survey in a grid). I somehow need to select points based on the distances in the distance matrix (i.e., I need to select all pairs of points that occur 0-25 m from each other, 25-50 m, etc...). Does
2007 Nov 21
1
problem with nb2listw
...to R and I was hoping someone could help me with the error message I keep getting when I try to use the nb2listw() function. I have 45 sites and I want to get an autocorrelation value for sites within 1000m of each other. coords<-cbind(EAST,NORTH) coords<-as.matrix(coords) nb1000<-dnearneigh(coords,0,1000,longlat=TRUE) then when I try to run the nb2listw(nb1000, style="W") I get an error message of "Empty neighbour sets found". Can someone tell me what this means and how to possible fix it. Thanks Lynnette ~ Lynnette Dagenais M.Sc. Candidate Department of Renew...
2009 Jul 15
1
Simulation code error
...lSums(CM[j,])==1) + V <- names(xx) + V <- paste(V, collapse="+") + V <- paste("SBA~", V) + rd <- round(nrow(data)*(2/3)) + d <- sample(seq(1:nrow(data)),rd) + dat1 <- data[d,] + dat2 <- data[-d,] + crd <- cbind(dat1$Longitude,dat1$Latitude) + dist80 <- dnearneigh(crd,0,100,longlat=F) + dist80sw <- nb2listw(dist80, style="B") + fm <- errorsarlm(as.formula(V), data=dat1, listw=dist60sw) + pred <- predict(fm,dat2) + C[i,1] <- cor(dat2$SBA,pred) + out <- cbind(C) + } + colMeans(out) + } > > sim.sp(df2007.5k.s2,CM,1,1000) Error in...
2010 Nov 29
1
Moran I for very large data set
Hi Are there any more efficient ways of calculating the neighbourhood object for large datasets? I am trying to compute Moran I statistics for a very large data set (over 14,000 points). I have been using moran.test from the spdep package and everything works fine for a small data set (200 points). However, applying the same script to the whole dataset is taking days to compute (it so far has
2005 Jan 30
1
New user...tips for spdep
[This email is either empty or too large to be displayed at this time]
2009 Jul 15
1
Error in simulation R-code
...<- paste(V, collapse="+") V <- paste("SBA~", V) rd <- round(nrow(data)*(2/3)) d <- sample(seq(1:nrow(data)),rd) dat1 <- data[d,] dat2 <- data[-d,] crd <- cbind(dat1$Longitude,dat1$Latitude) dist60 <- dnearneigh(crd,0,60,longlat=F) dist60sw <- nb2listw(dist60, style="B") fm <- errorsarlm(as.formula(V), data=dat1, listw=dist60sw) pred <- predict(fm,dat2) C[i,1] <- cor(dat2$SBA,pred) out <- cbind(C) } colMeans(out) } sim.sp(df2007.5k.s...
2004 Feb 24
3
Calculate Distance and Aggregate Data?
Hi all, I've been struggling learning R and need to turn to the list again. I've got a dataset (comma-delimited file) with the following fields: recid, latitude, longitude, population, dwelling and age. For each observation, I'd like to calculate the total number of people and dwellings and average age within 2 k.m. Distance could be Euclidean, however, a proper distance
2003 Jul 11
0
spdep
Hi everyone, The Spatial Dependence (spdep) library, has a function called 'dnearneigh', which identifies neighbours of region points by Euclidean distance between lower (greater than) and upper (less than or equal to) bounds. The function returns a list of integer vectors giving the region id numbers for neighbours satisfying the distance criteria. I have used this to identify...
2003 Aug 07
0
spdep error message
Hello, I have been using the package "spdep" to run spatial regressions on a data set with about 2500 observations. It has performed well up until now, but the following code resulted in an error: > load("Panel.90s.ok.R") > attach(Panel.90s.ok) > neighs<-dnearneigh(cbind(x,y),0,50000) > help(nbdists) > dists<-nbdists(neighs,cbind(x,y)) > Weights<-nb2listw(neighs,zero.policy=T,glist=dists) > error.model.rprice<-errorsarlm(log(wells+1)~log(year)+log(area)+log(lag.rprice )+log(marketable+1)+log(prov.rds+1)+log(ind.rds+1)+log(seismic+1)+log(...
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]]
2005 Mar 29
0
Plot Moran's I
Hello all, I'm a new user of R and I have used the spdep package to calculate Moran's I estimates. I used the dnearneigh() function and moran.test() function and obtained what I wanted, but now I want to plot my results with the p-values. I regrouped my results for the Moran's I like >m=c(m1$e,m2$e...) #m1 contain the results of the moran.test for lag1 >p=c(m1$p.v,m2$p.v...) The problem is that in m...
2011 Jan 19
0
Error Moran's test : reconsider test arguments
...those 25 values: str(x) num [1:25] 22920 19546 16170 21387 9499 ... To obtain my spatial weight matrix, I used 2 columns (X & Y) representing the coordinates of the center of each sub-plot (20x20m, so 10:10, 10:30, 10:50, etc.), transformed it into a neighborhood matrix of class “nb” with dnearneigh() function, then into a object of class “listw” with nb2listw() function (with style=”B”).  I end up with “res2” : res2 Characteristics of weights list object: Neighbour list object: Number of regions: 25 Number of nonzero links: 600 Percentage nonzero weights: 96 Average number of lin...
2006 Mar 14
1
help on moran's I index of point pattern, not areal pattern
hi,friends, we all know that moran's I index and Geary'C index can be used to test spatial autocorrelation in both the area data and point data, but i only can find something on how to calculate on the data of area, and can't find the methods to perform it on the point data, could anybody give me some information, thanks in advance! -- Kind Regards, Zhi Jie,Zhang ,PHD Department of
2011 Jul 12
1
Subsetting NaN values in localG()
Hi, I'm currently trying to calculate local Getis-Ord Gi* statistics for a 169x315 cell matrix of temperature values, below is the code I currently have (diffc is the data vector I am removing NaN values from, and I am moving said values to diffD; -999 represents NaN values; id contains ID values for cells I want to use in the calculation, which I already know to contain 25064 values):
2003 Jun 30
2
spatial correlation test
hello, I want to do a test for spatial correlation. I tried it with geary.test() but I don't understand the required input. x= a numeric vector the same length as the neighbours list in listw (my sampled data, I assume) listw= a listw object created for example by nb2listw (well when I check nb2listw() I get to "neighbours - an object of class nb" - but I couldn't figure
2008 Oct 08
1
Error in spdep: system is computationally singular
Hi all, I am trying to run an autologistic model using the function errorsarlm from spdep package. **I built an XY matrix extracting the two colums from matriz** coords1<-matriz[matriz$casos1==1, c(4,5)] coords1<-as.matrix(coords1) **I identify neighbours of region points** nb20<-dnearneigh(coords1,0,20,longlat=TRUE) ** I build a neighbours list with spatial weights** nb20.w<-nb2listw(nb20, glist=NULL, style="W", zero.policy=TRUE) **I run a glm** glm1<-glm(matriz$sp~poly(matriz$iso,3)+poly(matriz$tmax,3)+poly(matriz$mdr,3)+poly(matriz$twq,3)+poly(matriz$tmin,3)+pol...
2004 Apr 26
2
Spatial Autocorrelation for point data
Hi R helpers, Is there a function (package?) in R available which tests "spatial autocorrelation" between points (e.g. vector layer of weather stations)? (e.g. Moran's I...) Via the archives we found out that there is a package 'spdep' which uses grid data for testing spatial autocorrelation. Thanks a lot, Jan
2005 Jan 30
1
New user...tips for spdep?
Hello List, I'm a very new user to the R system. I'm only beginning to learn the basics, but so far I've been able to do little more than try a few examples, and of course begin reading the documentation. My primary motivation for exploring R is the availability of tools like the 'spdep' package for calculating spatial statistics such as Geary's C and Moran's