[R-sig-Geo] Prediction locations for kriging in geoR

Nicola Batchelor N.A.Batchelor at sms.ed.ac.uk
Fri Aug 29 11:55:27 CEST 2008


Hi Thierry,

 

Thanks for the suggestions.  I hadn't tried that previously, but no it
doesn't make any difference unfortunately.

I removed the separate predpoints dataframe from it and tried using the x
and y values from the covars for the prediction, but got the following:

 

> kcontrol<-krige.control(obj.m=mlx2, type.krige="ok", trend.d=~otuboidist +
lstphan, trend.l=~covars$otuboidist + covars$lstphan) 

 

> krige<-krige.conv(nicola, loc=covars, krige=kcontrol)

 

krige.conv: model with mean defined by covariates provided by the user

krige.conv: Kriging performed using global neighbourhood 

Warning message:

locations provided with a matrix or data-frame with more than 2 columns.
Only the first two columns used as coordinates in:
.check.locations(locations) 

 

> image(krige, col=gray(seq(1, 0.2, l=100)))

 

Error in image.kriging(krige, col = gray(seq(1, 0.2, l = 100))) : 

        locations must be a matrix or data-frame with two columns

 

Removing the prediction locations from the covariate dataframe made no
difference.

Also, changing the covariate names didn't make any difference - I still got
the odd prediction results.

 

I'm thinking perhaps it's my prediction grid.I created it in Arc as a shape
file with points for each prediction locations, and then saved the points as
a .csv file.  Perhaps the problem has something to do with this?  But I'm
really a total novice to both geostatistics and to R, so I could be very
wrong!

 

Thanks,

Nicola

 

  _____  

From: ONKELINX, Thierry [mailto:Thierry.ONKELINX at inbo.be] 
Sent: 29 August 2008 09:52
To: Nicola Batchelor; r-sig-geo at stat.math.ethz.ch
Subject: RE: [R-sig-Geo] Prediction locations for kriging in geoR

 

Dear Nicola,

 

I think that since the covars contains the locations of the predpoints you
don't need two dataframes. Futhermore make sure that the names of the covars
are identical (including capitalisation).

 

mlx2<-likfit(nicola, cov.model="mat", kap=0.5, ini=c(0.6, 20), nug=0.3,
trend=~OTUBOIDIST + LSTPHAN) 
kcontrol<-krige.control(obj.m=mlx2, type.krige="ok", trend.d=~OTUBOIDIST +
LSTPHAN, trend.l=~OTUBOIDIST + LSTPHAN) 
krige<-krige.conv(nicola, loc=covars, krige=kcontrol)

 

Does that work?

 

HTH,

 

Thierry

----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than
asking him to perform a post-mortem examination: he may be able to say what
the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

 

 

  _____  

Van: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] Namens Nicola Batchelor
Verzonden: vrijdag 29 augustus 2008 10:19
Aan: r-sig-geo at stat.math.ethz.ch
Onderwerp: [R-sig-Geo] Prediction locations for kriging in geoR

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

 



Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet
bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the
writer and may not be regarded as stating an official position of INBO, as
long as the message is not confirmed by a duly signed document
	


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080829/a8c7e235/attachment.html>
-------------- 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/a8c7e235/attachment.jpe>
-------------- 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/a8c7e235/attachment-0001.jpe>


More information about the R-sig-Geo mailing list