[R] Help in optimization

Ricardo Bessa bessa_ricardo at hotmail.com
Wed Oct 11 19:06:11 CEST 2006


I have had a problem in finding the minimum of a function, the function in 
cause is:

curv <- function(a,b){
date <- read.table("bessa.csv",header=T,sep=";",dec=",")
calP <- (22000)/(1+exp(-(a*date$v+b)))
err <- (calP-date$P)^2
return(sum(err))
}

It would like to know which function that I must use to find the values of 
“a” and “b” that minimize the function curv. I Already tried with the 
functions “optim” and “nlm”, but without success, perhaps I am not using 
them correctly.

Ricardo Bessa

_________________________________________________________________
MSN Busca: fácil, rápido, direto ao ponto.  http://search.msn.com.br



More information about the R-help mailing list