Version: | 1.1.6 |
Date: | 2023-11-10 |
Title: | ADMB for R Using Scripts or GUI |
Author: | Jon T. Schnute [aut], Rowan Haigh [aut, cre], Alex Couture-Beil [aut], Anisa Egeli [ctb] |
Maintainer: | Rowan Haigh <rowan.haigh@dfo-mpo.gc.ca> |
Copyright: | 2008-2023, Fisheries and Oceans Canada |
Depends: | R (≥ 3.5.0), PBSmodelling (≥ 2.68.6) |
Imports: | methods |
Description: | A collection of software provides R support for 'ADMB' (Automatic Differentiation Model Builder) and a 'GUI' interface facilitates the conversion of 'ADMB' template code to 'C code' followed by compilation to a binary executable. Stand-alone functions can also be run by users not interested in clicking a 'GUI'. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://github.com/pbs-software/pbs-admb, https://github.com/pbs-software/pbs-modelling |
NeedsCompilation: | no |
Packaged: | 2023-11-10 17:53:45 UTC; HaighR |
Repository: | CRAN |
Date/Publication: | 2023-11-10 23:23:48 UTC |
PBS ADMB Package
Description
The R package PBSadmb gives complete R support to the external program AD Model Builder, released into the public domain in 2009. The program offers users a remarkably efficient tool for estimating parameters and their uncertainty, based on complex nonlinear statistical models.
In a standard ADMB installation, users would interact with the program via a DOS command shell (in Windows) or a bash shell (in Linux or Mac OS X). The package PBSadmb makes it possible to interact entirely from an R console, as a common interface for all operating systems. A single R script can encapsulate commands to ADMB, as well as all analyses that follow. The package includes protocols for writing code to make the integration between R and ADMB almost seamless.
PBSadmb also provides a Graphical User Interface (GUI) that facilitates the steps required for a complete ADMB analysis. Both new and experienced users can use the GUI for tutorial and educational purposes.
You can obtain PBSadmb from the Comprehensive R Archive Network. Always use the current version of PBSadmb with the most recent version of PBSmodelling, another package available from CRAN.
PBSadmb represents just one of a series of R packages developed at the
Pacific Biological Station
in Nanaimo, British Columbia. A more advanced version of PBSadmb might be
available on GitHub. Any evolving
package (Windows binary and source tarball) is built after using CRAN's rigorous
R CMD check --as-cran
routine (on a 64-bit Windows 10 system) and posted to
Google Drive.
Author(s)
Jon T. Schnute, Scientist Emeritus, Nanaimo BC
Alex Couture-Beil, Software Engineer, Victoria BC
Maintainer:
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2023-11-10
Start the PBSadmb GUI for ADMB
Description
Start up the PBSadmb GUI for controlling and running AD Model Builder.
Usage
admb(prefix="", wdf="admbWin.txt", pathfile="ADpaths.txt")
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
wdf |
string name of the window description file that creates the GUI. |
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
The pathfile
has now replaced the optfile
, which no longer
exists as an argument. The pathfile
identifies valid paths, which are
passed to the options manager.
Additionally, the user can change whichever path settings s/he wishes in the GUI.
The package still recognizes the file ADopts.txt
, which has been
demoted to a back-up file that will be saved only when the user pushes the
Save button on the first tab in the GUI.
If ADopts.txt
exists and the options file .PBSadmb
is not
available (i.e. NULL
), then ADopts.txt
will be used on start up
to populate the GUI.
Warning
Do not call your pathfile="ADopts.txt"
unless you want to tempt fate.
Note
On UNIX systems the MinGW compiler and UNIX tools are readily available;
therefore, only the admbpath
(path to ADMB's home directory)
and the path to a text editor are needed.
Author(s)
Jon T. Schnute, Scientist Emeritus, Nanaimo BC
Alex Couture-Beil, Software Engineer, Victoria BC
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2018-09-28
See Also
setADpath
, readADopts
,
readADpaths
, makeAD
Append Data to Log File
Description
Append summary information or output to a previously created log file.
Usage
appendLog(prefix, lines)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
lines |
data to append to |
Value
No explicit value reurned. Appends data into a log file
'prefix'.log
.
Note
A wrapper function that can be called from a GUI exists as .win.appendLog
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2009-09-10
See Also
Get/Put Objects From/To Temporary Work Environment
Description
These functions are wrappers to the PBSmodelling accessor functions that
get/print objects from or put objects into a temporary work environment,
in this case .PBSadmbEnv
. Working objects include PBSadmb
,
which acts as a storage object for some of the functions, and .PBSadmb
,
which controls the options for the user's project.
Usage
atget(...)
atcall(...)
atprint(...)
atput(...)
alisp(...)
Arguments
... |
For For |
Details
These accessor functions were developed as a response to the CRAN repository policy statement: “Packages should not modify the global environment (user's workspace).”
Value
Objects are retrieved from or sent to the temporary working
environment to/from the place where the function(s) are called.
Additionally, atcall
invisibly returns the object without
transferring, which is useful when the object is a function that the
user may wish to call, for example, atcall(myfunc)()
, or as
arguments in other functions.
Note
Additional wrapper functions to access functions in .PBSadmbEnv
are named with the prefix .win
(none at the moment).
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2023-11-10
References
See Also
In package PBSmodelling:
tget
, and
lisp
Check ADMB Options for Path Integrity
Description
Check that the options object .PBSadmb
has all required components
and that paths point to actual files on the hard drive.
Usage
checkADopts(opts=getOptions(atcall(.PBSadmb)),
check=c("admbpath","gccpath","msysbin","editor"),
warn=TRUE, popup=FALSE, verify=TRUE)
Arguments
opts |
|
check |
|
warn |
|
popup |
|
verify |
|
Value
Boolean value where TRUE
indicates all programs were located in the
specified directories and FALSE
if at least one program cannot be found.
The returned Boolean scalar has two attributes:
warn
– named list of test results, and
message
– named vector of test results.
Note
A wrapper function that can be called from a GUI exists as .win.checkADopts
.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2018-10-03
See Also
Clean ADMB-Generated Files from the Working Directory
Description
Detects files in the working directory with the specified prefix
and
removes them all save those with the suffix .tpl
, .dat
, and .pin
.
Usage
cleanAD(prefix)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
Details
Aside from potential garbage files with the specified prefix
, other
files associated with ADMB are detected. Also files *.tmp
and *.bak
are displayed. Calling cleanAD
invokes the hidden function .cleanUp
,
which creates a GUI menu of the potential garbage files. The user can select whichever
files s/he wishes for disposal.
Value
Returns nothing. Invokes a GUI menu of potential garbage files.
Note
A wrapper function that can be called from a GUI exists as .win.cleanAD
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2009-09-10
See Also
Compile C Code
Description
Compile C++ code in 'prefix'.cpp
to create a binary object
file 'prefix'.o
.
Usage
compAD(prefix, raneff=FALSE, safe=TRUE, dll=FALSE, debug=FALSE,
logfile=TRUE, add=TRUE, verbose=TRUE, pathfile=NULL)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
raneff |
logical: use the random effects model, otherwise use the normal model (currently does not influence the compile stage, but the argument is preserved here for future development). |
safe |
logical: if |
dll |
create dll (rather than executable) |
debug |
compile with debug symbols |
logfile |
logical: if |
add |
logical: if |
verbose |
logical: if |
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
This function uses the C++ comiler declared in .PBSadmb
. If logfile=TRUE
,
any errors will appear in 'prefix'.log
. If verbose=TRUE
,
they will appear in the R console.
Value
Invisibly returns the shell call and its messages.
Note
A wrapper function that can be called from a GUI exists as .win.compAD
.
The optional pathfile
is offered for use in command (non-GUI) functions.
Users can easily create this file in a text editor.
Note that on UNIX systems, only the admbpath
(actually the path to ADMB's home directory)
and text editor are used because the MinGW compiler (gccpath
) and UNIX tools are already recognised.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2015-01-27
See Also
convAD
, linkAD
,
makeAD
, readADpaths
Convert TPL Code to CPP Code
Description
Convert code in 'prefix'.tpl
to C++ code in 'prefix'.cpp
.
Usage
convAD(prefix, raneff=FALSE, safe=TRUE, dll=FALSE, debug=FALSE,
logfile=TRUE, add=TRUE, verbose=TRUE, pathfile=NULL)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
raneff |
logical: if |
safe |
logical: if |
dll |
create dll (rather than executable) |
debug |
compile with debug symbols |
logfile |
logical: if |
add |
logical: if |
verbose |
logical: if |
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
This function invokes the ADMB command tpl2cpp.exe
or tpl2rem.exe
,
if raneff
is FALSE
or TRUE
respectively. If logfile=TRUE
,
any errors will appear in 'prefix'.log
. If verbose=TRUE
,
they will appear in R console.
Value
Invisibly returns the shell call and its messages.
Note
A wrapper function that can be called from a GUI exists as .win.convAD
.
The optional pathfile
is offered for use in command (non-GUI) functions.
Users can easily create this file in a text editor.
Note that on UNIX systems, only the admbpath
(actually the path to ADMB's home directory)
and text editor are used because the MinGW compiler (gccpath
) and UNIX tools are already recognised.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2014-02-27
See Also
compAD
, linkAD
,
makeAD
, readADpaths
Convert Text Files to Default OS Format
Description
Convert text files to the default format of the operating system.
Usage
convOS(inam, onam = inam, path = getwd() )
Arguments
inam |
string vector of names specifying files to be converted to the format of the operating system. |
onam |
string vector of name specifying the output files (the default overwrites the input file). |
path |
string specifying the path where the input files are located (defaults to current working directory). |
Value
Text file(s) formatted in accordance with standards of the operating system.
Note
This function essentially executes a readLines
command followed by a call to writeLines
.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2009-12-04
See Also
copyFiles
, .addQuotes
Copy System Files
Description
Copy files with specified prefixes and suffixes from one location to another.
Usage
copyFiles(prefix, suffix=NULL, srcdir=getwd(), dstdir=getwd(), ask=TRUE)
Arguments
prefix |
string scalar/vector of potential file prefixes. |
suffix |
string scalar/vector of potential file suffixes. |
srcdir |
source directory from which to copy files. |
dstdir |
destination directory to copy files to. |
ask |
logical: if |
Details
This function uses R's list.files
and file.copy
functions.
The pattern recognition tends not to work when given the wildcard character
*
; however, the user may use this character, and the code will interpret it.
Value
Invisibly returns a Boolean vector with names of files that have been copied or not.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2011-02-14
See Also
PBSadmb Environment
Description
An environment set aside for PBSadmb.
Usage
.PBSadmbEnv
Format
A new environment with a .GlobalEnv
parent.
Details
The environment is created in 'zzz.r'
and is used by
PBSadmb
functions 'alisp'
, 'atget'
,
'atput'
, 'atprint'
, and 'atcall'
.
Source
Generated by a call to the base function new.env()
.
See Also
In PBSadmb:
alisp
,
atget
In PBSmodelling:
lisp
,
tget
GUI Windows Wrappers
Description
Wrapper functions to run existing or temporary functions from a GUI's function call.
Usage
.win.appendLog(winName="PBSadmb")
.win.checkADopts(winName="PBSadmb")
.win.checkADpath(winName="PBSadmb")
.win.checkPrefix(winName="PBSadmb")
.win.cleanAD(winName="PBSadmb")
.win.compAD(winName="PBSadmb")
.win.convAD(winName="PBSadmb")
.win.editAD(winName="PBSadmb")
.win.editPLT()
.win.findClean(winName="cleanWindow")
.win.findTPL(suffix=".tpl",winName="PBSadmb")
.win.linkAD(winName="PBSadmb")
.win.makeAD(winName="PBSadmb")
.win.plotMC(winName="PBSadmb")
.win.readADopts(winName="PBSadmb")
.win.readADpaths(winName="PBSadmb")
.win.readRep(winName="PBSadmb")
.win.run(winName="PBSadmb")
.win.runAD(winName="PBSadmb")
.win.runMC(winName="PBSadmb")
.win.saveADpaths(winName="PBSadmb")
.win.setADpath(winName="PBSadmb")
.win.setADver(winName="PBSadmb")
.win.showADargs(winName="PBSadmb")
.win.showGUIargs(winName="PBSadmb")
.win.startLog(winName="PBSadmb")
.win.suggestPath(winName="PBSadmb")
.win.viewCode(pkg="PBSadmb")
.win.viewRep(winName="PBSadmb")
.win.writeADopts(winName="PBSadmb")
Arguments
winName |
|
suffix |
|
pkg |
|
Details
PBSmodelling Windows (Graphical User Interfaces or GUIs) call wrapper functions that call non-GUI functions in the package.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2023-11-09
See Also
In PBSadmb:
appendLog
,
checkADopts
,
cleanAD
,
compAD
,
convAD
,
editAD
,
linkAD
,
makeAD
,
plotMC
,
readADopts
,
readADpaths
,
readRep
,
runAD
,
runMC
,
saveADpaths
,
setADpath
,
setADver
,
showADargs
,
startLog
,
suggestPath
,
writeADopts
In PBSmodelling:
getWinAct
,
getWinVal
,
tget
Edit ADMB Files
Description
Edit files associated with specified prefix and suffixes.
Usage
editAD(prefix, suffix=c(".tpl",".cpp",".log"))
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
suffix |
string scalar/vector specifying one or more suffixes. |
Value
Invisibly returns Boolean vector with elements TRUE
if files exist,
FALSE
if they do not.
Note
A wrapper function that can be called from a GUI exists as .win.editAD
.
This function explicitly uses the editor chosen for PBSadmb. PBSmodelling
has another function openFile
that uses Windows file associations
or an application specified with setPBSext
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2018-09-28
See Also
Edit an ADMB File
Description
Edit an ADMB file using the text editor specified in .PBSadmb
.
Usage
editADfile(fname)
Arguments
fname |
string name of file in current working directory
(or elsewhere if path delimited by |
Value
Returns Boolean: TRUE
if file exists, FALSE
if it does not.
Note
This function explicitly uses the editor chosen for PBSadmb.
PBSmodelling has another function openFile
that uses Windows
file associations or an application specified with setPBSext
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2018-09-28
See Also
Link Object Files to Make an Executable
Description
Links the binary object file 'prefix'.o
to the ADMB libraries and
produces the executable file 'prefix'.exe
.
Usage
linkAD(prefix, raneff=FALSE, safe=TRUE, dll=FALSE, debug=FALSE,
logfile=TRUE, add=TRUE, verbose=TRUE, pathfile=NULL)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
raneff |
logical: use the random effects model, otherwise use the normal model. |
safe |
logical: if |
dll |
create dll (rather than executable) |
debug |
compile with debug symbols |
logfile |
logical: if |
add |
logical: if |
verbose |
logical: if |
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
This function uses the C++ comiler declared in .PBSadmb
. If logfile=TRUE
,
any errors will appear in 'prefix'.log
. If verbose=TRUE
,
they will appear in the R console.
Value
Invisibly returns the shell call and its messages.
Note
A wrapper function that can be called from a GUI exists as .win.linkAD
.
The optional pathfile
is offered for use in command (non-GUI) functions.
Users can easily create this file in a text editor.
Note that on UNIX systems, only the admbpath
(actually the path to ADMB's home directory)
and text editor are used because the MinGW compiler (gccpath
) and UNIX tools are already recognised.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2015-01-27
See Also
convAD
, compAD
,
makeAD
, readADpaths
Make an Executable Binary File from a C File
Description
Essentially a wrapper function that calls in sequence: convAD
,
compAD
, and linkAD
.
Usage
makeAD(prefix, raneff=FALSE, safe=TRUE, dll=FALSE, debug=FALSE,
logfile=TRUE, add=TRUE, verbose=TRUE, pathfile=NULL)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
raneff |
logical: use the random effects model, otherwise use the normal model. |
safe |
logical: if |
dll |
create dll (rather than executable) |
debug |
compile with debug symbols |
logfile |
logical: if |
add |
logical: if |
verbose |
logical: if |
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
This function uses the C++ comiler declared in .PBSadmb
. If logfile=TRUE
,
any errors will appear in 'prefix'.log
. If verbose=TRUE
,
they will appear in the R console.
Value
Returns nothing. The three functions called by makeAD
each
return the shell call and its messages.
Note
A wrapper function that can be called from a GUI exists as .win.makeAD
.
The optional pathfile
is offered for use in command (non-GUI) functions.
Users can easily create this file in a text editor.
Note that on UNIX systems, only the admbpath
(actually the path to ADMB's home directory)
and text editor are used because the MinGW compiler (gccpath
) and UNIX tools are already recognised.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2015-01-27
See Also
convAD
, compAD
,
linkAD
, runAD
,
readADpaths
Plot Results of MCMC Simulation
Description
Plot results of an ADMB MCMC simulation using various plot methods.
Usage
plotMC(prefix, act="pairs", pthin=1, useCols=NULL)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
act |
string scalar: action describing plot type (current choices:
|
pthin |
numeric scalar indicating interval at which to collect records
from the |
useCols |
logical vector indicating which columns of |
Note
A wrapper function that can be called from a GUI exists as .win.plotMC
.
Use the PBSadmb GUI to explore these plots easily.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2009-09-10
See Also
Read an ADMB Options List into Memory From a File
Description
Create a PBSoptions
class object called .PBSadmb
(stored in the
package's working environment PBSadmbEnv
) and read in ADMB options
from an ASCII text file using a load
function that ultimately calls
PBSmodelling::readList
.
Usage
readADopts(optfile="ADopts.txt")
Arguments
optfile |
string name of an ASCII text file containing ADMB options information. |
Value
No values returned. Reads the ADMB options into the list object .PBSadmb
.
Note
A wrapper function that can be called from a GUI exists as
.win.readADopts
(not currently used).
Author(s)
Alex Couture-Beil, Software Engineer, Victoria BC
Simon Fraser University (Burnaby BC), Vancouver Island University (Nanaimo BC)
Last modified Rd: 2019-03-14
See Also
In package PBSadmb:
setADpath
,
readADpaths
,
writeADopts
In package PBSmodelling:
loadOptions
Read ADMB Paths From a Text File
Description
Read or save ADMB paths (admbpath
, gccpath
, msysbin
, editor
) from
or to a simple, 2-column text file where the first column gives the R variable
name and the second column specifies the path (enclosed by double quotation marks “”).
Usage
readADpaths(pathfile)
saveADpaths(pathfile)
Arguments
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
The simplest way to pass valid paths to the options manager in PBSadmb is to supply a text file in the working directory. This file can be constructed easily using any text editor. An example might look like:
admbpath "C:/admb" gccpath "C:/mingw" msysbin "C:/mingw/msys/bin" editor "C:/Windows/System32/notepad.exe"
Note
On UNIX systems the MinGW compiler and UNIX tools are readily available;
therefore, only the admbpath
(path to ADMB's home directory)
and the path to a text editor are needed.
The user can supply any number of paths in a pathfile
, which are passed to
the options manager; however, only the above four paths are used at present.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2018-09-28
See Also
readADopts
,
convAD
, compAD
,
linkAD
, makeAD
Read an ADMB Report into R Memory
Description
Import ADMB-generated report files into R's memory using the names of the report files to name the R-objects.
Usage
readRep(prefix, suffix=c(".cor",".rep",".std",".mc.dat"), global=FALSE)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
suffix |
string scalar/vector specifying one or more suffixes. |
global |
logical: if |
Details
If the report object is one of c(".cor", ".std", ".mc.dat")
, the
report object is a data frame, otherwise it is a string vector. Multiple
report objects are returned as a list of objects. A single report object is
returned as the object itself.
This function attempts to detect the file format from a number of possibilities.
For example, if the file has the special format recognized by PBSmodelling,
then the function returns a list with named components. The example vonb
included with this package shows how to write the template to get consistent
variable names between ADMB and R. See the User's Guide for complete details.
Value
Invisibly returns the list of report objects. If only one report is imported, a single report object is returned.
Note
A wrapper function that can be called from a GUI exists as .win.readRep
.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2009-09-10
See Also
editADfile
, .win.viewRep
Run an Executable Binary File
Description
Run the executable binary file 'prefix'.exe
that was created by
makeAD
.
Usage
runAD(prefix, argvec="", logfile=TRUE, add=TRUE, verbose=TRUE)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
argvec |
string scalar/vector of arguments appropriate for the executable
|
logfile |
logical: if |
add |
logical: if |
verbose |
logical: if |
Details
This function typically reads the two files 'prefix'.dat
and 'prefix'.pin
,
although in same cases one or both of these files may not be necessary.
If logfile=TRUE
, output (including error messages, if any) will appear in
'prefix'.log
. If verbose=TRUE
, it will appear in the R console.
Value
Invisibly returns the results of the shell call.
Note
A wrapper function that can be called from a GUI exists as .win.runAD
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2009-09-10
See Also
Run an Executable Binary File in MCMC Mode
Description
Run the executable binary file 'prefix'.exe
, created by
makeAD
, to generate MCMC simulations.
Usage
runMC(prefix, nsims=2000, nthin=20, outsuff=".mc.dat",
logfile=FALSE, add=TRUE, verbose=TRUE)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
nsims |
numeric scalar indicating number of MCMC simulations to perform. |
nthin |
numeric scalar indicating the sampling rate or thinning of the
|
outsuff |
string name suffix of the MCMC output data file. |
logfile |
logical: if |
add |
logical: if |
verbose |
logical: if |
Details
This function runs 'prefix'.exe
twice, first with the arguments
-mcmc 'nsims' -mcsave 'nthin'
and second with the argument -mceval
.
By default, output goes to the file 'prefix'.mc.dat
, although a user can
specify a different output suffix.
To see this function in action, use the PBSadmb GUI with the example vonb
or
simpleMC
.
Value
Invisibly returns the results of the shell call.
Note
A wrapper function that can be called from a GUI exists as .win.runMC
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2009-09-10
See Also
Create ADMB Options List
Description
Creates an options list object detailing the pathways to the ADMB home directory, the GCC home directory, the MSYS (Unix utilities) bin directoy, and the user's preferred text editor. Also keeps track of software versions for ADMB and GCC.
Usage
setADpath(admbpath, gccpath, msysbin, editor)
setADver(admbver, gccver)
Arguments
admbpath |
|
gccpath |
|
msysbin |
|
editor |
|
admbver |
|
gccver |
|
Value
Creates a global, hidden list object called .PBSadmb
,
located in the temporary environment .PBSadmbEnv
.
Use the functions atget
, atput
, atcall
, and
atprint
to get, put, call, and print the object .PBSadmb
.
The function alisp
lists all the objects in the .PBSadmbEnv
environment.
Note
These functions replace makeADopts
. The old control file called
ADopts.txt
is retained as a backup file system, which is accessed on
R session start-up and first call to the function admb
to initialize
the contents of the options manager .PBSadmb
and the GUI. However, if a
path file (e.g., ADpaths.txt
) exists, the paths in this file will
override those taken from ADopts.txt
.
Additionally, the ‘Verify’ button always consults the admb version file (if it exists) and the g++ executable to collect version information. If not available, version information is set to an empty string.
Author(s)
Alex Couture-Beil, Software Engineer, Victoria BC
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2018-09-28
See Also
Set Up Paths for PBSadmb
Description
Set up path information by reading from a pathfile
(default = ADpaths.txt
) and checking that certain executable
files exist.
Usage
setupAD(pathfile)
Arguments
pathfile |
string name of 2-column text file that details the
relevant paths for the R variables |
Details
This program is useful primarily for console-based function calls.
It sets up the background options for PBSadmb functions (convAD
,
compAD
, linkAD
) by reading paths from a file and checking
to make sure that they are valid (i.e., contain certain exectuable files like
tpl2cpp
and g++
). The options are store in a PBSoptions class
objects called .PBSadmb
in the temporary environment .PBSadmbEnv
.
Note
To access the options manager in the temporary working environment, use the PBSadmb
accessor functions (atget
, atput
, atcall
, atprint
). For eample:
atprint(.PBSadmb)
On UNIX systems the MinGW compiler and UNIX tools are readily available;
therefore, only the admbpath
(path to ADMB's home directory)
and the path to a text editor are needed.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2014-02-27
See Also
readADpaths
, checkADopts
,
makeAD
Show All Arguments for an ADMB Executable
Description
Show all arguments available for an ADMB executable in the default text editor.
Usage
showADargs(prefix, ed=TRUE)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
ed |
logical: if |
Value
Invisibly returns the argument list.
Note
A wrapper function that can be called from a GUI exists as .win.showADargs
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2009-09-10
See Also
Start a Log File
Description
Start a log file by removing any previous version and appending header information.
Usage
startLog(prefix)
Arguments
prefix |
string name prefix of the ADMB project (e.g., |
Value
No explicit value reurned. Writes header lines into a log file
'prefix'.log
.
Note
A wrapper function that can be called from a GUI exists as .win.startLog
.
Author(s)
Jon T. Schnute, Scientist Emeritus
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
Last modified Rd: 2009-09-10
See Also
Suggest a Path to a Specified Program
Description
Suggest a directory path from the system PATH
where a
program specified by the user might be located.
Usage
suggestPath(progs, ipath = NULL, file_ext = NULL)
Arguments
progs |
string vector of program names without the extension (assumes |
ipath |
string specified by the user as the initial path (directory) to check before checking all other directories on the |
file_ext |
user can specify an alternative extension if the program does not end in |
.
Details
This function determines whether the specified programs can be located on the user's system.
A wrapper function called .win.suggestPath
is used by the PBSadmb GUI to suggest
paths for the ADMB home, the Windows MinGW home, and an editor.
Value
Returns a logical vector where each element corresponds to a program searched.
If the element is TRUE
, then the program was found on the path,
which is supplied as the name of the vector element.
If the element is FALSE
, the program may exist on the user's system,
but is not in any of the directories specified by the PATH
environment of the system.
The returned vector has a list attribute where each item in the list corresponds to each element in the vector, and shows the results of the search for each of the directories.
Author(s)
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Offsite, Vancouver BC
Last modified Rd: 2023-11-09
See Also
Writes the ADMB Options List from Memory to a File
Description
Writes the global ADMB options list to a file using the function
PBSmodelling::saveOptions
.
Usage
writeADopts(optfile="ADopts.txt")
Arguments
optfile |
|
Value
Returns opts
invisibly. Writes the options list object to an ASCII file.
Note
A wrapper function that can be called from a GUI exists as
.win.writeADopts
(not currently used).
Author(s)
Alex Couture-Beil, Software Engineer, Victoria BC
Simon Fraser University (Burnaby BC), Vancouver Island University (Nanaimo BC)
Last modified Rd: 2019-03-14
See Also
In package PBSadmb:
atget
,
readADopts
,
setADpath
In package PBSmodelling:
getOptions
,
setOptions
in getOptions
,
saveOptions
in loadOptions