Estoy recibiendo un error al ejecutar un gnls() en algunos datos que tengo. Pude converger utilizando nlsLM(), pero me encontré con cierta autocorrelación en mis errores, así que quiero intentar utilizar gnls() para poder tener en cuenta la correlación de mis errores.
Mis datos:
> current_tree
site location tree age.base height dbh.cm volume age.bh tree.ID
2 1 1 1 20 4.2 4.6 5 9.67 1.1
3 1 1 1 30 9.3 10.2 38 19.67 1.1
4 1 1 1 40 14.9 14.9 123 29.67 1.1
5 1 1 1 50 19.7 18.3 263 39.67 1.1
6 1 1 1 60 23.0 20.7 400 49.67 1.1
7 1 1 1 70 25.8 22.6 555 59.67 1.1
8 1 1 1 80 27.4 24.1 688 69.67 1.1
9 1 1 1 90 28.8 25.5 820 79.67 1.1
10 1 1 1 100 30.0 26.5 928 89.67 1.1
11 1 1 1 110 30.9 27.3 1023 99.67 1.1
12 1 1 1 120 31.8 28.1 1104 109.67 1.1
13 1 1 1 130 32.4 28.6 1156 119.67 1.1
14 1 1 1 140 33.1 29.0 1219 129.67 1.1
Este es el código que estoy ejecutando:
> library(nlme)
> expon_model <- function(theta1, theta2, theta3, x){
+ #theta1 is the asymptote
+ theta1*(1 - exp( theta2* ( x^theta3 )))
+ }
> Exponential <- gnls(dbh.cm ~ expon_model(t1, t2, t3, age.bh),
+ data=current_tree, start=list(t1=30, t2=0, t3=1))
Error in gnls(dbh.cm ~ expon_model(t1, t2, t3, age.bh), data = current_tree, :
step halving factor reduced below minimum in NLS step
En caso de que esto ayude, cuando ejecuté esto con nlsLM(), convergí sin tener que elegir muy buenos valores de partida, pero cambié mis valores de partida en este caso para estar muy cerca de lo que convergió nlsLM().