Dear R People: Here is a function to minimized:>mfun1function(x,a) { x[1] <- a[1]*x[2] + a[3] - a[2]*(a[1]-a[2])*a[3] x[2] <- a[1]*x[1] - a[2]*a[3] return(x) } Here is my first try:>nlm(mfun1,c(1,1))Error in f(x, ...) : Argument "a" is missing, with no default>>nlm(mfun1,c(1,1),a=c(0.8,0.5,1))Error in nlm(mfun1, c(1, 1), a = c(0.8, 0.5, 1)) : invalid function value in 'nlm' optimizer>I am stumped. I'm sure that it's something really small that I'm overlooking. Thanks in advance for any help. Sincerely, Laura Holt mailto: lauraholt_983 at hotmail.com
Laura Holt wrote:> Dear R People: > > Here is a function to minimized: > >> mfun1 > > function(x,a) { > x[1] <- a[1]*x[2] + a[3] - a[2]*(a[1]-a[2])*a[3] > x[2] <- a[1]*x[1] - a[2]*a[3] > return(x) > } > > Here is my first try: > >> nlm(mfun1,c(1,1)) > > Error in f(x, ...) : Argument "a" is missing, with no default > >> > >> nlm(mfun1,c(1,1),a=c(0.8,0.5,1)) > > Error in nlm(mfun1, c(1, 1), a = c(0.8, 0.5, 1)) : > invalid function value in 'nlm' optimizerYou function returns a vector of length two, but nlm() expects length one (what is the minimum, otherwise?). Uwe Ligges>> > > I am stumped. I'm sure that it's something really small that I'm > overlooking. > > Thanks in advance for any help. > > Sincerely, > Laura Holt > mailto: lauraholt_983 at hotmail.com > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > R-project.org/posting-guide.html