Hello.
  Error in optim(ini, .loss.vario, method = "L-BFGS-B", hessian = TRUE,  : 
        non-finite value supplied by optim
I have this errore in fit the model"power" in simulation with the function 
g<-function(n=100,max=100,c0=0,ce=.005,ae=1.5,nsim=1000){
var.exp<-function(c0,ce,ae,h){
f<-c0+ce*(h^ae)
return(f)
}
ms1<-ms2<-rep(NA,nsim)
integrand1<-function(h)
{(var.exp(c0,ce,ae,h)-var.exp(c0HAT1,ceHAT1,aeHAT1,h))^2}
  integrand2<-function(z)
{(var.exp(c0,ce,ae,z)-var.exp(c0HAT2,ceHAT2,aeHAT2,z))^2}
data<-grf(n=n,grid="reg",nsim=nsim,cov.model="power",xlim=c(0,max),ylim=c(0,max),cov.pars=c(ce,ae))
var1<-variog(data,option="bin")
var2<-variog(data,option="cloud")
for(i in (1:nsim)){
cat(i,"\n")
ww1<-variofit(var1,ini.cov.pars=c(ce,ae),cov.model="power",simul.number=i,fix.nugget=F,weight="cressie")
ww2<-variofit(var2,ini.cov.pars=c(ce,ae),cov.model="power",simul.number=i,fix.nugget=F,weight="equal")
c0HAT1<-ww1$nugget
ceHAT1<-ww1$cov.pars[1]
aeHAT1<-ww1$cov.pars[2]
c0HAT2<-ww2$nugget
ceHAT2<-ww2$cov.pars[1]
aeHAT2<-ww2$cov.pars[2]
  MISEmodel1<-integrate(integrand1,.1,max)$value
MISEmodel2<-integrate(integrand2,.1,max)$value
  ms1[i]<-MISEmodel1
ms2[i]<-MISEmodel2
}
plot(data)
lines(ww1,type="l")
lines(ww2,lty=2,lwd=2)
return(MISEmodel1,MISEmodel2)
}
...............................................................................
when i simulation n=150 data with nsim=1000 i have thise problem in work with 
the function(g)
Error: cannot allocate vector of size 80437 Kb
In addition: Warning messages:
1: Reached total allocation of 255Mb
how i can solve it?
  best regards.
  Sadeghian.
   

 __________________________________________________



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to