Skip to content

geoR: krigeing, predict on other coordinates with a parametric trend

2 messages · Sara Kleyer, Paulo Justiniano Ribeiro Jr

#
Dear list,

there are two datasets: the data "geo" is a geodata-set including, 
"data", covariates and coordinates. The second dataset "fehlcord" is a 
dataset including 2 columns for the coordinates and additional columns 
for covariates.

I want to use kriging.conv to estimate on the "geo"-dataset and predict 
on the locations of the "fehlcord" dataset. Additionally, I want to use 
the covariates for a parametric trend.
This is the syntax I use:
#definition of the trend, I am interested in:
trend1<-trend.spatial("1st", geo,  
add=~covariate$bauland+covariate$baulandsq+covariate$ostw+covariate$tour+covariate$alq)
#estimate the model
neu<-likfit(geo, coords=geo$coords, data=geo$data, 
ini.cov.pars=c(50,9),trend=trend )
kri.set<-krige.control(type.krige="ok", trend.d=~trend1, 
trend.l=~trend1, obj.model=neu)
#predict on the other dataset
schatz<-krige.conv(geo, locations=fehlcord, krige=kri.set)

R returns, that there is a mistake because:
"in krige.conv(geo, locations = fehlcord, krige = kri.set) :
   locations and trend.l have incompatible sizes"

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

I also tried to define "trend.l" by the dataset "fehlcord" but it did 
not work, too.

How can I predict on new coordinates and use a parametric trend on the 
covariates?

Thanks a lot for your help!

Sara
#
Dear Sara

1. I guess you mean krige.conv() and not kriging.conv()
2. you should be able to simplify the following call if $covariate is an 
element of the geodata (geo)
add=~bauland+baulandsq+ostw+tour+alq)

3. The problem you are encotering is in the use of trend.d and trend.l
In the former you provido covariate values measured **at data locations**
and for the later **at prediction** locations 
When you define a trend you are including covariates in the model.
In order to run predictions from the firtted model you need to have the 
covariate values at the coorinates of the prediction locations.

In other words, trend.l is the same trend you used in likfit() and have 
dimesion of the data
trend.l is another obhect with the variables as trend.l wowever with 
dimension of the prediction locations (argument locations)
On Wed, 14 Sep 2011, Sara Kleyer wrote: