Trait Equation

pub trait Equation:
    EquationPriv
    + 'static
    + Clone
    + Sync {
    // Required method
    fn estimate_likelihood(
        &self,
        subject: &Subject,
        support_point: &Vec<f64>,
        error_model: &ErrorModel,
        cache: bool,
    ) -> Result<f64, PharmsolError>;

    // Provided methods
    fn estimate_predictions(
        &self,
        subject: &Subject,
        support_point: &Vec<f64>,
    ) -> Result<Self::P, PharmsolError> { ... }
    fn simulate_subject(
        &self,
        subject: &Subject,
        support_point: &Vec<f64>,
        error_model: Option<&ErrorModel>,
    ) -> Result<(Self::P, Option<f64>), PharmsolError> { ... }
}
Expand description

Trait for model equations that can be simulated.

This trait defines the interface for different types of model equations (ODE, SDE, analytical) that can be simulated to generate predictions and estimate parameters.

Required Methods§

fn estimate_likelihood( &self, subject: &Subject, support_point: &Vec<f64>, error_model: &ErrorModel, cache: bool, ) -> Result<f64, PharmsolError>

Estimate the likelihood of the subject given the support point and error model.

This function calculates how likely the observed data is given the model parameters and error model. It may use caching for performance.

§Parameters
  • subject: The subject data
  • support_point: The parameter values
  • error_model: The error model
  • cache: Whether to use caching
§Returns

The log-likelihood value

Provided Methods§

fn estimate_predictions( &self, subject: &Subject, support_point: &Vec<f64>, ) -> Result<Self::P, PharmsolError>

Generate predictions for a subject with given parameters.

§Parameters
  • subject: The subject data
  • support_point: The parameter values
§Returns

Predicted concentrations

fn simulate_subject( &self, subject: &Subject, support_point: &Vec<f64>, error_model: Option<&ErrorModel>, ) -> Result<(Self::P, Option<f64>), PharmsolError>

Simulate a subject with given parameters and optionally calculate likelihood.

§Parameters
  • subject: The subject data
  • support_point: The parameter values
  • error_model: The error model (optional)
§Returns

A tuple containing predictions and optional likelihood

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§