Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Thorson committed Sep 9, 2024
1 parent ff2d3d9 commit 6fb7010
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/dsem.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function( sem,
warning("Some gradients are higher than 0.01. Some parameters might not be converged. Consider increasing `control$newton_loops`")
}
# Hessian check ... condition and positive definite
Hess_fixed = optimHess( par=out$opt$par, fn=obj$fn, gr=obj$gr )
Hess_fixed = optimHess( par=out$opt$par, fn=obj$fn, gr=obj$gr, control=list(ndeps=rep(0.001,length(out$opt$par))) )
Eigen_fixed = eigen( Hess_fixed, only.values=TRUE )
if( (max(Eigen_fixed$values)/min(Eigen_fixed$values)) > 1e6 ){
# See McCullough and Vinod 2003
Expand All @@ -302,7 +302,7 @@ function( sem,
if( isTRUE(control$getsd) ){
if( isTRUE(control$verbose) ) message("Running sdreport")
if( is.null(Hess_fixed) ){
Hess_fixed = optimHess( par=out$opt$par, fn=obj$fn, gr=obj$gr )
Hess_fixed = optimHess( par=out$opt$par, fn=obj$fn, gr=obj$gr, control=list(ndeps=rep(0.001,length(out$opt$par))) )
}
out$sdrep = sdreport( obj,
hessian.fixed = Hess_fixed,
Expand Down Expand Up @@ -852,7 +852,7 @@ function( object,
return(out)
}

#' @title Marglinal log-likelihood
#' @title Marginal log-likelihood
#'
#' @description Extract the (marginal) log-likelihood of a dsem model
#'
Expand Down
5 changes: 5 additions & 0 deletions scratch/README.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

To use RTMB, change Makevars to be "
PKG_CPPFLAGS = -DTMBAD_FRAMEWORK -DTMBAD_INDEX_TYPE=uint64_t
"

0 comments on commit 6fb7010

Please sign in to comment.