Re: [R] Using nlm or optim

2010-07-08 Thread Anita Narwani
___ > > Ravi Varadhan, Ph.D. > Assistant Professor, > Division of Geriatric Medicine and Gerontology > School of Medicine > Johns Hopkins University > > Ph. (410) 502-2619 > email: rvarad...@jhmi.edu > > >

Re: [R] Using nlm or optim

2010-07-08 Thread Joris Meys
Without data I can't check, but try : mle(nll,start=list(c=0.01,z=2.1,s=200),fixed=list(V=Var,M=Mean)) With a random dataset I get : > Mean <- rnorm(136) > Var <- 1 + rnorm(136)^2 > mle(nll,start=list(c=0.01,z=2.1,s=200),fixed=list(V=Var,M=Mean)) Error in optim(start, f, method = method, hessian

Re: [R] Using nlm or optim

2010-07-08 Thread Ravi Varadhan
sistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Anita Narwani Date: Wednesday, July 7, 2010 9:11 pm Subject: [R] Using nlm or optim To: r-help@r-pro

[R] Using nlm or optim

2010-07-07 Thread Anita Narwani
Hello, I am trying to use nlm to estimate the parameters that minimize the following function: Predict<-function(M,c,z){ + v = c*M^z + return(v) + } M is a variable and c and z are parameters to be estimated. I then write the negative loglikelihood function assuming normal errors: nll<-function