Hi, I have been using maxLik to do some MLE of Geometric Brownian Motion Process and everything has been going fine, but know I have tried to do it with jumps. I have create a vector of jumps and then added this into my log-likelihood equation, know I am getting a message: NA in the initial gradient My codes is hear # n<-length(combinedlr) j<-c(1,2,3,4,5,6,7,8,9,10) gbmploglik<-function(param){ mu<-param[1] sigma<-param[2] lamda<-param[3] nu<-param[4] gama<-param[5] logLikVal<- - n*lamda - .5*n*log(2*pi) + sum(log(sum(for(j in 1:10)(cat((lamda^j/factorial(j))*(1/((sigma^2+j*gama^2)^.5)*exp( - (combinedlr-mu-j*nu)^2/2*(sigma^2+j*gama^2)))))))) logLikVal } rescbj<- maxLik(gbmploglik, grad = NULL, hess = NULL, start=c(0,1,1,1,1), method = "Newton-Raphson") summary(rescbj) # I am also was wondering if anyone know if there was a package that dealt with Geometric Brownian Motion Process augmented with jumps. Then I could just put that into my code and might resolve the issue. Any suggest as to how to resolved this issue, are greatly apprecaited. Yours truly, JP

Hi, The error message is clear in that the gradient cannot be evaluated at your starting value for the parameters. Is your likelihood a smooth function of parameters? If so, then provide a different starting value. If it is not smooth, then you may have to use a method that does not depend on gradients, such as Nelder-Mead. Can you provide a reproducible example, which would help us dig deeper into your problem? Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvaradhan at jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of John-Paul Taylor Sent: Friday, April 03, 2009 8:30 AM To: r-help at r-project.org Subject: Re: [R] Geometric Brownian Motion Process with Jumps Hi, I have been using maxLik to do some MLE of Geometric Brownian Motion Process and everything has been going fine, but know I have tried to do it with jumps. I have create a vector of jumps and then added this into my log-likelihood equation, know I am getting a message: NA in the initial gradient My codes is hear # n<-length(combinedlr) j<-c(1,2,3,4,5,6,7,8,9,10) gbmploglik<-function(param){ mu<-param[1] sigma<-param[2] lamda<-param[3] nu<-param[4] gama<-param[5] logLikVal<- - n*lamda - .5*n*log(2*pi) + sum(log(sum(for(j in 1:10)(cat((lamda^j/factorial(j))*(1/((sigma^2+j*gama^2)^.5)*exp( - (combinedlr-mu-j*nu)^2/2*(sigma^2+j*gama^2)))))))) logLikVal } rescbj<- maxLik(gbmploglik, grad = NULL, hess = NULL, start=c(0,1,1,1,1), method = "Newton-Raphson") summary(rescbj) # I am also was wondering if anyone know if there was a package that dealt with Geometric Brownian Motion Process augmented with jumps. Then I could just put that into my code and might resolve the issue. Any suggest as to how to resolved this issue, are greatly apprecaited. Yours truly, JP ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.