On 27.01.2011 14:08, michalseneca wrote:

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.

The syntax above is correct, hence you need to describe the problem you try to solve, ideally including the full code for f and some example data.

Uwe Ligges



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


______________________________________________
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