I was getting NAs using the TMB epsilon bias correction, i.e.
sdrep <- TMB::sdreport(mod, bias.correct=TRUE)
summary(sdrep)[,3] # all NA
The model was estimated well (sdrep$pdHess, sdrep$diag.cov.random, sdrep$gradient.fixed, and diag(sdrep$cov.fixed) all looked good). I uncovered a number of issues by
only bias-correcting a subset of derived quantities (using bias.correct.control$split)
sdrep$value[!is.finite(sdrep$value)]
sdrep$sd[sdrep$sd==0]
Some combination of the following were to blame:
ADREPORT-ing quantities derived from non-estimated parameters (mapped to NA)
ADREPORT-ing NaN derived quantities, either from data values not matching expectations (e.g. missing values -999) or parameters that weren't appropriately restricted to avoid taking log(negative).
In case this is useful for others...
I was getting NAs using the TMB epsilon bias correction, i.e.
The model was estimated well (
sdrep$pdHess
,sdrep$diag.cov.random
,sdrep$gradient.fixed
, anddiag(sdrep$cov.fixed)
all looked good). I uncovered a number of issues bybias.correct.control$split
)sdrep$value[!is.finite(sdrep$value)]
sdrep$sd[sdrep$sd==0]
Some combination of the following were to blame:
Happy debugging!