pyabc.external.r
R interface via rpy2
- class pyabc.external.r.R(source_file: str)[source]
Bases:
object
Interface to R via rpy2.
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.
Note
Support of R via rpy2 is considered experimental for various reasons (see #116). Should this not work on your system, consider accessing R script-based.
- Parameters:
source_file – Path to the file which contains the definitions for the model, the summary statistics and the distance function as well as the observed data.
- distance(function_name: str)[source]
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)[source]
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)[source]
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