[R-sig-Geo] pycno - problems with pycnophylactic interpolation for skewed populations

Juta Kawalerowicz juta.kawalerowicz at stx.ox.ac.uk
Mon Feb 20 22:42:10 CET 2012


With kind help of Chris Brundson the problem has now been resolved. If 
you face a similar problem download and compile the following script 
before running pycnophylactic interpolation.

http://dl.dropbox.com/u/30578197/pycno.R

Juta



On 23/01/2012 14:39, Juta Kawalerowicz wrote:
> Dear List,
>
> I have been using a Chris Brunsdon's pycno package for a while, but I wondered if anybody has faced problems when trying to interpolate over geographical units where populations distribution is very skewed towards zero (like in ew.wards$elect3). When I run estimations for a more normally distributed variables (such as ew.wards$ppl3), it's working great but I struggle to find a right celldim parameter - it's either too big and gives error or too small and then I run out of memory. I've been experimenting with different parameters for a while now, maybe I am missing something?
>
> Anyway here is the code
>
> library(pycno)
> load(url("http://dl.dropbox.com/u/30578197/space4.RData"))
> #largish workspace - may take a while to load (bit it does load)
>
> ls()		
> #"ew.districts"		shapefile with current districts
> #"ew.wards"     	shapefile with electoral wards from 1973 meregd with electoral results from 1979. I am interested in results in (elect3) showing results of a small far right party.
>
> per<-pycno(ew.wards,ew.wards$elect3, 0.1)
> #Maximum Change:          NaN - will stop at      0.00440
> #Error in if (max(abs(old.x - x))<  stopper) break :
> #  missing value where TRUE/FALSE needed
>
> #so maybe I should go down with celldim parameter?
>
> per<-pycno(ew.wards,ew.wards$elect3, 0.01)
> #Maximum Change:          NaN - will stop at      0.00095
> #Error in if (max(abs(old.x - x))<  stopper) break :
> #  missing value where TRUE/FALSE needed
>
> #CAUTION: my laptop with its 4G memory becomes pretty much unresponsive for ~5 min
>
> per<-pycno(ew.wards,ew.wards$elect3, 0.001)
> #Error: cannot allocate vector of size 367.9 Mb
> #In addition: Warning messages:
> #1: In validityMethod(object) :
> #  Reached total allocation of 3947Mb: see help(memory.size)
> #2: In validityMethod(object) :
> #  Reached total allocation of 3947Mb: see help(memory.size)
> #3: In validityMethod(object) :
> #  Reached total allocation of 3947Mb: see help(memory.size)
> #4: In validityMethod(object) :
> #  Reached total allocation of 3947Mb: see help(memory.size)
>
>
> #Compare with how smoothly it works with ew.wards$ppl3
>
> ppl<-pycno(ew.wards,ew.wards$ppl3, 0.1)
> image(ppl)
>
> Has anybody else encountered/solved this problem before? In the past setting a good celldim parameter has not been that challanging, this is the first time that I am trying to run Tobler's pycnophylactic interpolation on such a skewed data. I've been playing with different values between 0.01 and 0.001 but couldn't find anything which would not give me one of the above errors. I'd be very grateful for any hints.
>
> Thanks,
> Juta
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list