Yan Yu
2003-May-08 18:21 UTC
[R] Kriging function ("prmat" and "semat") in spatial package
Hello, there, I have two Qs about the kriging function in spatial pakcage. (1) From what I read in some textbooks, Kriging procedure is supposed to honor the sample data point, which means at the sampling data point, the kriging value should be the same as the input value, and the estimation variance(error) is 0. but from my initial experience with "prmat" and "semat" function in the "spatial" package, this is not true. I am wondering did anyone used those kriging functions have similar experience? OR I used it wrong? (although I believe I used the function correctly:) (2) if consider x coordinate as row index, and y coordinate as column index, the returned value from prmat, and semat seems to be stored in column first order(i.e., first the 1st column, then the 2nd column..). since the data order of returned valus is NOT explicitly specified in the manual, and almost data from everywhere else I have seen is stored in row first order, It would be nice if someone could confirm me on this. thanks a lot in advance, yan
Prof Brian Ripley
2003-May-08 18:52 UTC
[R] Kriging function ("prmat" and "semat") in spatial package
On Thu, 8 May 2003, Yan Yu wrote:> Hello, there, I have two Qs about the kriging function in spatial pakcage. > > (1) From what I read in some textbooks, > Kriging procedure is supposed to honor the sample data point, which means > at the sampling data point, the kriging value should be the same as the > input value, and the estimation variance(error) is 0. > but from my initial experience with "prmat" and "semat" function in the > "spatial" package, this is not true. > I am wondering did anyone used those kriging functions have similar > experience? OR I used it wrong? (although I believe I used the function > correctly:)You read the wrong textbooks! How about reading the one that this code was written to support? Note that prmat and semat are not predicting at the data points. Even if you predict at the same point, this is taking a new sample, not the previous sample. So it will interpolate iff there is no nugget effect: computationally you may see small inaccuracies since the distances are binned.> (2) if consider x coordinate as row index, and y coordinate as column > index, the returned value from prmat, and semat seems to be stored > in column first order(i.e., first the 1st column, then the 2nd column..). > since the data order of returned valus is NOT explicitly specified in the > manual, and almost data from everywhere else I have seen is stored in row > first order, It would be nice if someone could confirm me on this.*All* R matrices are stored in column first order ... so why does this need to be specified on that help page? -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Yan Yu
2003-May-08 19:36 UTC
[R] Kriging function ("prmat" and "semat") in spatial package
Thanks a lot for clarification! Please forgive my ignorance on some R basics, It is good to know that all R matrices are stored in column first order:) it would be nice if it could be documented, so that new users to R can quickly get to where they want w/o first going through some systematic R learning.. thanks, yan On Thu, 8 May 2003, Prof Brian Ripley wrote:> On Thu, 8 May 2003, Yan Yu wrote: > > > Hello, there, I have two Qs about the kriging function in spatial pakcage. > > > > (1) From what I read in some textbooks, > > Kriging procedure is supposed to honor the sample data point, which means > > at the sampling data point, the kriging value should be the same as the > > input value, and the estimation variance(error) is 0. > > but from my initial experience with "prmat" and "semat" function in the > > "spatial" package, this is not true. > > I am wondering did anyone used those kriging functions have similar > > experience? OR I used it wrong? (although I believe I used the function > > correctly:) > > You read the wrong textbooks! How about reading the one that this code > was written to support? Note that prmat and semat are not predicting at > the data points. Even if you predict at the same point, this is taking a > new sample, not the previous sample. So it will interpolate iff there is > no nugget effect: computationally you may see small inaccuracies since the > distances are binned. > > > (2) if consider x coordinate as row index, and y coordinate as column > > index, the returned value from prmat, and semat seems to be stored > > in column first order(i.e., first the 1st column, then the 2nd column..). > > since the data order of returned valus is NOT explicitly specified in the > > manual, and almost data from everywhere else I have seen is stored in row > > first order, It would be nice if someone could confirm me on this. > > *All* R matrices are stored in column first order ... so why does this > need to be specified on that help page? > >