0

I would like to use ordinary kriging get model predictions on a grid. In my code underneath, GPS is a 'SpatialPointsDataFrame' and EU is a 'SpatialPolygonDataFrame'. All covariates for estimating the model are contained in 'All_data'. These covariates only concern data on the points in GPS.

# Merge points with data 
GPS = merge(GPS, All_data, by.x = "nuts", by.y = "geo")
GPS <- GPS[!is.na(GPS@data$Value),]
proj4string(GPS) = CRS("+init=epsg:28992")

# Merge polygons with data 
EU = merge(EU, All_data, by.x = "nuts", by.y = "geo")
EU = subset(EU, EU@data$nuts %in% GPS@data$nuts)
proj4string(EU) = proj4string(GPS)

# Create a grid     
ext <- extent(EU)
r <- raster(ext, res=0.1)  
r <- rasterize(EU, r, field=1)
EU_grid = as(r, 'SpatialPixels')

# Estimate linear model
OLS_model = lm(Value ~ pop + unemp, data = GPS_coords) 

Does anyone know how to proceed now in order to obtain an ordinary kridged map of Europe with estimates from the linear model?

Esmee
  • 21
  • 2
  • Have you tried anything like this? https://rpubs.com/nabilabd/118172 – Roman Luštrik Jun 06 '17 at 13:52
  • Yes I used the variogram function before. However, I am not sure how the variogram model is estimated and I would like to interpolate estimates from above linear model. It is possible to get such a linear model using the variogram function? – Esmee Jun 06 '17 at 19:31
  • As I said on your same question in GIS https://gis.stackexchange.com/questions/242907/how-to-do-kriging-on-a-country-map-from-a-linear-model, your question has no sense. Either you want to do a linear model and predict using covariates at the targeted scale, or you want to do kriging directly on your dataset. The last possibility being to do co-kriging. However, stackoverflow is not to give tutorials on how to do a method, but only to help you if a code is not working – Sébastien Rochette Jun 08 '17 at 07:08

0 Answers0