Re: [R] Question regarding to maxNR

2010-03-11 Thread Bill.Venables
...@r-project.org] On Behalf Of bill.venab...@csiro.au Sent: Friday, 12 March 2010 4:23 PM To: yh...@illinois.edu; r-help@r-project.org Subject: [ExternalEmail] Re: [R] Question regarding to maxNR Your problem is numerical. Try replacing log(prod(dcauchy(x,mu,s))) by sum(log(dcauchy(x,mu,s

Re: [R] Question regarding to maxNR

2010-03-11 Thread Bill.Venables
Your problem is numerical. Try replacing log(prod(dcauchy(x,mu,s))) by sum(log(dcauchy(x,mu,s))) and see the difference. Here's what I get: > mu <- 2 > s <- 1 > n <- 300 > library(maxLik) > set.seed(1004) > x <- rcauchy(n,mu,s) > loglik <- function(mu) { + sum(log(dcauchy(x,mu,s))) + } > m

Re: [R] Question regarding to maxNR

2010-03-11 Thread Arne Henningsen
Hi Kate! On Fri, Mar 12, 2010 at 6:20 AM, kate wrote: > Hi R-users, > > Recently, I use maxNR function to find maximizer. I have error appears as > follows > Error in maxNRCompute(fn = fn, grad = grad, hess = hess, start = start,  : >  NA in the initial gradient > > My code is > > mu=2 > s=1 > n