mp_options: Create or update an options objects

Description Usage Arguments Details Value See Also Examples

View source: R/environment.R

Description

Create a new options object, or merge information from several objects.

The _get, _set, and _reset functions operate on a global package options override object. In many cases, setting options in specific calls to multiprobit() is recommended instead.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

Arguments

...

Named options, optionally started by one or more mp_options objects. Options specified later override the previous options.

x

An object to be converted to an mp_options object.

options

An mp_options object to be checked

name

Either NULL, or single option name string, or a list of option namescharacter vector or list with option names, Default: NULL

include_default

logical; If TRUE, the default options are included together with the global override options. Default: FALSE

Details

For mp_options and mp_options_set, recognised options are:

verbose

logical or numeric; if TRUE, log messages of verbosity ≤q 1 are printed by mp_log_message(). If numeric, log messages of verbosity ≤q are printed. Default FALSE

verbose_stored

logical or numeric; if TRUE, log messages of verbosity ≤q 1 are stored by mp_log_message(). If numeric, log messages of verbosity ≤q are stored. Default: 1

gaussint

List of options for excursions::gaussint. Specific relevant options:

num.threads

The maximum number of allowed threads for parallel computing by excursions::gaussint, Default: 0, meaning no limit.

seed

The seed for the internal random number generator for excursions::gaussint.

optim

List of options for optim(). Relevant options are method for choosing the optimisation method, and control for setting convergence criteria and verbose optim() output.

strategy

The estimation optimisation strategy. Options: "alternating", "joint", "stepwise". Default: "stepwise"

max_iter

The maximum number of steps for strategy == "alternating"

hessian

The hessian computation style. Options: "none", "diagonal", "block", and "full". Default: "full"

x_name_prefix

The name prefix to use for covariate names if the model matrix doesn't have column names. Default: "x_name_"

y_name_prefix

The name prefix to use for covariate names if the response matrix doesn't have column names. Default: "y_name_"

mp_options_check checks for valid contents of an mp_options object

mp_options_check() produces warnings for invalid options.

mp_options_set() is used to set global package options.

mp_options_reset() clears the global opption overrides.

Value

mp_options() returns an mp_options object.

For as.mp_options(), NULL or no input returns an empty mp_options object, a list is converted via mp_options(...), and mp_options input is passed through. Other types of input generates an error.

mp_options_default() returns an mp_options object containing default options.

mp_options_check() returns a logical; TRUE if the object contains valid options for use by other functions

mp_options_get returns either an mp_options object, for name == NULL, the contents of single option, if name is a options name string, or a named list of option contents, if name is a list of option name strings.

mp_options_set() returns a copy of the global options, invisibly.

See Also

mp_options(), mp_options_default(), mp_options_get()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## Not run: 
if (interactive()) {
  # Compine global and user options:
  options1 <- mp_options(mp_options_get(), hessian = "block")
  # Create a proto-options object in two equivalent ways:
  options2 <- as.mp_options(hessian = "diagonal")
  options2 <- as.mp_options(list(hessian = "diagonal"))
  # Combine options objects:
  options3 <- mp_options(options1, options2)
}

## End(Not run)
## Not run: 
if (interactive()) {
  # EXAMPLE1
}

## End(Not run)
## Not run: 
if (interactive()) {
  mp_options_check(mp_options(invalid = "something"))
}

## End(Not run)
## Not run: 
if (interactive()) {
  # EXAMPLE1
}

## End(Not run)
## Not run: 
if (interactive()) {
  mp_options_set(
    gaussint = list(max.threads = 1),
    optim = list(control = list(trace = 5))
  )
}

## End(Not run)

finnlindgren/multiprobit documentation built on June 20, 2020, 6:12 a.m.