Skip to content
Prev 19777 / 29559 Next

Regression kriging - error not found when ordinary kriging

Hello, I was wondering if anyone has encountered this issue?


This line works:
                      TotalKrige <- krige(Total~1, locations=bd,
newdata=blank, model=fit_Total)

This line does not:
                     TotalRegKrige <-
krige(Total~m5005CVOL+n50010CVOL+n50015CVOL+DTM, locations=bd,
newdata=blank, model=fit_r)

Message:
                     Error in eval(expr, envir, enclos) : object
'm5005CVOL' not found

I have emailed the author of the library "gstat", he very helpfully
offered some advice and that I post here. I have also included my
intial email exchange with Prof. Pebesma.

I have included a description of my two datsets below and the
libraries I have loaded.

data = locations (therefore it isn't necessary to have "data"
specified (in the way it is in a linear model lm() )
newdata = the locations to krige

I have also tried among other things:

TotalRegKrige <-
krige(Total~bd$m5005CVOL+bd$n50010CVOL+bd$n50015CVOL+bd$DTM,
locations=bd, newdata=blank, model=fit_r)

Giveing:

Error in gstat.formula.predict(d$formula, newdata, na.action = na.action,  :
  NROW(locs) != NROW(X): this should not occur
In addition: Warning messages:
1: 'newdata' had 26026 rows but variables found have 83 rows
2: 'newdata' had 26026 rows but variables found have 83 rows

This would lead me to think there is an error in the ascii grid,
except that it worked perfectly in the ordinary kriging example.

Any help anyone can give would be greatly appreciated.

Regards

Jordan Chetcuti

p.s. see descriptions of data and libraries below, and conversation
with Prof. Pebesma.


Dataset "bd"
Object of class SpatialPointsDataFrame
Coordinates:
      min     max
X  228112  232468
Y 2190072 2195810
Is projected: NA
proj4string : [NA]
Number of points: 83
Data attributes:
   StationID       m1K10CrnR       m1K10TrHT       m1K10CVOL (only
first few, contains many).

Dataset "blank"
Object of class SpatialGridDataFrame
Coordinates:
         min     max
[1,]  226693  233843
[2,] 2187940 2197040
Is projected: NA
proj4string : [NA]
Grid attributes:
  cellcentre.offset cellsize cells.dim
1            226718       50       143
2           2187965       50       182
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      1       1       1       1       1       1


Libraries
1. geoR
2. gstat
3. sp
4. lattice