Propose a new discrete value.

Share:

Description

This function proposes a new discrete parameter, based on the previous value, within the given proposal range, making sure that the maximum range is not exceeded.

Usage

1
ProposeDiscrete(params.old, proposal.range, max.range)

Arguments

params.old

Old parameter value (an integer).

proposal.range

Range for new proposal (an integer).

max.range

Maximum value for new proposal (an integer).

Value

Returns the new proposed parameter, which will be an integer in the range [0, max.range], and within at most proposal.range of params.old.

Author(s)

Frank Dondelinger

See Also

proposeContinuous

Examples

1
2
3
4
5
# Previous parameter value
param = rpois(1, 5)

# Propose new value within range [0, 10], with proposal width 2
new.param = ProposeDiscrete(param, 2, 10)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.