Displaying 2 results from an estimated 2 matches for "cumsumcaught".
2008 Feb 08
2
Catching NaNs from pweibull()
...ion. However the pweibull function is annoyingly
producing NaNs, which nls() refuses to handle. I have put a sample of the
code below. Is there a way to prevent these NaNs from interfering, for
example a method to catch them? I get the following error when I try to run
the code:
res.nls <- nls(cumsumcaught ~
Pcatch*Prepens.released*(1-pweibull(distances,k,l)),
+ start = list(k=1,l=12), trace=T, control = my.control)
Error in numericDeriv(form[[3]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
In addition: Warning messages:
1: NaNs produced in: pweibull(q...
2008 Oct 07
0
Algorithm = "port" convergence codes
...##Code
Acancellata.caughtintraps = c(6,2,1,2,0,0,0,0,0,0,0)
Acancellata.released = 1250
distances = c(2,3,4,5,7.5,10,12.5,15,17.5,20,25)
totalseedscaught = sum(Acancellata.caughtintraps)
Pcatch = totalseedscaught/Acancellata.released
## Calculate cumulative seed numbers reaching each distance
cumsumcaught <- rev(cumsum(rev(Acancellata.caughtintraps)))
i = numeric(11)
i <- distances
## Gamma distribution
gamma.nls <- nls(cumsumcaught ~ Pcatch*Acancellata.released*
pgamma(distances,shape=a,scale=c,lower.tail=FALSE),
## 'alg="port"' is required for lower...