Trait Equation
pub trait Equation:
EquationPriv
+ 'static
+ Clone
+ Sync {
// Required methods
fn estimate_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &ErrorModels,
cache: bool,
) -> Result<f64, PharmsolError>;
fn estimate_log_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &ErrorModels,
cache: bool,
) -> Result<f64, PharmsolError>;
fn kind() -> EqnKind;
// Provided methods
fn estimate_predictions(
&self,
subject: &Subject,
support_point: &Vec<f64>,
) -> Result<Self::P, PharmsolError> { ... }
fn nouteqs(&self) -> usize { ... }
fn nstates(&self) -> usize { ... }
fn simulate_subject(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: Option<&ErrorModels>,
) -> 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_models: &ErrorModels,
cache: bool,
) -> Result<f64, PharmsolError>
fn estimate_likelihood( &self, subject: &Subject, support_point: &Vec<f64>, error_models: &ErrorModels, 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 datasupport_point: The parameter valueserror_model: The error modelcache: Whether to use caching
§Returns
The likelihood value (product of individual observation likelihoods)
fn estimate_log_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &ErrorModels,
cache: bool,
) -> Result<f64, PharmsolError>
fn estimate_log_likelihood( &self, subject: &Subject, support_point: &Vec<f64>, error_models: &ErrorModels, cache: bool, ) -> Result<f64, PharmsolError>
Estimate the log-likelihood of the subject given the support point and error model.
This function calculates the log of how likely the observed data is given the model
parameters and error model. It is numerically more stable than estimate_likelihood
for extreme values or many observations.
§Parameters
subject: The subject datasupport_point: The parameter valueserror_model: The error modelcache: Whether to use caching
§Returns
The log-likelihood value (sum of individual observation log-likelihoods)
fn kind() -> EqnKind
Provided Methods§
fn estimate_predictions(
&self,
subject: &Subject,
support_point: &Vec<f64>,
) -> Result<Self::P, PharmsolError>
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_models: Option<&ErrorModels>,
) -> Result<(Self::P, Option<f64>), PharmsolError>
fn simulate_subject( &self, subject: &Subject, support_point: &Vec<f64>, error_models: Option<&ErrorModels>, ) -> Result<(Self::P, Option<f64>), PharmsolError>
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.