[R-sig-Geo] Prediction locations for kriging in geoR
Nicola Batchelor
N.A.Batchelor at sms.ed.ac.uk
Fri Aug 29 10:18:52 CEST 2008
Hi,
Im using geoR and I'm trying to do some predictions, based on an external
trend, using ordinary kriging.
However, I seem to be getting some strange results from my kriging, which I
think must have something to do with a problem with my prediction points.
I have my geodata object (called nicola), my prediction points (predpoints,
imported from a csv containing only the x and y coordinated of the
prediction locations) and my covariate data at each of the prediction points
(covars, imported from a csv containing the x and y coordinates of the
prediction locations, plus the values of the two covariates I want to use at
each of the prediction locations).
>predpoints<-read.csv(file="C:\\Documents and Settings\\s9901315\\My
+ Documents\\Uni\\Data\\Work\\Case control study\\Full study area\\R\\Files
for analysis\\Prediction
+ points\\predpoints.csv", header=FALSE, sep=",")
>covars<-read.csv(file="C:\\Documents and Settings\\s9901315\\My
+ Documents\\Uni\\Data\\Work\\Case control study\\Full study area\\R\\Files
for analysis\\Covariate
+ data\\covars.csv", header=TRUE, sep=",")
The final model is defined using "OTUBOIDIST" and "LSTPHAN" as external
covariates:
>mlx2<-likfit(nicola, cov.model="mat", kap=0.5, ini=c(0.6, 20), nug=0.3,
trend=~OTUBOIDIST +
+ LSTPHAN)
and then I carry out the kriging using the model "mlx2", prediction points
"predpoints", and covariate data "covars" :
>kcontrol<-krige.control(obj.m=mlx2, type.krige="ok", trend.d=~OTUBOIDIST +
LSTPHAN,
+ trend.l=~covars$otuboidist + covars$lstphan)
>krige<-krige.conv(nicola, loc=predpoints, krige=kcontrol)
Then I view it using the image function:
>image(krige, col=gray(seq(1, 0.2, l=100)))
The resulting image is clearly wrong with a regular stepped line appearing
diagonally across the image, and the predicted values do not coincide with
the actual observed data at all. I've included the predicted data image, as
well as the predicted image overlaid with the data points.
Can anyone give me any pointers of why this may be going wrong? I've tried
the same thing many times having changed everything I can think of that
might be causing the problem.
Thanks in advance,
Nicola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080829/4c868514/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 36113 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080829/4c868514/attachment.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 17791 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080829/4c868514/attachment-0001.jpe>
More information about the R-sig-Geo
mailing list