Hello, I am trying to optimise a nonlinear model to derive 'best-fit' parameter esimates using the genoud function. I have been using the genetic algorithm - gafit - in order to do this, but I am getting parameter estimates that do not always reach the global minimum. I am very keen to apply genoud to optimising this model to see if my results will improve, and also out of personal interest. However the problem I am having is, if I have a set of 'best-fit' parameters (a,b,c) and corresponding variables (X1,X2,X3) for my function, how does one supply the variables to the function that is optimised in genoud? i.e. WSSR <- function(B,D) { a<-B[1] b<-B[2] c<-B[3] Y <- D[1] X1 <- D[2] X2 <- D[3] X3 <- D[4] chi2 = (Y - a*X1+b*X2-c*X3)^2 return(chi2) } genoud(WSSR, nvars=3, pop.size=5000, max=FALSE) Genoud optimises the first variable (in this case the vector B) supplied to the function, however how do I pass the data (the matrix D) to the WSSR function within the genoud framework? In the optim function, you can explicitly define any variables within the function framework, i.e. optim(WSSR, D=data, tol=0.001, .... ) Passing it this way does not work in genoud, and I am at loss as to how I would pass data to the function to be optimised. To put it simply, how do you perform a nonlinear least squares optimisation using genoud? Best Regards -- =====================================Rhys Whitley PhD Candidate Institute for Water and Environmental Resource Management Department of Physics and Advanced Materials University of Technology, Sydney Australia ===================================== [[alternative HTML version deleted]]