Create object to adapt proposal shape.
Arguments
- type
Type of shape adapter to use. One of:
"variance": Diagonal shape matrix adaptation based on estimates of target distribution variances (see
variance_shape_adapter()
),"covariance": Dense shape matrix adaptation based on estimates of target distribution covariance matrix (see
covariance_shape_adapter()
).
- kappa
Decay rate exponent in
[0.5, 1]
for adaptation learning rate. Value of 1 (default) corresponds to computing empirical (co)variances.
Value
List of functions with entries
initialize
, a function for initializing adapter state and proposal parameters at beginning of chain,update
a function for updating adapter state and proposal parameters on each chain iteration,finalize
a function for performing any final updates to adapter state and proposal parameters on completion of chain sampling (may beNULL
if unused).state
a zero-argument function for accessing current values of adapter state variables.
Examples
proposal <- barker_proposal()
adapter <- shape_adapter()
adapter$initialize(proposal, chain_state(c(0, 0)))