Hi there, I am trying to run the following code:
> dcOU<-function(x,t,x0,theta,log=FALSE){ + Ex<-theta[1]/theta[2]+(x0-theta[1]/theta[2])*exp(-theta[2]*t) + Vx<-theta[3]^2*(1-exp(-2*theta[2]*t))/(2*theta[2]) + dnorm(x,mean=Ex,sd=sqrt(Vx),log=log) + } > OU.lik<-function(theta1,theta2,theta3){ + n<-length(X) + dt<-deltat(X) + ~sum(dcOU(X[2:n],dt,X[1:(n-1)],c(theta1,theta2,theta3),log=TRUE)) + } > > #ex3.01.R > require(stats4) Loading required package: stats4 > require(sde) Loading required package: sde Loading required package: MASS Loading required package: fda Loading required package: splines Loading required package: zoo To check the errata corrige of the book, type vignette("sde.errata") Attaching package: 'sde' The following object(s) are masked _by_ '.GlobalEnv': dcOU > set.seed(123) > X<-sde.sim(model="OU",theta=c(3,1,2),N=1000,delta=1) T set to = 1000.000000 > mle(OU.lik,start=list(theta1=1,theta2=0.5,theta3=1), + method="L-BFGS-B",lower=c(-Inf,0,0))->fit Error in optim(start, f, method = method, hessian = TRUE, ...) : 'pairlist' object cannot be coerced to type 'double' but there appears to be a problem with the optimisation process? Unfortunately it's not clear to me from the error message what is going wrong? Can someone please advise. -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-MLE-tp3529445p3529445.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.