# [R] ordinary kriging: the edges of the polygons are ignored

Federico Calboli f.calboli at imperial.ac.uk
Wed Aug 20 23:01:30 CEST 2014

```Hi All,

I am trying to do some kriging of a floor, based on a number of heat sensors.

My data looks like this:

sensor        temp    x    y
1       1  1.25437406  390 2960
2       2  0.64384594  830 2960
3       3  1.52067733 1420 2960
4       4  1.21441928 3127 2920
5       5  1.04227694 4005 2920
6       6  1.90084852  400 1960
7       7  1.58530250  835 1880
8       8  1.23060971 1130 1960
9       9  0.92749453 1550 1950
10     10  0.76638878 1995 1960
11     11  0.84247092 2540 1950
12     12  0.93999929 3300 1880
13     13  0.61610170 4000 1870
14     14  1.06967332  395 1330
15     15  0.72970917  845 1330
16     16  0.60216970 1135 1300
17     17  0.44648551 1570 1275
18     18  2.49863724 2010 1290
19     19  0.71619206 2540 1320
20     20  1.50984666 3140 1275
21     21 -0.06540552 4000 1258
22     22  1.20017747  400  685
23     23  1.05820693 1575  640
24     24  2.25086655 1830  625
25     25  0.69296059 3120  625
26     26  0.69324786 3990  605

and the floor plan describes the edges of the floor thus:

x    y
1   210 3200
2   210  420
3  1510  420
4  1510  100
5  4090  100
6  4090 3200
7  2947 3200
8  2947 2850
9  1647 2850
10 1647 3200
11  210 3200
12  210 3200

I run these commands:

house2 <- list(data.frame(house\$x, house\$y))
plot(house.y ~house.x, type = 'l', house2[[1]])
points(U[,3], U[,4], pch = 20)
housekrig=kriging(U[,3],U[,4],U[,2],polygons=house2,lags = 5)
image(housekrig, xlim = extendrange(U[,3]), ylim = extendrange(U[,4]), col = rev(heat.colors(100)))

and I noticed that the kriging area does not respect the floor plan.  In fact, if I do:

points(U[,3], U[,4], pch = 20)

the sensors and not in the same place, and the kriging has ignored the edges of the polygons altogether.

So my question is, how do I have a kriging of the *whole* surface, based on my sensors?  Any suggestion is welcome, especially if the data does not require reformatting (or if the reformatting is straightforward)!

Best

F

PS I have contacted the maintainer of the package about the issue but I had no reply, and I’d need to solve this one way or another sooner, rather than later.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140820/e0d9c100/attachment.bin>
```