I have two sets of age and length data for the same fish species, both provided in the following link.
And I would like to a fit growth model, using R, that allows for a change in the growth at a specific moment of the lifespan.
I tried using the nls function and provided starting values adapted to my data. The model is an adaptation of the Von Bertalanffy growth model that is supposed to return values for five different parameters (Linf, k0, t0, k1, and t1).
The code I used, for both datasets, was the folowwing:
fit <-as.formula(TL~ Linf * (1 - exp(-K0 * (Age - t0))) * (Age < t1) +
Linf * (1 - exp(-K0 * (t1 - t0) - K1 * (Age - t1))) * (Age > t1))
model<-nls(fit, data=dataset, start=list(Linf=17, K0=0.3, t0=-2, K1=0.1, t1=3), nls.control(maxiter = 500, tol = 1e-03, minFactor = 1/1024, printEval = FALSE, warnOnly = FALSE))
summary(model)
For the first dataset the values returned were the following:
Formula: TL ~ Linf * (1 - exp(-K0 * (Age - t0))) * (Age < t1) + Linf *
(1 - exp(-K0 * (t1 - t0) - K1 * (Age - t1))) * (Age > t1)
Parameters:
Estimate Std. Error t value Pr(>|t|)
Linf 4.089e+02 1.565e+04 0.026 0.9792
K0 5.477e-03 2.141e-01 0.026 0.9796
t0 -2.934e+00 1.500e+00 -1.956 0.0511 .
K1 7.596e-04 3.004e-02 0.025 0.9798
t1 2.246e+00 2.143e-01 10.477 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.881 on 457 degrees of freedom
Number of iterations to convergence: 294
Achieved convergence tolerance: 0.000979
While for the second dataset, the values returned were:
Formula: TL ~ Linf * (1 - exp(-K0 * (Age - t0))) * (Age < t1) + Linf *
(1 - exp(-K0 * (t1 - t0) - K1 * (Age - t1))) * (Age > t1)
Parameters:
Estimate Std. Error t value Pr(>|t|)
Linf 15.04002 0.60919 24.689 < 2e-16 ***
K0 0.16740 0.01895 8.833 < 2e-16 ***
t0 -3.67353 0.34427 -10.671 < 2e-16 ***
K1 0.11986 0.02007 5.971 2.63e-09 ***
t1 2.29970 0.31711 7.252 5.18e-13 ***
---
Only the values returned for the second dataset make sense for the species in question.
Why is the nls function returning such different parameter values, while using the same model, same starting values and very similar datasets?