title: How can I determine variogram model in R using R-squared?
body: <p>I made a code to drawing variogram.
  I want to know which variogram model is best fitting.
  So I want to calculate R-Squared.
  How can I determine variogram model in R using R-squared?</p>
  
  <p>this is data link</p>
  
  <p><a href="https://drive.google.com/file/d/0B58l7t8QjmcnTlNFcnYweEpBSnM/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B58l7t8QjmcnTlNFcnYweEpBSnM/view?usp=sharing</a></p>
  
  <hr>
  
  <pre><code>library(sp)
  library(gstat)
  library(rgdal)
  
  jeju&lt;-read.csv('C:/Program Files/R/Input_jeju.csv')
  jeju&lt;-na.omit(jeju)
  
  coordinates(jeju)&lt;-~LONG+LAT
  proj4string(jeju) =  "+proj=longlat +datum=WGS84"
  jeju&lt;-spTransform(jeju, CRS("+proj=utm +north +zone=52 +datum=WGS84"))
  
  jeju.var&lt;-variogram(log(OUT)~1,data=jeju,cutoff=80000, width=8000)
  jeju.var
  
  plot(jeju.var)
  
  s1 &lt;- vgm(psill=1.2,model="Sph",range=18000,nugget=0.04)
  e1 &lt;- vgm(psill=1.2,model="Exp",range=18000,nugget=0.04)
  g1 &lt;- vgm(psill=1.2,model="Gau",range=18000,nugget=0.04)
  
  s1a&lt;- fit.variogram(jeju.var,s1)
  e1a&lt;- fit.variogram(jeju.var,e1)
  g1a&lt;- fit.variogram(jeju.var,g1)
  
  s1a
  e1a
  g1a
  
  plot(jeju.var,s1a)
  plot(jeju.var,e1a)
  plot(jeju.var,g1a)
  </code></pre>