Re: [R] In optim() function, second parameter in par() missing

2011-09-15 Thread colstat
Hi, David I happened to see this http://www.unc.edu/~monogan/computing/r/MLE_in_R.pdf And they wrote optim(c(0,1),normal.lik1,y=y,method="BFGS") But it doesn't actually work, like you mentioned, it only takes 2 parameters, is that the reason why. R gives this error > optim(par=parameters, normal.

Re: [R] In optim() function, second parameter in par() missing

2011-09-05 Thread colstat
Thanks, David. You suggestion worked very well. The par() in optim() only takes one argument, so I combine it into a vector. Now, I will run it with my actual code and see what happens. Colin -- View this message in context: http://r.789695.n4.nabble.com/In-optim-function-parameter-in-par-miss

Re: [R] In optim() function, second parameter in par() missing

2011-09-05 Thread David Winsemius
On Sep 5, 2011, at 11:41 AM, David Winsemius wrote: On Sep 5, 2011, at 10:30 AM, colstat wrote: Hi, First time using the optim(), can someone please tell me what I am doing wrong? The error looks like this Error in .Internal(pnorm(q, mean, sd, lower.tail, log.p)) : 'sd' is missing Yo

Re: [R] In optim() function, second parameter in par() missing

2011-09-05 Thread David Winsemius
On Sep 5, 2011, at 10:30 AM, colstat wrote: Hi, First time using the optim(), can someone please tell me what I am doing wrong? The error looks like this Error in .Internal(pnorm(q, mean, sd, lower.tail, log.p)) : 'sd' is missing You should be using a textbook. Which one are you consul

[R] In optim() function, second parameter in par() missing

2011-09-05 Thread colstat
Hi, First time using the optim(), can someone please tell me what I am doing wrong? The error looks like this Error in .Internal(pnorm(q, mean, sd, lower.tail, log.p)) : 'sd' is missing An example of the error dat = c(20, 19, 9, 8, 7, 4, 3, 2) dat_mu=mean(dat) dat_s=sd(dat) max.func = funct