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

Paulo Justiniano Ribeiro Jr paulojus at c3sl.ufpr.br
Fri Aug 29 14:57:53 CEST 2008


Dear Nicola

In principle your original code looks OK to me.
geoR as it is now does not require covariates been speeled the same way
at data and prediction objects.
If you could send me data and prediction locations (or a subset of then)
with the commands I can look at it more carefully

Regarding preditions at data locations they do not need to coincide with
the data for every case. In summary:

- if the nugget parameter $ \tau^2 = 0 $ observed and predicted values
will coincide

- if the nugget parameter $ \tau^2 > 0 $ observed and predicted values
will coincide of this parameter is regarded as microscale variation,
but not if regarded as measurement error.

For the latter this is controlled by the argument "micro.scale"
in krige.control().
It defaults to 0, and can take values between 0 and the value of the
nugget.
The default corresponds to assume the nugget is measurement error
variance


Best
P.J.



Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 3361 3573
Fax: (+55) 41 3361 3141
e-mail: paulojus AT  ufpr  br
http://www.leg.ufpr.br/~paulojus



On Fri, 29 Aug 2008, Nicola Batchelor wrote:

> 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
>
>
>
>




More information about the R-sig-Geo mailing list