Reports, for each equation of a fitted object, the version of bayesnec that fitted it, where that installation came from, and the commit it was built from where the installation records one.

bnec_version(x)

Arguments

x

An object returned by bnec, bnec_hurdle, bnec_group or bnec_joint.

Value

A data.frame with one row per equation and the columns model, the equation; bayesnec, the version; source; commit; ref; repo; R, the version of R; brms, the version of brms; and backend, the Stan interface and its version. Every column is character. A bayesnechurdlefit adds a first column component, naming the growth or survival component, and a bayesnecgroupfit a first column level. A bayesnecjointfit is one model, with one record, reported once per level beside the equation fitted at that level.

Details

A fit's estimates depend on the code that produced it as well as on the data. The version number does not identify that code on its own: it is raised by hand at intervals, so builds from many commits report the same number. The commit names one state of the code, and the version identifies a CRAN release, which records no commit.

The record is read from the DESCRIPTION of the installed package, utils::packageDescription("bayesnec"), when the equation is fitted, and stored as an attribute of the fitted object.

source is "local" where the package was loaded from a source directory by devtools::load_all(), which leaves no Built field, or installed from one by R CMD INSTALL, devtools::install() or remotes::install_local(), which leave no Repository field and no RemoteType other than "local". Otherwise source is the RemoteType that remotes or pak wrote, such as "github". Where there is no RemoteType, or it is "standard" or "cran", which pak writes for a package from a repository, source is the Repository field: "CRAN", or the address of an R-universe repository.

commit is RemoteSha, which remotes and pak write for an installation from GitHub and R-universe writes for its builds. It is read only where it is a git object name of 7 to 40 hexadecimal characters, because pak writes the version number there for a package from a repository. commit is NA for a local installation, whose installed files do not record the commit of the source directory, and for a CRAN installation. ref and repo name the branch or tag and the repository the commit was installed from, and are NA where commit is.

Each equation keeps its own record. bnec gives every equation it fits the record of the installation running it, and update does the same for every equation it refits. amend keeps the record of each equation it retains and gives the equations it adds the current one. c, + and pull_out keep each equation's own record, so a set combined from fits made by different installations lists each, and c(), + and amend() say so in a message. summary prints the record, as one line where every equation shares it and one line per equation where they differ. A bayesnechurdlefit and a bayesnecgroupfit hold fits made by bnec, and report the record of each.

Under a parallel plan, each equation records the installation and R version of the worker that fitted it, which can differ from the calling session.

An object fitted by a version of bayesnec that did not record the installation, including the example fits shipped with the package such as manec_example, reports source "unknown" and NA for the other recorded columns. The brms and backend columns are read from the brmsfit of each equation, where brms stores them, so they are reported for such an object too.

See also

Examples

library(bayesnec)
data(manec_example)
# Fitted before the installation was recorded.
bnec_version(manec_example)
#>       model bayesnec source commit  ref repo     R   brms      backend
#> 1 nec4param    3.0.0  local   <NA> <NA> <NA> 4.6.1 2.23.0 rstan 2.32.7
#> 2 ecx4param    3.0.0  local   <NA> <NA> <NA> 4.6.1 2.23.0 rstan 2.32.7