1

I am a newbie in R and trying to do interpolation in R(sorry if it seems a lame question) . I have some Points(Lat,Lan and one integer value for each point) that I need to interpolate them. I am a GIS user I did it in ARCGIS but ArcGIS doesn't give me RMSE for spline as far as I know, so I thought to do in in R and learn some R. I have learned basif stuff such as plotting ,,,,, Can you please tell me step by step what I should do in R language to interpolate the points(global level) and calculate RMSE?

I really appreciate any help Hank

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
Hank
  • 70
  • 2
  • 8

2 Answers2

3

I would take a look at the Tps function from the fields package, where Tps stands for Thin plate spline. Tps (from the documentation):

Fits a thin plate spline surface to irregularly spaced data. The smoothing parameter is chosen by generalized cross-validation. The assumed model is additive Y = f(X) +e where f(X) is a d dimensional surface. This is a special case of the spatial process estimate.

See the documentation of Tps for some code examples.

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
  • 1
    +1 fields is a great package. This method worked for me - I posted an example a while back (see method 3 here: http://menugget.blogspot.de/2012/03/xyz-geographic-data-interpolation-part.html). – Marc in the box Jul 30 '12 at 05:43
  • @Marc, there is an extra `)` at the end of your link, breaking it. Your post looks very nice, thank you! – Paul Hiemstra Jul 30 '12 at 06:04
3

Have you got a reason for using splines (other than that's what you had in the software)? You should probably read http://cran.r-project.org/web/views/Spatial.html and consider a good book on Geostatistics http://spatial-analyst.net/book/ and then you might want to do the interpolation using Kriging.

Spacedman
  • 92,590
  • 12
  • 140
  • 224
  • 2
    +1. I agree that looking at geostatistics is worth it for the OP. Kriging is however not always the best option, but this depends on a lot of variables (amount of data, smoothness of the data, etc). I wrote a report a while back which compares interpolation methods, might be interesting for the OP: http://www.numbertheory.nl/files/report_evap.pdf. An easy way to perform kriging is to use the `automap` package (disclaimer, I wrote it). – Paul Hiemstra Jul 30 '12 at 06:53