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.hiems...@geo.uu.nl
> To: vivac...@hotmail.sg
> CC: r-sig-geo@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

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to