[R-sig-Geo] gstat- Interpolate geostatistical data with kriging

Jon Olav Skoien jon.skoien at jrc.ec.europa.eu
Wed Aug 7 11:49:45 CEST 2013


On 06-Aug-13 21:41, Moshood Agba Bakare wrote:
> Dear All,
>
> I have carried out variogram analysis on geostatistical data using gstat
> package of R. after rescaling my spatial coordinates, it ranges as follows
> easting: min=0 and max=794.256 meters
> northing: min= and max=621.8851 meters
> the maximum distance between pairs of observation is 1008.754 meters.
> I have fitted a number of variogram models such as spherical, exponential,
> Gaussian, and linear to empirical semivariogram. Besides, I have generated
> the interpolation grid for kriging. With this information, I wish to
> determine optimal grid size and interpolate with kriging. The cross
> validation will be used to compare the values.
>
> ### Create grid for the point coordinate
>
> easting.range <- as.integer(range(canmod.sp at coords[,1]))
> northing.range <- as.integer(range(canmod.sp at coords[,2]))
>
> ## now expand to a grid with 10 meter spacing:
> grd <- expand.grid(x = seq(from=easting.range[1], to = easting.range[2], by
> = 10), y = seq(from = northing.range[1], to = northing.range[2], by = 50) )
> grd.attr = data.frame(grd, yield = canmod.sp at data)
>
> ## convert to SpatialPixel class
> grd.pts <- SpatialPixels(SpatialPoints(grd))
> proj4string(grd.pts)<-CRS("+proj = utm + datum = WGS84")
>
>
> k10 <- krige(yield ~ 1, canmod.sp, newdata = grd.pts, model=sph.mod)
>
>
> I ran the last statement for kriging interpolation but take quite a long
> time with error message. This is probably due to large volume of the data
> records (12,800 observations). Could anyone guide me on what to do when
> having large data of this nature for kriging? Is there any error on the way
> I defined my grid interpolation? Do I need to split the data for kirging?
> If yes, how?

Moshood,
We have not seen the error message, but I think the size of your data is 
the cause of your problems. gstat will as default try to make a 
covariance matrix of all observations, being a 12,800 * 12,800 matrix in 
your case. This is slow and will maybe also fill up the memory on your 
computer. Instead you can do kriging in a local neighbourhood with the 
nearest n observations, n typically being a value from 10-50. Your 
kriging call would then be:

k10 <- krige(yield ~ 1, canmod.sp, newdata = grd.pts, model=sph.mod, nmax = n)

Hope this helps,
Jon

>
> Thank you.
>
> Moshood
>
>
>
>
>
>
>
>
>   where cross validation. Please guide me on how to go about this using the
> above details. Note that my observation size is 12,500 records.
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 
Jon Olav Skøien
Joint Research Centre - European Commission
Institute for Environment and Sustainability (IES)
Land Resource Management Unit

Via Fermi 2749, TP 440,  I-21027 Ispra (VA), ITALY

jon.skoien at jrc.ec.europa.eu
Tel:  +39 0332 789206

Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.



More information about the R-sig-Geo mailing list