I need a "Hessian" matrix in "nlmnib" package to discuss whether parameters are significant or not. Please let me know how to obtain hessian matrix and how to evaluate the significancy of parameters. Regards Serdar -- View this message in context: http://r.789695.n4.nabble.com/nlmnib-Package-Hessian-Output-tp4645768.html Sent from the R help mailing list archive at Nabble.com.
"nlmnib" Package + Hessian Output
3 messages · nserdar, Ben Bolker
nserdar <snes1982 <at> hotmail.com> writes:
I need a "Hessian" matrix in "nlmnib" package to discuss whether parameters are significant or not. Please let me know how to obtain hessian matrix and how to evaluate the significancy of parameters.
You can get a finite-difference approximation to the hessian by using the hessian() function (surprisingly enough) in the numDeriv package. You haven't given enough detail about your problem, but you may want to consider using the mle2() function in the bbmle package, which will allow you to use nlminb as your optimizer but provides a wrapper that computes significance tests (against the null hypothesis that individual parameters are zero).
Sorry but I don't modified my function with "mle2" :( :(
Can you give example how to obtain Hessian with numDeriv ?
Serdar
######################### Function
Linn=function(param){
phi1=((param[1]^2/(1+param[1]^2)))
phi2=((param[2]^2/(1+param[2]^2)))
phi3=((param[3]^2/(1+param[3]^2)))
phi4=((param[4]^2/(1+param[4]^2)))
sigw1=sqrt(exp(param[5]))
sigw2=sqrt(exp(param[6]))
sigw3=sqrt(exp(param[7]))
sigw4=sqrt(exp(param[8]))
sigv=sqrt(exp(param[9]))
Betam1=((param[10]*100)/(sqrt(1+param[10]^2)))
Betam2=((param[11]*100)/(sqrt(1+param[11]^2)))
Betam3=((param[12]*100)/(sqrt(1+param[12]^2)))
Betam4=((param[13]*100)/(sqrt(1+param[13]^2)))
phi=diag(c(phi1,phi2,phi3,phi4),4,4)
betam=c(Betam1,Betam2,Betam3,Betam4)
sigw=diag(c(sigw1,sigw2,sigw3,sigw4),4,4)
a<-(1.001)
mu0=c(ols[1,1],ols[2,1],ols[3,1],ols[4,1])
sigma0=diag(c(a,a,a,a),4,4)
kf=kfilter1(n,rt,rm,mu0,sigma0,phi,betam,sigw,sigv)
return(kf$like)
}
a<-(1.001)
init.par<-c(0.5,0.5,0.5,0.5,a,a,a,a,a,ols[1,1],ols[2,1],ols[3,1],ols[4,1])
###########################
--
View this message in context: http://r.789695.n4.nabble.com/nlmnib-Package-Hessian-Output-tp4645768p4645838.html
Sent from the R help mailing list archive at Nabble.com.