Hi,
I'd like to optimize the IDW power, similar to what ArcGIS does. I found
this old thread
http://www.mail-archive.com/r-sig-geo@stat.math.ethz.ch/msg04011.html but
was hoping someone could help adapt the solution. I am using

idw(residuals(mdl.stepaic[[j]])~1,locations=swe.nozeros[swe.nozeros$mth==mth
& swe.nozeros$yr==yr,],newdata=swe.grid)

where mdl.stepaic[[j]] is a list of 39 regression equations. swe.nozeros is
a spatialpointsdataframe of observations. swe.grid is a grid where I want
new values predicted. I currently run this idw command through a loop of j
with no problems but I'd like to optimize both within each equation
represented by j and for the whole data set (so across the 39 timesteps).

Below is what I'm starting with but I don't really understand how to get it
working. I appreciate your help.

f= function(idp,formula,locations,newdata,...) {
sum(idw(formula,locations,newdata),set=list(debug=0,idp=idp),...)$residuals**2
}
optimize(f,interval=seq(1.4,1.7,by=0.1),formula=residuals(mdl.stepaic[[j]])~1,locations=swe.nozeros[swe.nozeros$mth==mth
& swe.nozeros$yr==yr,],newdata=swe.grid)

	[[alternative HTML version deleted]]

