Running examples in ‘LaMa-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: MCreport
> ### Title: Sample parameters from approximate Gaussian posterior
> ###   distribution
> ### Aliases: MCreport
> 
> ### ** Examples
> 
> step <- trex$step[1:1000] # subsetting trex data
> N <- 2                    # 2 states
> 
> # custom likelihood
> nll <- function(par) {
+   getAll(par)
+   Gamma <- tpm(eta)
+   delta <- stationary(Gamma)
+   mu <- exp(log_mu); REPORT(mu)
+   sigma <- exp(log_sigma); REPORT(sigma)
+   allprobs <- matrix(1, length(step), N)
+   for(j in 1:N) allprobs[,j] <- dgamma2(step, mu[j], sigma[j])
+   -forward(delta, Gamma, allprobs)
+ }
> 
> # initial parameters in named list
> par0 <- list(eta = rep(-2,2), 
+              log_mu = log(c(0.3, 1)), 
+              log_sigma = log(c(0.2, 0.7)))
>     
> # constructing AD object        
> obj <- MakeADFun(nll, par0, silent = TRUE)
> 
> # optimising
> opt <- nlminb(obj$par, obj$fn, obj$gr)
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
Warning in nlminb(obj$par, obj$fn, obj$gr) : NA/NaN function evaluation
> 
> # sampling from distribution of the MLE
> samples <- MCreport(obj, nSamples = 10, report = TRUE)
Evaluating Hessian...
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in .local(A, ...) :
  CHOLMOD warning 'matrix not positive definite' at file 'Supernodal/t_cholmod_super_numeric_worker.c', line 1114
Warning in rgmrf(nSamples, p_hat, Q) :
  Precision matrix is not PD, adding jitter...
Required 20 attempts
Error in rgmrf(nSamples, p_hat, Q) : 
  Matrix still not PD after 20 jitter attempts
Calls: MCreport -> <Anonymous> -> rgmrf
Execution halted