Hi, am very new to R and I've written an optim function, but can't get it to
work

least.squares.fitter<-function(start.params,gr,low.constraints,high.constraints,model.one.stepper,data,scale,ploton=F)
 {
  
result<-optim(par=start.params,method=c('Nelder-Mead'),fn=least.squares.fit,lower=low.constraints,upper=high.constraints,data=data,scale=scale,ploton=ploton)
   return(result)                                                               
                                             
 }
least.squares.fitter(c(2,2),c(0,0),c(Inf,Inf),ricker.one.step,dat,'linear')

where least.squares.fit is the function returning the difference between
model data points and predicted points (residuals, residuals^2 and SSR),
which i am trying to minimise

and ricker.one.step is the function that generated the predictions

I've been trying to figure out whats wrong for hours but can't.

Many thanks,

Tariq



--
View this message in context: 
http://r.789695.n4.nabble.com/help-using-optim-function-tp4647231.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to