I am trying to conduct spatial point pattern analyses in Stata, and am receiving an error while trying to use the command: spgrid in Stata SE v12.
The error reads: "block should be at least 1" r(498)
Here is my code - the error appears when I run the spgrid command:
shp2dta using StudyAreaBoundaryPolygon, database(studyarea) coordinates(coords) replace
use coords.dta, clear
gen id = _n
spmap using coords.dta, id(id) fcolor(eggshell) split
save coords, replace
spgrid using coords.dta, resolution(w500) dots compress unit(meters) cells("cells.dta") ///
points("points.dta") mapid(spgrid_mapid) replace
I can't figure out what is wrong… the spmap command correctly draws my study area boundary (which actually consists of 3 polygons) and when I try to use spgrid to generate a two-dimensional grid, the error appears.
The dataset "coords.dta" contains 4 variables, 1 is basically _n, then there are X and Y coordinates, and the final variable indicates which polygon the coordinates belong to (1, 2, or 3).
Any ideas?
I'd like to continue on and use 'spkde' after I create the grid, but am stuck at this step with this error.
Appreciate any help or ideas…
~Karen
The error reads: "block should be at least 1" r(498)
Here is my code - the error appears when I run the spgrid command:
shp2dta using StudyAreaBoundaryPolygon, database(studyarea) coordinates(coords) replace
use coords.dta, clear
gen id = _n
spmap using coords.dta, id(id) fcolor(eggshell) split
save coords, replace
spgrid using coords.dta, resolution(w500) dots compress unit(meters) cells("cells.dta") ///
points("points.dta") mapid(spgrid_mapid) replace
I can't figure out what is wrong… the spmap command correctly draws my study area boundary (which actually consists of 3 polygons) and when I try to use spgrid to generate a two-dimensional grid, the error appears.
The dataset "coords.dta" contains 4 variables, 1 is basically _n, then there are X and Y coordinates, and the final variable indicates which polygon the coordinates belong to (1, 2, or 3).
Any ideas?
I'd like to continue on and use 'spkde' after I create the grid, but am stuck at this step with this error.
Appreciate any help or ideas…
~Karen
Comment