McKenzie Single Species - Single Season

class ollin.estimation.occupancy.single_species.Model[source]

McKenzie Model for Single Species - Single Season occupancy estimation.

# TODO

estimate(detection, method='MAP', priors=None)[source]

Estimate using detection data and stan model.

Detection data is prepared using prepare_data() method and fed to pystan model. The model then samples from the posterior distribution (if method == ‘sample’) or optimizes for the parameters in the posterior distribution (if method == ‘MAP’).

Any estimation model that inherits from this class must extend this method to extract the relevant information from the stanmodel output.

Parameters:
  • detection (ollin.core.detection.Detection) – Detection data from which to make estimate.
  • method ({'MAP', 'sample'}, optional) – Method for inference. If ‘MAP’, Stan will try to find the parameters at which likelihood of the posterior distribution is a maximum. If ‘sample’, Stan will run the Hamiltonian Monte Carlo sampler to return a large sample of the posterior distribution. Defaults to ‘MAP’.
  • priors (dict, optional) – Dictionary holding all information of priors parameters.
Returns:

result – If method = ‘MAP’ it will return a dictionary with the parameter values at which a maximum (local) of the posterior likelihood was found. If method = ‘sample’ it will a pystan.StanFit4Model object that contains all information of the sampling. See http://pystan.readthedocs.io/en/latest/api.html#pystan.StanModel.sampling.

Return type:

dict or pystan.StanFit4Model

prepare_data(detection, priors)[source]

Prepare the data to feed to the Stan model.

See the pystan.StanModel.sampling() documentation for further information (http://pystan.readthedocs.io/en/latest/api.html#pystan.StanModel).

Parameters:
  • detection (Detection) – Detection data.
  • priors (dict) – Any priors parameters information should be stored here.
Returns:

data – All inputs for variables defined in the Stan model must be contained in this dictionary.

Return type:

dict