[R] Help use try function with boot

ctu at bigred.unl.edu ctu at bigred.unl.edu
Sat Sep 6 14:08:06 CEST 2008


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



More information about the R-help mailing list