Skip to content

Problem with universal kriging using gstat

3 messages · Yong Li, Tomislav Hengl

#
Auxiliary variables that are used to explain the trend-part of variation need to be available also
at all new prediction locations.

see ?krige:

"newdata - data frame or Spatial object with prediction/simulation locations; should contain
attribute columns with the independent variables (if present) and (if locations is a formula) the
coordinates with names as defined in locations"

Gstat obviously can not find X and Y coordinates of your new locations (data.grid).

Try instead:
cheers,

Tom Hengl
http://spatial-analyst.net/ 


-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
Yong Li
Sent: maandag 14 april 2008 6:45
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] Problem with universal kriging using gstat

Hi ALL,
 
Can any expert to see my mistake in the following R script when I try the gstat universal kriging?
The error occurs at the last step. It sounds I missed the setup for the names of coordinates of the
SpatialGrid "data.grid".
 
Regards
 
Yong
[1] 47930616
[1] 85377024
NULL
[1] 2048
[1] TRUE
[1] TRUE
[1] TRUE
[1] TRUE
[1] "ID"       "XCOOR"    "YCOOR"    "NO"       "CDBH"     "NO3N"     "NH4N"     "MINERALN" "SOM"
"TOTALN"   "OLSENP"   "EXTK"    
[13] "TN"       "X"        "Y"
[1] "data.frame"
+units=m +no_defs +towgs84=22,-118,30.5,0,0,0,0")
log(((data$OLSENP-OLSENP_MIN)/OLSENP_DIFF)/(1-(data$OLSENP-OLSENP_MIN)/OLSENP_DIFF))
+           sp.layout=list("sp.points", pch="+", col="black", data), col.regions=FALSE,
colorkey=FALSE)
fit.method=7)
model             psill            range
1   Nug 0.269063860535796   0.000000000000
2   Sph 0.217370623520010 815.994438576304
(m)")
Error in eval(expr, envir, enclos) : object "X" not found
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
#
sorry, a type error:
-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
Tomislav Hengl
Sent: maandag 14 april 2008 10:37
To: 'Yong Li'; r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] Problem with universal kriging using gstat


Auxiliary variables that are used to explain the trend-part of variation need to be available also
at all new prediction locations.

see ?krige:

"newdata - data frame or Spatial object with prediction/simulation locations; should contain
attribute columns with the independent variables (if present) and (if locations is a formula) the
coordinates with names as defined in locations"

Gstat obviously can not find X and Y coordinates of your new locations (data.grid).

Try instead:
cheers,

Tom Hengl
http://spatial-analyst.net/ 


-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
Yong Li
Sent: maandag 14 april 2008 6:45
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] Problem with universal kriging using gstat

Hi ALL,
 
Can any expert to see my mistake in the following R script when I try the gstat universal kriging?
The error occurs at the last step. It sounds I missed the setup for the names of coordinates of the
SpatialGrid "data.grid".
 
Regards
 
Yong
[1] 47930616
[1] 85377024
NULL
[1] 2048
[1] TRUE
[1] TRUE
[1] TRUE
[1] TRUE
[1] "ID"       "XCOOR"    "YCOOR"    "NO"       "CDBH"     "NO3N"     "NH4N"     "MINERALN" "SOM"
"TOTALN"   "OLSENP"   "EXTK"    
[13] "TN"       "X"        "Y"
[1] "data.frame"
+units=m +no_defs +towgs84=22,-118,30.5,0,0,0,0")
log(((data$OLSENP-OLSENP_MIN)/OLSENP_DIFF)/(1-(data$OLSENP-OLSENP_MIN)/OLSENP_DIFF))
+           sp.layout=list("sp.points", pch="+", col="black", data), col.regions=FALSE,
colorkey=FALSE)
fit.method=7)
model             psill            range
1   Nug 0.269063860535796   0.000000000000
2   Sph 0.217370623520010 815.994438576304
(m)")
Error in eval(expr, envir, enclos) : object "X" not found
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo