Hard to say without seeing Linn() and maybe other relevant data.

Uwe Ligges


Rstarer wrote:
Thanks for the reply.
optim(initpar,Linn,NULL,method="BFGS",hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300))

The optim is to minimize the negative likelihood function which is performed
in function "Linn",
Every time the code stops right after optim, for example, the output looks
like:

"
iter  16 value 42.818394
iter  16 value 42.818394
final value 42.818394 converged
"
It seems from the code that the loop should continue to run, at least
calculate "u" values... but it does not...

Thank you.


Hi all, I wrote the following lines of codes try to do some iterations to find the
global optimal values, but the function does not execute properly. Every
time codes stop after one iteration right after executing the optim()
function. Does anyone could have me to take a look? Thanks.
if (count>0){

k=k+0.05;

mu0=c(83+k,0,0)

Sigma0= diag(0.4,3)

initpar=c(.1+10*k,10*k,10*k,10*k) # initial parameters for Phi[1,1], the 2
Q’s and R

est=optim(initpar,Linn,NULL,method="BFGS",hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300))

stderr=sqrt(diag(solve(est$hessian)))

estimate=est$par

u=cbind(estimate,stderr)

if (u[1]>0 & u[2]>0 & u[3]>0 & u[4]>0){

print("mu0=");print(mu0);

print("initpar=");print(initpar)

#break

} else {count=-1;

}

}




______________________________________________
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.

Reply via email to