Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • spgrid problem - block should be at least 1 r(498)

    I’m trying to implement with my own data a kernel density estimation like in Pissati 2008 (pag. 2008)

    This are my data files.

    coords.dta pandb.dta

    http://www.stata.com/meeting/italy12...t12_pisati.pdf

    I’ve been stuck with the spgrid command. I‘m receiving an error while trying to use the command: spgrid in Stata SE v13. The error says: "block should be at least 1" r(498)
    My code is like this:


    Code:
    shp2dta using distrito, database("pandb.dta") coordinates("pancoord.dta") genid(id) gencentroids(stub) replace
    
    use pandb, clear
    
    spmap using pancoord.dta, id(id) fcolor(eggshell) split
    
    save coords, replace
    
    spgrid using pancoord.dta, resolution(w500) dots compress unit(meters) cells("cells.dta") points("points.dta") mapid(spgrid_mapid) replace
    * the rest of my code will be
    *use "pandb", clear
    * spkde PMUJ PTOT using "GridPoints.dta", xcoord(x_stub) ycoord(y_stub) bandwidth(fbw) fbw(100) dots saving("Kde.dta", replace)
    * use "Kde.dta", clear
    * generate ratio = PMUJ_lambda /PTOT_lambda * 100
    * spmap ratio using "GridCells.dta", id(spgrid_id) clnum(15) fcolor(Heat) ocolor(none ..)

    I can't figure out what is wrong… the spmap command correctly draws the map but when I try to use spgrid, the error appears.

    Thank you for your help.

  • #2
    Did anyone figure this out? I can't seem to get sprgrid to generate a grid with lat and lon data. Do you have to re-project into a feet or meter coordinates files?

    Comment

    Working...
    X