[R] Kriging function ("prmat" and "semat") in spatial package

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 8 20:52:58 CEST 2003


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




More information about the R-help mailing list