% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.R
\name{get_sdreport}
\alias{get_sdreport}
\title{Calculate standard errors}
\usage{
get_sdreport(
  obj,
  par.fixed,
  exact = FALSE,
  getReportCovariance = FALSE,
  silent = FALSE,
  ...
)
}
\arguments{
\item{obj}{The list returned by \code{\link[RTMB:TMB-interface]{RTMB::MakeADFun()}}}

\item{par.fixed}{Numeric vector of parameters from which to calculate covariance matrix. Optional}

\item{exact}{Logical, whether to use autodiff or finite-difference approximation for the hessian. See details.}

\item{getReportCovariance}{Logical, passed to \code{\link[RTMB:TMB-interface]{RTMB::sdreport()}}}

\item{silent}{Logical, whether to report progress to console. See details.}

\item{...}{Other arguments to \code{\link[RTMB:TMB-interface]{RTMB::sdreport()}} besides \verb{par.fixed, hessian.fixed, getReportCovariance}}
}
\value{
Object returned by \code{\link[RTMB:TMB-interface]{RTMB::sdreport()}}.

A correlation matrix is generated and stored in: \code{get_sdreport(obj)$env$corr.fixed}

The hessian is stored in \code{get_sdreport(obj)$env$hessian}
}
\description{
A wrapper function to return standard errors. Various numerical techniques are employed to obtain
a positive-definite covariance matrix in marginal cases.
}
\details{
Uses \code{\link[stats:optim]{stats::optimHess()}} if \code{exact = FALSE}.
Autodiff with \code{exact = TRUE} is only available for TMB models without random effects, but is also memory-intensive.

In numerically marginal cases where the determinant of the Hessian matrix is less than 0.1, the function will attempt
to calculate the hessian with \code{numDeriv::jacobian()} and the gradient from TMB.

Finally, in other marginal cases where \code{\link[=chol]{chol()}} identifies a positive-definite Hessian but \code{\link[=solve]{solve()}} fails to
invert the matrix, the covariance matrix will be updated with \code{chol2inv(chol(h))}
}
