climepi.epimod.ParameterizedSuitabilityModel#

class climepi.epimod.ParameterizedSuitabilityModel(*, parameters, suitability_function, data=None, suitability_var_name='suitability', suitability_var_long_name='Suitability')[source]#

Class for parameterized suitability models.

Represents models in which a suitability metric (e.g., the basic reproduction number) is defined as a function of parameters, which in turn may depend on climate variables. Provides methods for inferring the dependence of parameters on temperature from laboratory data.

Subclass of SuitabilityModel.

Parameters:
  • parameters (dict) – Dictionary of model parameters. Each key is a parameter name, and the value is either a number (constant parameter), a callable (function which takes keyword arguments temperature and, if the model is dependent on precipitation, precipitation, which should be able to handle xarray.DataArray objects as inputs), or, for temperature-dependent parameters that are to be fitted, a dictionary with the following keys:

    curve_typestr

    The type of curve to fit. Options are ‘quadratic’ (response = a*(T-T_min)*(T-T_max) for T_min < T < T_max, where T is temperature, and zero otherwise) and ‘briere’ (response = a*T*(T-T_min)*sqrt(T_max-T) for T_min < T < T_max, where T is temperature, and zero otherwise). In both cases, a is the scale parameter, T_min is the minimum temperature, and T_max is the maximum temperature, and normally distributed noise is assumed on the response.

    probabilitybool, optional

    If True, the fitted curve is constrained to be between 0 and 1. Default is False.

    priorsdict, optional

    Dictionary of priors for the parameters of the model. The keys should be the parameter names (‘scale’, ‘temperature_min’, ‘temperature_max’, and either ‘noise_std’ or ‘noise_precision’ - see description for ‘curve_type’ above) and the values should callable functions that return pymc distributions. Where not specified, default priors are used based on the curve type (as used by Mordecai et al., PLoS Negl Trop Dis 2017).

    attrsdict, optional

    Additional attributes to assign to the trait variable in the posterior response xarray.DataArray (in particular, the ‘long_name’ and ‘units’ attributes are used by hvplot to automatically label axes in the plot_fitted_temperature_responses() method).

    Additionally, the following can either be provided as part of the parameter dictionary, or will be automatically extracted from the data argument if provided:

    temperature_data: array-like

    Vector of temperature values for which response data are available.

    trait_data: array-like

    Vector of trait values corresponding to the temperature data.

  • suitability_function (callable) – A callable that takes the model parameters as keyword arguments and returns a suitability metric (e.g., the basic reproduction number). The callable should be able to handle xarray.DataArray objects as inputs.

  • data (pandas.DataFrame, optional) – A DataFrame containing the temperature and trait data for the parameters to be fitted. The DataFrame should have columns ‘trait_name’, ‘temperature’, and ‘trait_value’.

  • suitability_var_name (str, optional) – The name of the suitability variable. Default is ‘suitability’.

  • suitability_var_long_name (str, optional) – The long name of the suitability variable. Default is ‘Suitability’.

__init__(*, parameters, suitability_function, data=None, suitability_var_name='suitability', suitability_var_long_name='Suitability')[source]#

Methods

__init__(*, parameters, suitability_function)

construct_suitability_table(*, temperature_vals)

Construct a suitability table based on the fitted parameters.

fit_temperature_responses([step, thin])

Fit the model to data.

get_max_suitability()

Get the maximum suitability value.

get_posterior_min_optimal_max_temperature([...])

Get posterior distributions of minimum, optimal, and maximum temperatures.

plot_fitted_temperature_responses([...])

Plot the fitted temperature responses.

plot_suitability(**kwargs)

Plot suitability against temperature and (if relevant) precipitation.

reduce([suitability_threshold, stat, ...])

Get a summary suitability model.

run(*args, **kwargs)

Run the epidemiological model on a given climate dataset.