Hi Jinsong,
I try to put the "try" in the c1.fun but it still does not work. Do you mean this?

c1.fun<-try(function(data,i){
+  d<-data
+  d$density<-d$fitted+d$res[i]
+  coef(update(c1.nmf,data=d))
+  } ,silent=T)
c1.try<-boot(c1data, statistic = c1.fun, R=5000)
Error in nls(formula = density ~ nmf(time, alpha, delta, psi, tau, gamma),  :
  Convergence failure: false convergence (8)

Thanks
Chunhao


Quoting Jinsong Zhao <[EMAIL PROTECTED]>:

[EMAIL PROTECTED] wrote:
Hi R users,
Is is possible for me to use the try function with boot? I would to do the bootstraping with a nonlinear model(it works well when R < 1000). But it does not work very well (when R is large) thus I try to use "try" to resolve. I put the try function in two cases:

case1: put the try in front of the boot

c1.try<-try(boot(c1data, statistic = c1.fun, R=3999),silent=T)
c1.try
[1] "Error in nls(formula = density ~ nmf(time, alpha, delta, psi, tau, gamma), : \n Convergence failure: false convergence (8)\n"
attr(,"class")
[1] "try-error"

case2: put the try in front of the nls
c1.nmf<-try(nls(density~nmf(time, alpha, delta, psi, tau, gamma),
+            algorithm="port",data=c1,
+            lower=c(alpha=0.1, delta=0, psi=0.2, tau=1, gamma=-5),
+            upper=c(alpha=0.6, delta=0.1, psi=3, tau=7, gamma=2),
+ start=c(alpha=0.35, delta=0, psi=0.99, tau=4.5, gamma=-1.2)),silent=T)
c1.try<-boot(c1data, statistic = c1.fun, R=3999)
Error in nls(formula = density ~ nmf(time, alpha, delta, psi, tau, gamma), :
 Convergence failure: iteration limit reached without convergence

Any suggestion will be helpful.
Many thanks in advance
Chunhao


put try() in your statistic function. in your case, it may be inside
the c1.fun function.

HTH,
Jinsong

______________________________________________
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