<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I have been trying to fit a Spatio-Temporal Variogram using non-separable classes of covariances using the WLS criterion(attached is my data file). </span><span style="font-family:arial,sans-serif;font-size:13px">But I'm not getting any result using optim() or nls(). Here is the way I'm using the optim() function for a single parametric model. </span><br>
<div><div style="font-family:arial,sans-serif;font-size:13px"><div><br></div><div>weights<-c(with(coord.smooth,table(tlag,slag)))</div><div>weights<-weights[-1]</div><div><br></div><div>##Parametric ST variogram Families</div>
</div><div style="font-family:arial,sans-serif;font-size:13px"><div>weightedLS<-function(par){</div><div> Sigma<-par[1]</div><div> Tau<-par[2]</div><div> a<-par[3]</div><div> b<-par[4]</div><div> n<-weights</div>
<div> observed<-coord.smooth[,3]</div><div> h<-coord.smooth[,2]</div><div> u<-coord.smooth[,1]</div><div> eg1<-exp(-b^2*h^2/(a^2*u^2+1))/(a^2*u^2+1)</div><div> pred<-Sigma*(1-eg1)+Tau</div><div> wls<-sum(n*(observed/pred)-1)^2</div>
<div> return(wls)</div><div> </div><div>}</div></div><div style="font-family:arial,sans-serif;font-size:13px"><div><br></div><div>eg1.fit<-optim(c(0,0,0,0),fn=weightedLS,</div><div> method="L-BFGS-B",lower=rep(0,4))</div>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 10, 2014 at 7:42 PM, Humayera Islam <span dir="ltr"><<a href="mailto:hislam@isrt.ac.bd" target="_blank">hislam@isrt.ac.bd</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have been trying to fit a Spatio-Temporal Variogram using non-separable classes of covariances using the WLS criterion, as described in papers such as Cressie and Huang(1999), Gneiting (2002). Attached is the .Rda file which includes a data set named coord.smooth having three variables time lag, space lag and variogram values. I have plotted a wireframe as well. But I'm not getting any result using optim() or nls(). Here is the way I'm using the optim() function for a single parametric model.<div>
<br></div><div><div>weights<-c(with(coord.smooth,table(tlag,slag)))</div><div>weights<-weights[-1]</div><div>##Cressie Huang (1991)</div><div>##Parametric ST variogram Families</div></div><div><div>weightedLS<-function(par){</div>
<div> Sigma<-par[1]</div><div> Tau<-par[2]</div><div> a<-par[3]</div><div> b<-par[4]</div><div> n<-weights</div><div> observed<-coord.smooth[,3]</div><div> h<-coord.smooth[,2]</div><div> u<-coord.smooth[,1]</div>
<div> eg1<-exp(-b^2*h^2/(a^2*u^2+1))/(a^2*u^2+1)</div><div> pred<-Sigma*(1-eg1)+Tau</div><div> wls<-sum(n*(observed/pred)-1)^2</div><div> return(wls)</div><div> </div><div>}</div></div><div><div><br></div><div>
eg1.fit<-optim(c(0,0,0,0),fn=weightedLS,</div><div> method="L-BFGS-B",lower=rep(0,4))</div></div><div>I have obtained the following error:</div><div><div><br></div><div>Error in optim(c(0, 0, 0, 0), fn = weightedLS, method = "L-BFGS-B", lower = rep(0, : </div>
<div> L-BFGS-B needs finite values of 'fn'</div></div><div><br></div></div>
</blockquote></div><br></div>