Performs Gauss-Newton optimisation of the variational free energy for a non-linear forward model with Gaussian priors. Mirrors SPM25's dcm_nlsi_GN.

dcm_nlsi_GN(M, U, Y)

Arguments

M

Model specification (list with IS/f/g, priors pE, pC, hyperpriors hE, hC, ...).

U

Input structure passed through to M$IS.

Y

Data (or list with $y, $Q, $X0, $dt).

Value

List with posterior expectation Ep, covariance Cp, log-precision estimate Eh, free energy F, and components.

Details

Most users should call dcm_estimate instead, which assembles M, U and Y from a DCM specification and calls this function. Use dcm_nlsi_GN directly only to invert a non-linear model that is not an fMRI DCM.

Progress is reported per Gauss-Newton iteration as EM:(+) k F: ..., where (+) marks an accepted step and (-) a rejected one. Set M$noprint <- 1 to silence it.

See also

dcm_estimate for the user-facing entry point.

Examples

# Inverting even the small bundled model runs the full Gauss-Newton loop
# (roughly 75 seconds), so this is not run automatically.
if (FALSE) { # \dontrun{
  data(toy_dcm)

  # The easy route (dcm_estimate builds M, U and Y for you):
  fit <- dcm_estimate(toy_dcm)
  fit$F

  # dcm_nlsi_GN is what it calls underneath, and returns the same
  # posterior fields:
  str(fit$Ep, max.level = 1)
} # }