<div dir="ltr"><br><br>On Tue, May 29, 2018 at 2:21 PM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>> wrote:<br>><br>> Le Tue, 29 May 2018 08:59:47 +0200,<br>> Markus Metz <<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>> a écrit :<br>><br>> > On Mon, May 28, 2018 at 6:16 PM, Moritz Lennert <<br>> > <a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>> wrote:<br>> > ><br>> > > Hi,<br>> > ><br>> > > AFAIU kernel density calculations, one takes a number of points<br>> > > and <br>> > redistributes this total number across the entire region using a<br>> > specified kernel function as estimator as to the spatial pattern of<br>> > this redistribution. The total sum should correspond to the total<br>> > number of points in the input. Is this understanding correct ?<br>> > ><br>> > > In v.kernel, this seems to be dependent on the resolution:<br>> > ><br>> > > echo "4.5,4.5" | v.in.ascii in=- sep=comma out=testpoint<br>> > ><br>> > > g.region n=9 s=0 w=0 e=9 res=1<br>> > > v.kernel in=testpoint out=testrast  radius=5 kernel=gaussian --o<br>> > > r.univar testrast<br>> > > [...]<br>> > > sum: 0.999544365566944<br>> > ><br>> > ><br>> > > but<br>> > > g.region n=9 s=0 w=0 e=9 res=2<br>> > > v.kernel in=testpoint out=testrast  radius=5 kernel=gaussian --o<br>> > > r.univar testrast<br>> > > [...]<br>> > > sum: 0.308567902849234<br>> > ><br>> > > IMHO, the sum should always be close to 1, or ? <br>> ><br>> > I think not, because the Gaussian kernel is a general Gaussian<br>> > function with user-defined sigma = dmax / 4 [0]. The sum would be<br>> > close to 1 only for a normal function (special case of the Gaussian<br>> > function) with sigma determined from the observed distances. For the<br>> > Gaussian kernel, the sum of the output raster should increase with<br>> > higher resolution and constant sigma.<br>> ><br>><br>> Thanks. I'll have to think about this a bit more when I have the time<br>> to fully understand. I imagine there should be a way to calculate the<br><div>> multiplier necessary to reach the correct sum</div><div><br></div><div>I don't think there is something like "the correct sum".</div><div><br></div><div>v.kernel provides an estimate for each output cell, how evenly the input points are distributed around this cell. The definition of "evenly" depends on the kernel function and bandwidth.</div><div><br></div><div>Markus M</div><div><br></div><div><br></div><div>> using some</div>> combination region extent, radius and resolution... But no time for<br>> such thinking right now.<br>><br>> BTW, in my previous mail I wrote:<br>><br>> > g.region n=9 s=0 w=0 e=9 res=2<br>> [...]<br>> > v.kernel in=testpoint out=testrast  radius=5 kernel=gaussian<br>> > multiplier=4 --o<br>> > r.univar testrast<br>> > [...]<br>> > sum: 1.23427161139693<br>> ><br>> > So this is close, but not very precise.<br>><br>> This was wrong as the g.region call leads to a region with res=1.8 and<br>> so the v.kernel call should have used multiplier=3.24 which does lead<br>> to a sum of 0.99.<br>><br>> But when I reduce or increase the radius this doesn't work anymore.<br>> Don't know if this is linked in any way to the fact that extent of 9<br>> divided by radius of 5 equals 1.8 which is exactly the resolution, or<br>> whether this is pure chance... ;-)<br>><br>> Moritz<br><br></div>