SepiaMCMC

Each SepiaParam object can contain a SepiaMCMC object to keep track of proposals, step types, and MCMC draws.

class sepia.SepiaMCMC(parent, stepType='Uniform', stepParam=0.1)

MCMC object to store step type, step parameters, draw candidates, accept/reject, and record draws.

Variables
  • stepType (string) – MCMC step type in [‘PropMH’, ‘Uniform’, ‘BetaRho’, ‘Recorder’]

  • stepParam (numpy.ndarray/NoneType) – step size params with shape param.val_shape, or None if using ‘Recorder’

  • parent (sepia.SepiaParam) – instantiated sepia.SepiaParam parameter object that this MCMC object corresponds to

  • draws (list) – list of MCMC draws (typically list of arrays, each of shape param.val_shape)

  • aCorr (float) – for MH correction

Initialize MCMC object.

Parameters
  • parent (sepia.SepiaParam) – instantiated sepia.SepiaParam parameter object that this MCMC object corresponds to

  • stepType (string) – MCMC step type in ‘PropMH’, ‘Uniform’, ‘BetaRho’, ‘Recorder’

  • stepParam (numpy.ndarray/NoneType) – step size params with shape param.val_shape, or None if using ‘Recorder’

Note

Typically not directly instantiated, but created by sepia.SepiaModel constructor.

accept()

Accept candidate.

draw_candidate(arr_ind, do_propMH)

Draw MCMC candidate for single variable/index.

Parameters
  • arr_ind (numpy.ndarray) – array index for variable of interest within parent sepia.SepiaParam object values

  • do_propMH (bool) – do propMH for variables where stepType = ‘propMH’?

Returns

scalar candidate value

Raises

ValueError – if stepType is not one of the supported values

record(x=None)

Record value into MCMC draws.

Parameters

x (numpy.ndarray/NoneType) – optionally, a value to record; otherwise, current parent.val is used.

reject(ind, model)

Reject candidate by restoring model to previous state.

Parameters
  • ind (int) – scalar (flattened) index of variable

  • model (sepia.sepiaModel) – sepia.SepiaModel object containing variable