[R] optim - Self-Start values - growth function
agent dunham
crosspide at hotmail.com
Tue Jan 3 17:52:08 CET 2012
Dear community,
I'm trying to model growth with this function: Yi = A* exp(-k*(1/ti^m)) ; A
asymptote, k rate of decrease of the relative growth rate, m shape
parameter.
I don't have variable time so, finally, following some papers, I try to fit
Yi+a = A*exp(-k* (1/(-k/(log(Yi/A)))^(1/m)+a)^m);
a= 10
I've tried:
a) nls.1 <- nls(Yi+a ~A*exp(-k* (1/(-k/(log(Yi/A)))^(1/m)+10)^m), data=pgm,
start= list(A=30.3656 , k= 3271.703374, m= -1.870935)) ; start values
obtained: A from data, k & m substituting. But I obtain this error:
/Error en numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model /
b) est.o4 <- optim( c(30.3656, 2.841345, 3270.109), funcL, method="SANN",
hessian=TRUE, yr= data$Yia, x=data$Yi)
where funcL <- function( par, yr, x ) {
A = par[1]
m = par[2]
k = par[3]
y <- A*exp(-k* (1/(-k/(log(x/A)))^(1/m)+a)^m)
sum((yr-y)^2) }
Output is as follows:
/$par
[1] 46.9067228 -0.7824855 16.5397317
$value
[1] 977.2446
$counts
function gradient
10000 NA
$convergence
[1] 0
$message
NULL
$hessian
[,1] [,2] [,3]
[1,] 13.87311 -1583.814 -20.82244
[2,] -1583.81444 190698.126 2526.48636
[3,] -20.82244 2526.486 33.81710/
/
> eigen(round(est.o4$hessian,4), symmetric= TRUE)
$values
[1] 1.907448e+05 7.786493e-01 2.848952e-01/
I've read here many entries with nls problems, but I'm new with nls and I
don't understand. Why nls fails with my function? Is it nls or my function?
On the other hand is there any SelfStart function where I can find initial
values for A, k, m parameters?
This is the data I'm dealing with:
http://r.789695.n4.nabble.com/file/n4257580/data data Excel Format:
http://r.789695.n4.nabble.com/file/n4257580/data.xls data.xls
Any help would be much appreciated, user at host.com
--
View this message in context: http://r.789695.n4.nabble.com/optim-Self-Start-values-growth-function-tp4257580p4257580.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list