Changes made in revision 5 of KalmanEM.r
--- /tmp/cvx_eX1i8f 2012-02-07 19:52:02.000000000 -0800
+++ /tmp/cvx_qImJdS 2012-02-07 19:52:02.000000000 -0800
@@ -1277,12 +1277,9 @@
emhess=fdHess(paramvector, function(paramvector, mssm.model) kfNLL(paramvector, mssm.model), mssm.model)
mssm.model$Hessian=emhess$Hessian
mssm.model$gradient=emhess$gradient
-
-#TIC
-J0=array(emhess$gradient,dim=c(length(paramvector),1))%*%array(emhess$gradient,dim=c(1,length(paramvector)))
-I0=emhess$Hessian
-TIC = try(-2*mssm.model$loglike+2*sum(diag(J0%*%solve(I0))))
-mssm.model$TIC = ifelse(!inherits(TIC, "try-error"),TIC,NA)
+mssm.model$parSigma = try(solve(mssm.model$Hessian))
+if(inherits(mssm.model$parSigma, "try-error")) mssm.model$parSigma=NULL
+mssm.model$parMean = paramvector
return(mssm.model)
}
@@ -1290,8 +1287,8 @@
#######################################################################################################
# computeCIs
#######################################################################################################
-computeCIs = function(mssm.model, method="Hessian", alpha=0.05) {
-if(method=="Hessian") {
+computeCIs = function(mssm.model, method="hessian", alpha=0.05) {
+if(method=="hessian") {
#if the model has no Hessian specified, then run emHessian to get it
if(is.null(mssm.model$Hessian)) mssm.model=emHessian(mssm.model)
#standard errors