R2admb (version 0.7.16.3)

read_pars: Read in parameters from an AD Model Builder run

Description

Reads coefficients, standard errors, log-likelihoods, maximum gradients, correlation and variance-covariance matrices from AD Model Builder output files

Usage

read_pars(fn, drop_phase = TRUE, covfn = "admodel.cov",
  warn_nonstd_rep = TRUE)

read_psv(fn, names = NULL)

read_rep(fn, names = NULL, warn_nonstd_rep = TRUE)

Value

List containing the following elements

  • coefficientsparameter estimates

  • coeflistparameter estimates in list format, with proper shape (vectors, matrices, etc.)

  • seestimated standard errors of coefficients

  • logliklog-likelihood

  • maxgradmaximum gradient of log-likelihood surface

  • corcorrelation matrix

  • vcovvariance-covariance matrix

  • nparnumber of parameters

  • heshessian matrix (only if no vcov matrix)

  • reportvalues from report file (if non-standard report file)

Arguments

fn

(character) Base name of AD Model Builder

drop_phase

(logical) drop negative-phase (fixed) parameters from results?

covfn

(character) file name for covariance matrix information

warn_nonstd_rep

warn if report file is in nonstandard format?

names

(character) Names of variables

Warnings

  • The coeflist component is untested for data structures more complicated than scalars, vectors or matrices (i.e. higher-dimensional or ragged arrays)

  • Because ADMB hard-codes the file name for covariance matrix information (admodel.cov), care is necessary when running different models in the same directory; users may want to rename this file by hand and use the covfn argument

Details

Given the output from an ADMB run on FOO.tpl, read_pars reads the files FOO.par (parameters, log-likelihood, max gradient); FOO.std (standard deviations); FOO.cor (correlations); FOO.rep (report variables); admodel.hes for hessian; and admodel.cov for covariance matrix. read_psv reads the output of MCMC runs.

  • read_rep (called by read_admb to read the .rep file) first checks if the report file is in a standard format: first line starts with a comment character (#); thereafter, each block starts with a single commented line containing the name of the parameter (possibly ending with a colon), followed by a block of all-numeric lines, which are read as a single vector. If the report file is in a standard format, the values are added to the end of the coefficients list. Otherwise, the numeric values from the report file are included in the results as a single, concantenated numeric vector.

See Also

write_pin, write_dat