pyABC’s interface to external simulators

Currently, the R language is supported.

Note

The rpy2 package needs to be installed to interface with the R language. Installation of rpy2 is optional if R support is not required. See also installation of optional dependencies.

class pyabc.external.R(source_file: str)

Interface to R.

Parameters:source_file (str) – Path to the file which contains the definitions for the model, the summary statistics and the distance function as well as the observed data.
display_source_ipython()

Convenience method to print the loaded source file as syntax highlighted HTML within IPython.

distance(function_name: str)

The R-distance function.

Parameters:function_name (str) – Name of the function in the R script which defines the distance function.
Returns:distance – The distance function.
Return type:callable
model(function_name: str)

The R-model.

Parameters:function_name (str) – Name of the function in the R script which defines the model.
Returns:model – The model.
Return type:callable
observation(name: str)

The summary statistics of the observed data as defined in R.

Parameters:name (str) – Name of the named list defined in the R script which holds the observed data.
Returns:observation – A dictionary like object which holds the summary statistics of the observed data.
Return type:r named list
summary_statistics(function_name: str)

The R-summary statistics.

Parameters:function_name (str) – Name of the function in the R script which defines the summary statistics function.
Returns:summary_statistics – The summary statistics function.
Return type:callable