parameter: gpe parameter class

Description Usage Arguments Details Examples

Description

Functions to create and interact with parameter objects

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
unit(value = 0.5)

pos(value = 1)

unc(value = 0)

is.parameter(x)

## S3 method for class 'parameter'
update(object, new_value, continuous = FALSE, ...)

## S3 method for class 'parameter'
print(x, ...)

Arguments

value

the value of the parameter, on its true scale.

x

a parameter object, or an object to be tested as one.

object

a parameter object, or an object to be tested as one.

new_value

a new value to assign to the parameter, given either on the true scale, or on the scale of its continuous transform, depending on continuous.

continuous

whether to return (or update) with the true value of the parameter or with the value of its continuous transform.

...

further arguments passed to or from other methods.

Details

The constructor functions (pos, unit and unc) return parameter objects with a set value. These objects contain member functions to test whether other values are within the constraints of the parameter and to convert between the true value and a continuous transformation of it.

unit creates a parameter constrained to be on the unit interval (greater than 0 and less than 1). pos creates a parameter constrained to be positive. unc creates an unconstrained (continuously supported) parameter.

The value (either the true value or a continuous transformation) of the parameter can be returned by executing the object. The value can be changed using the update method. is.parameter returns a logical indicating whether the object is a gpe parameter object. print returns a very simple summary of the parameter, its transformations and its support.

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
40
41
42
43
44
45
46
47
48
49
50
51
# create a parameter on the unit interval
# with initial value of 0.9
p <- unit(0.9)

# return value (on true scale)
p()

# return value on continuous scale
p(continuous = TRUE)


# create a strictly positive parameter
# with initial value of 2.5
sigma <- pos(2.5)

# return value (on true scale)
sigma()

# return value on continuous scale
sigma(continuous = TRUE)
  

# create an unconstrained (continuous support) parameter
# with initial value of -3
x <- unc(-3)

# return value (on true scale)
x()

# return value on continuous scale
x(continuous = TRUE)


# are these parameters? 
is.parameter(p)
is.parameter(sigma)
 

# update on the true scale
p <- update(p, 0.6)
p()

# update on the continuous scale
p <- update(p, -1, continuous = TRUE)
p()


# print summaries of these parameters and their member functions
p
sigma
x

goldingn/gpe documentation built on May 17, 2019, 7:41 a.m.