[R-sig-Geo] How to locate local minima points on a Krige-fitted surface?

v v vivacity at hotmail.sg
Sat Jun 12 09:11:05 CEST 2010


Hi, Paul,
 
Thank you for the reply. 
 
I have attempted to write some code to test out what you've suggested but ran into some errors.
 
library(fields)
k <- Krig(ozone$x, ozone$y, theta=20)
 
# define objective function 
kfunc <- function(para,k) {
  xcoord=para[1]
  ycoord=para[2]
 
  minimum <- NULL
  testpoint <- c(xcoord, ycoord)
  minimum <- predict(k, testpoint)
  return(minimum)
}
 
initialpar <- c(max(ozone$x), max(ozone$y))
initialpar 
 
# optimization
best <- optim(initialpar, kfunc, NULL, method = "BFGS", hessian=TRUE)
 
# Error in predict(k, testpoint) : argument "k" is missing, with no default
 
 
regards,
Jeff 

----------------------------------------
> Date: Fri, 11 Jun 2010 15:04:32 +0200
> From: p.hiemstra at geo.uu.nl
> To: vivacity at hotmail.sg
> CC: r-sig-geo at stat.math.ethz.ch
> Subject: Re: [R-sig-Geo] How to locate local minima points on a Krige-fitted surface?
>
> Dear Jeff,
>
> I think you cannot escape discretizing your kriging surface as there is
> no mathematical expression that captures the kriging surface. To use
> optim you could make an objective function that was two inputs, x and y
> location. The functions calls the fields package to estimate the kriging
> prediction at this point and returns it. This ofcourse assumes that the
> variogram model is known. You have to play with the settings of optim to
> get it working and prevent a local minimum. You could take a look at
> SANN (simulated anealing) which is part of optim.
>
> cheers,
> Paul
> 		 	   		  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969



More information about the R-sig-Geo mailing list