Skip to content

Quick Question - MLE for Geometric Brownian Motion Process with Jumps

2 messages · John-Paul Taylor, Dieter Menne

#
Hi All,


I am relatively new to R and having a great experience with it but have come up with a little road block. 

I am tying to run a maxlik regression and keep getting the error,
NA in the initial gradient

My Code is below:
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( - (combinedlrph1-mu-j*nu)^2/2*(sigma^2+j*gama^2))))))))
	logLikVal
}
rescbj<- maxLik(gbmploglik, grad = NULL, hess = NULL, start=c(1,1,1,1,1), method = "Newton-Raphson")

I was wondering if there is something that I have to do with the grad= and maybe put something other then NULL. The other issue is that there might be something wrong with the loglikelihood function, because of the loop that I put in it.

If you have any suggestion or see something incorrect that I am doing please let me know.

Thanks

JP
#
John-Paul Taylor <johnpaul.taylor <at> ryerson.ca> writes:
(combinedlrph1-mu-j*nu)^2/2*(sigma^2+j*gama^2))))))))
method = "Newton-Raphson")
maybe put something other then NULL.
function, because of the
I have not used that function, but the error message is rather clear in 
telling you that your start values are not good. Try to plot the function 
and the  gradient at that point. Sometime moving by a very small amount 
helps.

Dieter