[R] optim function multi variables -newbie

michalseneca michalseneca at gmail.com
Thu Jan 27 14:08:59 CET 2011


Hi ,
can i ask if somebody know the syntax for optim function with multiple
variables:

I have function  f  (params,y,g,h,j) returnig z
y<-C(0.2,0.5,0.6)
where 
params<-c(x1,x2)
I define g,h,j and then I define params, then use
optim to structure it ..however if i use syntax

optim(params , f,y=y,g=g,h=h,j=j) to optimize params , but i got result
equalling to my params ..which is kind of wrong. 
I and if i use 
optim(params , f(params,y=y,g=g,h=h,j=j)) I get 

Error in function (par)  : could not find function "fn"

how ever none of them seems to be producing meaningful results

Please I am newbie and could not find a proper answer to that..

Help me.!!

Thanks

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



More information about the R-help mailing list