Skip to contents

inlavanilla 26.12.01

  • A Hessian from the hook hess_mode of vanilla_core() now counts in the budget of the VB correction (vb_budget) as the calls that it replaces. Without hess, these are the central differences of the gradient: 2m gradient calls and the search for their steps, which the engine works out from the diagonal of the Hessian without calling logpost. With hess as well, the hook replaces one call of hess and counts as that one call. Before, the hook counted as one call in every case and its step search was left out, so the cap on the solve after a failed one-step check was far lower with the hook than without it, and such a fit could stop short where the same fit without the hook went on. Now a fit almost always has the same cap with or without the hook, and so the same VB correction to the error of the differences. The worked-out step search can differ from the real one near a test value of the search, or after a restart of the mode search, and the cap can then differ by a sweep. This matters only to a package that holds a copy of the engine and passes the hook, such as INLAvaan, and only to its fits that fail the one-step check. inla_vanilla() does not take the hook, and its fits do not change at all.

  • The help of inla_vanilla() and of vb_budget in vanilla_control() now says that with hess the cap of the VB solve is lower than with grad alone. nlminb() uses hess and usually makes fewer calls, so a fit that fails the one-step check can stop its solve sooner and land elsewhere than the same fit without hess. A larger vb_budget narrows the difference, and Inf removes it. Fits do not change.

inlavanilla 26.11.29-1

  • The diagnostics warning’s line on the Gaussian marginals of the unscanned parameters (the gaussian_marginals of vanilla_core()) named all of them after any flagged VB bullet, also when none had moved. It now names only those whose own VB shift, or step still to go, is over 0.1 SDs, and is left out when there are none: a line on parameters that did not move is no use.

inlavanilla 26.11.29

  • The hook gaussian_marginals of vanilla_core() has changed (INLAvaan issue 37). This matters only to a package that holds a copy of the engine and passes the hook, and it changes the behaviour that the engine vignette documents. inla_vanilla() does not expose the hook, and its fits are unchanged, to the last bit.

    Before, a parameter of the hook kept a VB shift of zero and got the Gaussian marginal at the mode. Now it takes the VB shift like every other parameter, on every route of vb_correction, and gets the Gaussian marginal at the VB mean, with the Laplace SD. It is still not scanned. Its vb_shift, vb_shift_sigma and kld hold their real values, and the VB checks apply to it. A fit with the hook now has the mode, the VB mean and the log marginal likelihood of the same fit without it.

    The reason is that such a parameter can depend on the others, as an intercept with a normal prior that is not flat does. The condition of the hook is now only that the log-posterior is exactly quadratic along each of its axes with the other parameters fixed. A parameter that depends on the others has a posterior mean away from its mode, and a shift held at zero also made the VB term of the log marginal likelihood wrong, in most fits too large. On a normal mean with a N(0, 1) prior and 20 observations, that mean was 0.15 posterior SDs from its posterior mean and is now 0.004 SDs from it. Nothing changes for a parameter that is separate from the others, to the accuracy of the VB rule.

    One limit is new. The marginal of a parameter of the hook is now only as accurate as the VB correction, and no check compares its centre with a scan (mean_gap is NA for it). Where the posterior is far from Gaussian, the VB mean can be further from the posterior mean than the mode is. The engine vignette states both limits of the hook, the Gaussian shape and this one. When the VB correction did not settle, or shifted a parameter by more than 1 SD, the warning now says that the Gaussian marginals of those parameters are centred on the VB mean.

  • The skew-normal fit computed the Mills ratio phi(u) / Phi(u), which its gradient and Hessian use, with a floor of -745 on log Phi(u). The floor made the ratio wrong for u below about -38.5, and it is now switched off, so the ratio is right for every u. Ordinary fits do not change: they evaluate the ratio only at u far above that (the lowest in any traced fit was about -12), where the two versions agree to the last bit. A scan far narrower than its grid, with one to three points within 6 of its maximum, could reach that region, and its fit can change.

inlavanilla 26.11.27

  • New use_vanilla_badge() adds a README badge to a package that holds a copy of the engine. It writes .github/inlavanilla-badge.json, which shields.io reads to draw a badge with “vanilla” and the release in the lock, such as “v26.11.25-2”, and prints the line for the README. use_vanilla() rewrites the file whenever it updates the copy, so the badge follows the lock, and offers use_vanilla_badge() at the end of its list until the file exists.

  • A fit with hess takes fewer calls of logpost to check grad and hess at the mode (grad_gap): about 2m, where it took about 6m to 8m. The check takes its steps from the diagonal of hess, which gives each conditional posterior SD, where it searched for them from a tiny step. grad_gap still compares the slope and the curvature along each axis with logpost, one parameter at a time, as it does without hess, and a diagonal that is far off still costs a search and is still flagged. Every other number of the fit is unchanged, to the last bit. On the Political Democracy model in RTMB with a Hessian tape (m = 39) a fit takes 873 calls of logpost, where it took 1029.

inlavanilla 26.11.25-2

  • A fit that fails the one-step check of the default VB correction can now take twice as many sweeps to solve the VB equation: the cap is twice the calls of the mode and Hessian over 2m + 1, where it was those calls over 2m + 1. At the old cap the solve of a hard fit often stopped short of its root. With a gradient the VB stage of such a fit now costs at most twice what the mode and Hessian did, and without one up to 2(m + 1)(m + 2) / (2m + 1) times, about m times. A fit that passes the check is unchanged, to the last bit. A fit that fails it, and whose solve stopped at the old cap, has a different VB mean and log marginal likelihood.

  • vanilla_control() has the new entry vb_budget, that factor of two. vb_budget = 1 is the old cap, and vb_budget = Inf lets the solve run until it converges or reaches vb_maxit iterations.

inlavanilla 26.11.25-1

  • The default VB correction (vb_correction = "onestep") now checks its one step, and solves the VB equation where the check fails. A second sweep at the step tests that the fixed-point map the step iterates is a contraction there: the step must reduce the residual of the VB equation (vb_lhat below 1), and the slope of the map along the step must lie between -1 and 1 at the mode and at the step (vb_j0, vb_j1). A fit that passes keeps its one step, to the last bit. A fit that fails solves the VB equation on the same sweeps by Broyden’s method, from the mode, and raises a new warning, of class inlavanilla_vb_check_warning, that the posterior is far from Gaussian along the mean correction, naming the parameter the one step moved furthest. The warning comes whether or not the solve converged.

  • The check, the solve, the warning and the diagnostics are the same with and without a gradient. With a gradient a sweep is 2m + 1 gradients, and a fit that passes takes 4m + 2 gradient calls for its VB stage, where it took 2m + 1 gradient and 4m + 2 logpost calls. Without one a sweep is a Stein pass of (m + 1)(m + 2) values of logpost and each slope takes 4m more, so a fit that passes takes 2(m + 1)(m + 2) + 8m calls, where it took (m + 1)(m + 2) + 4m + 2. The sweeps are capped at the calls of the mode and Hessian over 2m + 1, the two of the check among them. With a gradient the VB stage then costs no more than the mode and Hessian. Without one, a fit that fails the check can spend up to (m + 1)(m + 2) / (2m + 1) times the calls of its mode and Hessian, about m / 2 times.

  • This takes the place of the gain ratio and of the iteration with capped steps after a first step over 2.5 posterior SDs, which are gone. A fit whose first step was over 2.5 SDs, or whose check fails, has a different VB mean and log marginal likelihood. vb_correction = "full" is unchanged.

  • diagnostics() has four new global entries: vb_lhat, vb_j0 and vb_j1, the numbers of that check, and vb_solve, 1 if it failed and the solve ran. vb_gain_ratio is removed, with its warning. After a solve, vb_step_sigma is the step still to go where the solve stopped, which is recorded and not flagged, and the fit still prints as converged. summary() has a line for a flagged check, and print() counts it.

  • For packages that copy the engine: vanilla_core() raises the new warning itself, check_flags() has the new flag vb_check and no vb_gain, and core$diagnostics$vb has the new entries solve, check and check_worst and no gain_ratio. vb_correct() returns the same. The advice of diagnostic_problems() no longer needs vb_full.

inlavanilla 26.11.25

  • This release replaces 26.11.24-1, which was withdrawn. Its changes are listed here.

  • New use_vanilla() copies the engine of inlavanilla, the files R/vanilla-*.R behind inla_vanilla(), into another package, so that the package can call vanilla_core() without depending on inlavanilla. It takes the files from a release on GitHub (by default that of the installed version) or from a local clone, writes the lock inst/inlavanilla.lock with the MD5 hash of each file, and adds to the package’s DESCRIPTION what the engine needs: its copyright holders, cli, stats and utils in Imports, future and parallelly in Suggests, and R (>= 4.1.0). It removes nothing, stops when a copy was edited by hand, and ends with a list of what is still to do. Run with a newer release, it updates the copy.

  • New vanilla_status() checks a copy: the files match the lock and the lock matches its release, no name clashes, the DESCRIPTION and the license suit the engine, and whether a newer release changes a copied file. use_vanilla_test() and use_vanilla_ci() add a test and a GitHub Actions workflow that check the copy.

  • The new vignette vignette("engine") shows how to copy and update the engine, and documents vanilla_core() and the functions around it. These functions change only with a NEWS bullet that says so.

  • The skew-normal functions of the engine change. They are internal in inlavanilla, but INLAvaan, which copies the engine, exports some of them. No fit changes: on the tests, vignettes and articles, every summary, marginal, VB mean, covariance, log marginal likelihood and LOO estimate is the same to the last digit as in 26.11.24.

  • summary() with no probabilities, probs = numeric(0), now works when a parameter is reported on the natural scale. Before, it stopped with an error, because qsnorm() returned NA for an empty probs (see below). With transform = FALSE it already worked.

  • Internal changes, for INLAvaan and other packages that copy the engine:

    • psnorm() and qsnorm() return a zero-length result when any argument has length zero, as pnorm() and qnorm() do. Before, they returned NA. The result now keeps the names and dimensions of q or p, as the result of dsnorm() keeps those of x.
    • qsnorm_fast() recycles its arguments to the length of the longest, as qsnorm() does. Before, an alpha longer than p gave NA or an error.
    • fit_skew_normal() stops with an error when temp is not a single finite positive number, or threshold_log_drop is not a single finite negative number. The error comes from abort() in R/vanilla-utils.R, so R/vanilla-skew-normal.R can no longer be copied without that file.
    • The comments of the skew-normal functions are true in any package that copies them, and give the measured error of qsnorm_fast(). For |alpha| up to 30 it is at most 0.085 in units of omega down to a tail probability of 1e-15, except in a narrow window of alpha deep in the lighter tail.

inlavanilla 26.11.24

  • This version renames arguments and diagnostics so that inlavanilla and INLAvaan, which takes its engine from inlavanilla from its version 0.4.0, use one name for one thing. The old names of arguments still work, with a warning. A fit gives the same numbers as in 26.11.23, except where a bullet below says otherwise: on the tests, vignettes and articles, every summary, marginal, VB mean, covariance, log marginal likelihood and LOO estimate is the same to the last digit, and only the fits with hess make more logpost calls.

  • vb is renamed vb_correction, the name INLAvaan uses, and its "off" is now "none": vb_correction = c("onestep", "full", "none"). TRUE and FALSE still mean "onestep" and "none". vb still works, with a warning once per session, and will be removed in a later version, and a new value given to it gets an error that points to vb_correction. The fit stores the setting as fit$vb_correction, in place of fit$vb.

  • width is renamed marginal_scan, the name INLAvaan will use from its version 0.4.0, with the values "linear" (was "trace", the default), "exact" (was "cmp") and "laplace" (was "tk"), and one new value, "plain", a scan with no width term, which shows what the volume correction adds. width still works, with a warning once per session, and will be removed in a later version, and a new value given to it gets an error that points to marginal_scan. The fit stores the setting as fit$marginal_scan, in place of fit$width, and each parameter’s scan is the marginal_scan column of fit$diagnostics$marginals (was width). summary() names a scan other than the default on a line that starts “Scans:”. tk_fallback is unchanged.

  • marginals = "skewnorm" is the new name of the skew-normal marginals, the name of INLAvaan’s marginal_method. "skewnormal" still works, as an alias, and a fit stores "skewnorm" in fit$marginals.

  • New vanilla_control() builds the control list of inla_vanilla(), with one entry per setting, so that an editor can complete the names. It has three new entries for the mode search: mode_maxit, mode_maxeval and mode_tol, the iter.max, eval.max and rel.tol of nlminb(), with the same defaults as before (5000, 5000 and nlminb’s 1e-10). nlminb = list() still passes any other nlminb() control, such as trace = 1. Its iter.max, eval.max and rel.tol still work alone, but setting one of them together with its named entry is an error. A plain list still works as control. INLAvaan’s inlavaan_control() will have the same entries, from its version 0.4.0.

  • diagnostics() has two Hessian condition numbers, each with one meaning in inlavanilla and, from its version 0.4.0, INLAvaan: hess_cond is now the raw condition number of the Laplace covariance, as INLAvaan defines it, and hess_cond_cor is the one that was called hess_cond before, on the correlation scale, free of units. For a fit saved by an earlier version, diagnostics() takes the raw one from the covariance. The fit-time warning, summary() and verbose = TRUE use hess_cond_cor, at the same level as before (1e8), so no fit warns differently.

  • A logpost value at or below -1e39 now counts as -Inf, as NA and NaN already did. Some code returns -1e40 where it fails, as lavaan’s and INLAvaan’s likelihoods do. As a finite number it passed for a very low density: the VB fallback could take a failed node for one it can average over, and a failed start did not stop the fit.

  • A fit with hess now compares grad with logpost at the mode, as a fit without one does: grad_gap is no longer NA there, and its curvature part now checks the diagonal of hess. It reads the differences of logpost that set the steps of the Hessian in a fit without hess: 2 more logpost calls per try of the step search, usually 3 or 4 tries per parameter, so about 6m to 8m calls, and up to 60m when the search fails. The marginals do not change, and neither does the call budget of the one-step VB correction, which leaves these calls out.

  • A supplied hess is now checked for symmetry at the mode, as the Hessian from grad already was, with a warning when it is not symmetric to 1e-3 relative to its diagonal. The fit then uses its symmetric part, as before. verbose = TRUE reports the asymmetry for both, as “Asymmetry of the Hessian”.

  • On parallel workers (forked, or separate R sessions), a logpost, grad or hess that calls a global helper of the same name, such as a logpost() of the user’s own, now finds that helper. Before, the worker took it for the user’s function, which then called itself until R stopped it, and the scans ran serially, with a note whose advice to use forked workers did not help. The same holds for a loglik in loo() and waic().

  • When the check of a parallel worker fails with an error, the note that the scans will run serially now gives that error.

  • Internal changes, for INLAvaan and other packages that copy the engine:

    • The engine, every stage of a fit, is in the files R/vanilla-*.R, which hold only internal code: no help, exports, S3 generics or methods, and not the name of the package. Another package copies them unchanged. A check in CI keeps them so, and the tests check that they call nothing from the other files. Parallel workers load the package that holds the engine, whatever its name.
    • vanilla_core() runs the stages and returns a plain list, which inla_vanilla() turns into its fit. It raises the warnings of the stages but installs no handler, so a caller records and muffles them as it wants. It takes two hooks that inla_vanilla() does not expose: hess_mode, a Hessian called only at the mode, and gaussian_marginals, parameters whose marginal is taken as Gaussian, with their VB shift held at zero and no scan. verbose = TRUE shows those parameters with a dash in the table of the marginals. Where logpost fails, grad must return a value that is not finite.
    • sn_draws() makes the copula draws of sampling(), with the correlation matrix of the copula as an argument.
    • The Taylor terms of loo() and waic() (taylor_terms()) and their summaries are in R/vanilla-taylor.R, under INLAvaan’s names for the per-unit terms: l_star, det_term, and the leverages k_max, k_min, k_sum (the total, -tr(Omega H_u)) and k_ssq.
    • diagnostic_problems() gives the bullets of the fit-time warning, worded by a list of advice that the caller passes, so that each package names its own arguments.
    • CI checks the package on R 4.1, the floor in DESCRIPTION, and checks the formatting with air, whose settings are in air.toml.
    • INLAvaan’s Sobol VB rule, which it drops in 0.4.0, is kept as research code in lab/sobol-vb/, with a check that it reproduces the shifts of INLAvaan 0.3.5.

inlavanilla 26.11.23

  • When the mode search runs off, or lands far from the posterior mass, the diagnostics warning now says what can cause it and what to do: random effects in logpost whose scale can run to zero (a funnel), to be integrated out of logpost. vignette("diagnostics") explains the case.

  • Versions are now dates, as in R-INLA: YY.MM.DD, the day of the change, with -1 or -2 for a second or third version published on the same day. There are no .9000 development versions. This version, 26.11.23, follows 0.1.1, and a date sorts after every 0.x version, so an update installs as usual.

  • Every stage of a fit now whitens with the same factor, the symmetric square root of the posterior covariance taken on the correlation scale. A fit without a gradient no longer depends on the order of the parameters, beyond the tolerance of the mode search: its volume correction, ridge bend and VB fallback used a Cholesky factor, as did the check of the mode and loo(). The VB correction no longer depends on rounding error where the posterior has equal eigenvalues, as with exchangeable random effects, where it moved the VB mean by up to 0.02 posterior SDs. It also stays accurate when the posterior SDs span many orders of magnitude. The marginals change by less than 1e-4 posterior SDs, except on funnels, where the skew-normal is far off anyway. The one-step VB mean changes by up to 0.03 posterior SDs with a gradient and 0.12 without, and the log marginal likelihood by up to 0.02 and 0.18. Against HMC on 52 simulated datasets, both are as accurate as before.

  • A fit with cores no longer warns that future::availableCores() and future::supportsMulticore() are deprecated. The core count and the fork check now come from parallelly, which future imports. parallelly is in Suggests.

  • loo() and waic() have a new argument hessian. With hessian = "diagonal" they take the scores and the trace of each unit’s Hessian only, with 2m + 1 calls of loglik in place of m^2 + m + 1: the first-order LOO less half the effective number of parameters, unit by unit. It is meant for models with many parameters in which every unit is a small part of the data. The default, "full", is unchanged.

  • New rtmb_latent() draws the random effects of an RTMB or TMB object after a fit: sampling(fit, fun = rtmb_latent(obj)) gives the posterior of the latent variables that the object integrates out, from the Gaussian approximation at their mode given each draw of the parameters. The package still calls nothing of RTMB itself. Matrix and RTMB are in Suggests, for the sparse Cholesky factor and for the tests.

  • A new article, “Latent variables”, shows how to draw random effects, class memberships and other latent variables after a fit, with sampling(fit, fun = ): from a closed form, by summing over classes, from a grid, and from an RTMB object with random effects.

  • A parameter named for the scale it is on is now reported on its natural scale. With init = c(mu = 0, log_sigma = 0), print(), summary(), coef() and plot() show sigma, and sampling() returns draws of it. The prefixes are log_ (reported through exp()), logit_ (plogis()) and atanh_ (tanh()), the scales R-INLA itself uses for nearly all of its hyperparameters. The fit does not change: logpost, grad, hess, the loglik of loo() and the fun of sampling() receive the parameter as before, a prior stated on the natural scale still needs its Jacobian in logpost, and the diagnostics keep the names of init. The quantiles are mapped through the transform, and the mean, SD and mode are those of the natural-scale distribution. This changes the output of existing code that uses such names: fit$summary["log_sigma", ] and sampling(fit)[, "log_sigma"] now stop with a subscript error, since the row and the column are called sigma. transform = FALSE in inla_vanilla() restores the old behaviour, and summary(), plot() and sampling() take the same argument to show a fit on the scale of logpost. The new fit$transform lists what was read from the names, and vignette("natural-scale") explains it.

  • A fit now records the version of inlavanilla that made it, in fit$version, and print() and summary() show it in their headers with a v (“INLAvanilla v26.11.23”), so that it does not read as the date of the fit. It is the string in DESCRIPTION, not a package_version, which would drop the leading zeros of a date.

  • When the mode search restarts nlminb() with the parameters rescaled, the iterations reported are now the total over both runs, not those of the run that was kept: in the progress line, in print() and summary(), in diagnostics() and in fit$diagnostics$optim$iterations. The evaluations in the verbose = TRUE report are totals too, and its restart line gives each run’s own iterations. On a badly scaled posterior the fit used to report “1 iteration” after a first run of several hundred.

inlavanilla 0.1.1

  • The mode search now allows 5000 iterations and 5000 evaluations by default, up from 1000 and 2000, so that slowly converging fits do not stop at the limit. control$nlminb still sets them.

  • inla_vanilla() now goes straight to the mode. A supplied grad used to be compared with finite differences of logpost at init, before anything was printed, at about 8m to 12m calls of logpost: 175 calls and 14% of the time on an RTMB model with 21 parameters. It is now compared at the mode, for each parameter and at no cost in calls, from differences the fit takes there anyway. The new grad_gap in diagnostics() holds the result, and the fit-time warning and summary() flag it above 0.1. A gradient of the wrong sign, which stops the fit at the mode, is now named in the error. With a slow logpost, the first progress line appears half a second after the start, or once the first calls are done if they take longer, and moves with every call.

  • With a gradient, the volume correction of the skew-normal marginals now takes 4m + 1 gradient calls for all m parameters together, against 2m + 2 for each parameter, from second differences of the gradient along the principal axes of the covariance. A spatial factor model with 82 parameters, whose 3,078 latent values RTMB integrates out, went from 757 s to 193 s. The differences are central, so the correction is also closer to the exact slope (3e-5 against 2.4e-4 on a test model), and the marginals move by a few ten-thousandths of a posterior SD. Fits without a gradient are unchanged.

  • inla_vanilla() gains cores. With cores = 8 the per-parameter scans of the skew-normal marginals, and the calls of loglik in loo() and waic(), run in parallel through the future package, which is optional, with the results and the progress line of a serial fit. Forked workers are used where they are safe, and separate R sessions elsewhere. A long scan uses all the cores, a shorter one fewer, and one expected to take under a second stays serial. With width = "tk", a fit of 25.5 s took 3.2 s on 12 cores. With the default width the scans are about half of a slow fit, and the same model gained about 1.5 times. Compiled code (Rcpp, TMB, RTMB) cannot be sent to separate sessions, so the fit checks a worker’s value at the mode and otherwise runs serially with a message. By default, cores = NULL, the fit follows future::plan() and is serial if no plan is set. An interactive fit whose scans will take more than 10 s then says once that cores would help.

  • Without a gradient, the ridge_bend check of the skew-normal marginals no longer takes 2(m - 1) calls of logpost for every parameter. The calls of the volume correction already show which way the ridge bends, so the check costs 2 more calls per parameter, and only a value above 0.1 is taken again from the full gradient. Every value that can reach the flag is computed as before, and the marginals do not change. A fit of a logistic regression with 40 parameters without a gradient takes 23% fewer calls and is 1.3 times as fast.

  • The VB mean correction now takes one Newton step by default, vb = "onestep". With a gradient it costs 2m + 1 gradient calls, about one numerical Hessian, against usually four sweeps of up to (m + 1)(m + 2) + 1, and on 133 simulated datasets it was as close to the posterior mean as the full solve, or closer, on all but three. vb = "full" keeps the iterative solve, and vb = "off" (or FALSE) leaves the correction out. TRUE means the default. fit$vb is now the name of the method, and the headers of print() and summary() name it. A first step over 2.5 posterior SDs, or a node that fails, carries on with capped steps, within the calls that the mode and Hessian took. vb_step_sigma is NA after a single step.

  • After a one-step VB correction the fit checks that the step delivered what it promised. vb_gain_ratio in diagnostics() is the rise in the expected log-posterior over the rise the step assumed, at a cost of 4m + 2 calls of logpost. A ratio below 0.5 raises a warning that points to vb = "full", and summary() reports it.

  • coef() gives the posterior mean of each parameter, the Mean column of summary(), as INLAvaan’s coef() does.

  • timing() gives the elapsed time of each stage of the fit, as INLAvaan’s timing() does: timing(fit) the total, timing(fit, what = "all") every stage. fit$timing gains init and diagnostics, the time before the mode and after the marginals, so its segments now add up to total.

  • inla_vanilla() gains width, how each skew-normal scan takes the width term, the log-volume of the other parameters. "trace", the default, is the linear term of INLAvaan, as before. "cmp" takes it exactly along the same straight scan, from the Hessian of the other parameters at each scan point, and "tk" moves the other parameters to their conditional mode at each point and takes the height and the width there, the Laplace marginal of Tierney and Kadane (1986). tk_fallback = TRUE rescans with "tk" only the parameters whose ridge bend is flagged, and fit$fallback and summary() list them. Both cost more calls, given in ?inla_vanilla.

  • inla_vanilla() takes the Hessian of logpost as an optional hess, after grad, as nlminb() does. With it, nlminb() takes Newton steps to the mode, and the Hessian at the mode is the supplied one. RTMB gives it with the gradient, as obj$he. The fit is the same, except that the mode is found more precisely, for a little more time (8% on a model with 39 parameters). The default marginals do not use it, but width = "cmp" and "tk" do. A supplied hess is checked at the mode against central differences of grad, and fit$counts counts its calls.

  • The website article “Gradients with RTMB” is now “Gradients and Hessians with RTMB”. It passes RTMB’s Hessian too, and shows where the fit uses it, what it costs and the more precise mode it finds.

  • The website article “Diagnostic classification models” is now “Cognitive diagnostic models”.

inlavanilla 0.1.0

  • Initial version. inla_vanilla() approximates the posterior of any log-posterior written on an unconstrained scale with the INLAvaan pipeline: a Laplace approximation, a VB mean correction (by a deterministic degree-5 cubature rule), skew-normal marginals with the volume correction, and the log marginal likelihood. sampling() gives Gaussian-copula draws of the parameters or of any function of them. print(), summary() and plot() methods report the fit and its diagnostics.
  • loo() and waic() estimate predictive accuracy from the fit and a pointwise log-likelihood loglik(theta, ...), by the deterministic second-order Taylor approximation of Alhyari et al. (2026): no refits and no draws. The results work with loo::loo_compare(). A new vignette, “Model comparison with LOO and WAIC”, shows how. Both follow the fit’s silent, for the warnings of loglik too, and pass any other object on to the loo package’s functions of the same name.
  • The VB correction (vb) and the skew-normal marginals (marginals = "skewnormal" or "gaussian") can each be switched off, down to the Laplace approximation alone.
  • The VB correction uses a degree-5 rule built on a regular simplex, with at most (m + 1)(m + 2) + 1 nodes, against 2m^2 + 1 before, all within 3 posterior SDs. With a gradient it makes about half the calls at large m, with the same accuracy. Without one, it takes the expected gradient from values of logpost alone, by Stein’s identity on the same nodes, instead of finite-difference gradients: at most (m + 1)(m + 2) calls per sweep instead of (m + 1)(2m^2 + 1), so it costs about as much as finding the mode. For the 39-parameter SEM of the Rcpp article that is 8,200 calls instead of 487,000. This VB mean is exact when the log-posterior is a polynomial of degree four in whitened coordinates (six with a gradient). On test models it was a median 0.015 posterior SDs from exact VB, but up to about 0.1 on strongly skewed posteriors, where a gradient gives about 0.03.
  • Two website articles, “Speeding up with Rcpp” and “Gradients with RTMB”, fit a structural equation model with 39 parameters from a log-posterior written in R, in C++ with an analytic gradient, and in R for RTMB, which gives the gradient by automatic differentiation, and compare the routes for speed and accuracy.
  • A website article, “Multilevel models”, fits a linear mixed model with the random effects integrated out, checks its marginals against brms, and draws the random effects for a caterpillar plot.
  • A website article, “Diagnostic classification models”, fits the DINA model to the ECPE data with the latent classes summed out, checks its marginals against Stan, and classifies examinees from draws.
  • A website article, “Correlation matrices”, puts an LKJ prior on the correlation matrix of a multivariate normal, through its canonical partial correlations on the atanh scale, fits it to the Holzinger and Swineford tests, checks the marginals against Stan, and gives the reliability of each scale from draws.
  • A website article, “Binary factor analysis”, fits a one-factor model for binary items in the delta parameterisation, with the factor integrated out by Gauss-Hermite quadrature over the counts of the response patterns.
  • A website article, “Diagnostic tests without a gold standard”, fits the three latent class models of Koukounari et al. (2021) to five schistosomiasis tests: conditional independence, a person-level random effect integrated out by Gauss-Hermite quadrature, and a finite mixture with always-positive and always-negative groups. It compares their estimates with the published ones, and the models by their log marginal likelihoods.
  • Three output levels: by default each stage prints one line; verbose = TRUE adds a full diagnostic of each stage (the optimiser’s report, how the Hessian was taken, the posterior correlations, the VB iterations, a line per marginal with the flagged values marked, and the calls each stage made); silent = TRUE prints nothing and muffles warnings, for simulations. The default output is what verbose = TRUE used to give, so code that passed verbose = FALSE to keep a fit quiet should now pass silent = TRUE. The warnings raised during a fit are kept in fit$warnings whatever the level.
  • While a stage runs, its line is the stage’s sentence with a counter, as in INLAvaan (“Fitting 4/6 skew-normal marginals”), not a bar as wide as the console. After two seconds it ends with the time so far, or the time left where the work is known in advance (the marginals and loo()), in the place where the finished line shows the time taken. The lines, loo()’s included, follow the cli.progress_show_after option when it is set (half a second otherwise), so a knitr or Quarto setup chunk can keep them out of a rendered document.
  • The diagnostics follow INLAvaan’s. Each parameter has the Newton step at the mode in posterior SDs (mode_shift_sigma), the VB shift on the scale of logpost (vb_shift) and in posterior SDs (vb_shift_sigma), with the Kullback-Leibler divergence of each shifted marginal (kld), and unscanned_mass, the mass each fitted skew-normal puts outside the scanned window; the VB columns are NA when vb = FALSE. The fit also records the condition number of the Hessian in posterior-SD units (hess_cond). summary() and verbose = TRUE show the unscanned mass.
  • A fit whose checks look off ends with one warning, of class inlavanilla_diagnostics_warning, headed “Fit diagnostics flagged N potential issues”, in INLAvaan’s words and at its levels: a Newton step at the mode above 0.1 posterior SDs (whatever nlminb()’s return code, with its message and a hint), an NMAD above 0.1, an unscanned mass above 0.05, a VB shift above 1 SD, and a Hessian condition number above 1e8; heavy tails are inlavanilla’s own check. Like INLAvaan, the fit only records the VB fallback. summary() flags the same checks at the same levels, and also a ridge bend above 0.25 nats, where the marginal SD may be about 10% too small, and a mean gap (between the skew-normal and VB means) above 0.1 SDs; its lines list every flagged parameter, worst first, with its value (names only for the heavy-tails check, which is yes or no). Healthy fits stay silent. A new vignette, “Diagnostics”, explains every check, with citations of Jamil and Rue (2026a).
  • summary() prints the fit first (the log marginal likelihood, and the calls and time each stage took), then the posterior marginals, then the diagnostics, each under its own heading. Its table of diagnostics (VB shift, NMAD, unscanned mass, ridge bend and mean gap) has numbers formatted as a tibble prints them and the flagged values in red. One line gives the largest value of each skew-normal check that passes, and each flagged check has a line of its own.
  • The tables of print() and summary() number their rows, as a tibble does, and line up the decimal points down each column. The posterior marginals still give each parameter to three significant figures of its posterior SD, and a value that rounds to zero no longer prints as “-0.000”.
  • print() and summary() open with the log marginal likelihood and whether the fit converged, with the iterations and the time the fit took. Converged means that the computation reached its solution: no further Newton step at the mode, and no further fixed-point step at the VB mean, would move a parameter by more than 0.1 posterior SDs. The second is a new check, vb_step_sigma in diagnostics(fit, type = "param"): where the fallback optimiser of the VB correction lands was not checked before. A correction that has not settled is flagged and raises a warning.
  • Printed output is never wider than 80 columns, or the console if it is narrower: the summaries, the verbose report and the fit-time warning wrap their long lines. The rendered documentation is 76 columns wide, so that no output scrolls sideways on the website.
  • diagnostics(fit) and diagnostics(fit, type = "param") return the checks as numbers, with the names, order and print formats of INLAvaan’s diagnostics(), followed by inlavanilla’s own. plot(fit, type = "sn_fit") and type = "sn_fit_log" draw each skew-normal fit against the scan it was fitted to, as INLAvaan’s plot does, from the scans the fit now keeps in fit$scan.
  • The check of a user grad also compares it with finite differences one curvature scale from init, so a gradient that is wrong by a constant factor is caught even when init is at the mode.
  • print() names the approximation on its header rule (“Skew-normal + VB”, “Skew-normal”, “Laplace + VB” or “Laplace”), as summary() now does, instead of the run time, which summary() still reports. It ends with a line when the fit raised warnings and one when summary() flags any check, so a fit run with silent = TRUE does not look clean when it is not.
  • summary() reports the 2.5%, 50% and 97.5% quantiles by default, as R-INLA does, instead of adding the quartiles, so its table fits in 80 columns and matches print(). Pass probs for others.
  • print() and summary() wrap long lines to the console width (the width option in R Markdown and Quarto), and split a table too wide for it into blocks of columns, as R does for a matrix.
  • The VB correction no longer stops with “NA/NaN gradient evaluation” when logpost is -Inf at some of its nodes, which reach up to 3 posterior SDs from the mode, as near a boundary of the support. Its fallback optimiser now moves away from those nodes. If it finds a VB mean where logpost is finite at every node, the fit goes ahead. Otherwise, as for a posterior truncated within reach of the nodes, the fit stops with an error that says so and suggests a reparameterisation or vb = FALSE.
  • With a gradient, a VB fallback that lands short of settled is rerun once from where it landed. That happens when the optimiser starts where a node fails, and it then reported convergence well short of the VB mean: 0.29 posterior SDs on a one-parameter posterior with a boundary. Fits whose fallback settles are unchanged, and verbose = TRUE reports the rerun.
  • A VB fixed-point step over 1.5 posterior SDs is now cut to 1.5, and the iteration goes on; only two such steps in a row hand over to the fallback optimiser. INLAvaan hands over at the first step over 1 SD, but on a skewed posterior the first step overshoots and the iteration then comes back. On a DINA model with 63 parameters and a gradient the handover cost 54,000 calls to reach the point that six fixed-point steps reach.