Displaying 1 result from an estimated 1 matches for "dat_mu".
Did you mean:
dat_ff
2011 Sep 05
1
In optim() function, second parameter in par() missing
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 = function(dat, mu, sd) {
pnorm(dat, mu, sd)
}
optim(fn=max.func, dat=dat, par=c(mu=dat_mu, s=dat_s))
I get sd is missing error. If I wrote par=c(s=dat_s, mu=dat_mu) , then it
tells me mu is missing. Can someone please help?
Thanks!
Colin
--
View this m...