petab.v1.calculate
Functions performing various calculations.
Functions
|
Calculate the chi2 value. |
Compute chi2 value for a single residual table. |
|
|
Calculate total log likelihood. |
|
Calculate log-likelihood for one set of tables. |
|
Calculate residuals. |
|
Calculate residuals for a single measurement table. |
|
Calculate a single log likelihood. |
|
Fill in parameters for measurement and evaluate noise_formula. |
|
Sympify noise formulas. |
- petab.v1.calculate.calculate_chi2(measurement_dfs: list[DataFrame] | DataFrame, simulation_dfs: list[DataFrame] | DataFrame, observable_dfs: list[DataFrame] | DataFrame, parameter_dfs: list[DataFrame] | DataFrame, normalize: bool = True, scale: bool = True) float [source]
Calculate the chi2 value.
- Parameters:
measurement_dfs – The problem measurement tables.
simulation_dfs – Simulation tables corresponding to the measurement tables.
observable_dfs – The problem observable tables.
parameter_dfs – The problem parameter tables.
normalize – Whether to normalize residuals by the noise standard deviation terms.
scale – Whether to calculate residuals of scaled values.
- Returns:
The aggregated chi2 value.
- petab.v1.calculate.calculate_chi2_for_table_from_residuals(residual_df: DataFrame) float [source]
Compute chi2 value for a single residual table.
- petab.v1.calculate.calculate_llh(measurement_dfs: list[DataFrame] | DataFrame, simulation_dfs: list[DataFrame] | DataFrame, observable_dfs: list[DataFrame] | DataFrame, parameter_dfs: list[DataFrame] | DataFrame) float [source]
Calculate total log likelihood.
- Parameters:
measurement_dfs – The problem measurement tables.
simulation_dfs – Simulation tables corresponding to the measurement tables.
observable_dfs – The problem observable tables.
parameter_dfs – The problem parameter tables.
- Returns:
The log-likelihood.
- petab.v1.calculate.calculate_llh_for_table(measurement_df: DataFrame, simulation_df: DataFrame, observable_df: DataFrame, parameter_df: DataFrame) float [source]
Calculate log-likelihood for one set of tables. For the arguments, see calculate_llh.
- petab.v1.calculate.calculate_residuals(measurement_dfs: list[DataFrame] | DataFrame, simulation_dfs: list[DataFrame] | DataFrame, observable_dfs: list[DataFrame] | DataFrame, parameter_dfs: list[DataFrame] | DataFrame, normalize: bool = True, scale: bool = True) list[DataFrame] [source]
Calculate residuals.
- Parameters:
measurement_dfs – The problem measurement tables.
simulation_dfs – Simulation tables corresponding to the measurement tables.
observable_dfs – The problem observable tables.
parameter_dfs – The problem parameter tables.
normalize – Whether to normalize residuals by the noise standard deviation terms.
scale – Whether to calculate residuals of scaled values.
- Returns:
List of DataFrames in the same structure as measurement_dfs with a field residual instead of measurement.
- petab.v1.calculate.calculate_residuals_for_table(measurement_df: DataFrame, simulation_df: DataFrame, observable_df: DataFrame, parameter_df: DataFrame, normalize: bool = True, scale: bool = True) DataFrame [source]
Calculate residuals for a single measurement table. For the arguments, see calculate_residuals.
- petab.v1.calculate.calculate_single_llh(measurement: float, simulation: float, scale: str, noise_distribution: str, noise_value: float) float [source]
Calculate a single log likelihood.
- Parameters:
measurement – The measurement value.
simulation – The simulated value.
scale – The scale on which the noise model is to be applied.
noise_distribution – The noise distribution.
noise_value – The considered noise models possess a single noise parameter, e.g. the normal standard deviation.
- Returns:
The computed likelihood for the given values.
- petab.v1.calculate.evaluate_noise_formula(measurement: Series, noise_formulas: dict[str, Expr], parameter_df: DataFrame, simulation: Number) float [source]
Fill in parameters for measurement and evaluate noise_formula.
- Parameters:
measurement – A measurement table row.
noise_formulas – The noise formulas as computed by get_symbolic_noise_formulas.
parameter_df – The parameter table.
simulation – The simulation corresponding to the measurement, scaled.
- Returns:
The noise value.