Trait Equation
pub trait Equation:
EquationPriv
+ 'static
+ Clone
+ Sync {
// Required methods
fn estimate_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &AssayErrorModels,
) -> Result<f64, PharmsolError>;
fn estimate_log_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &AssayErrorModels,
) -> 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<&AssayErrorModels>,
) -> 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.
§Likelihood Calculation
Use estimate_log_likelihood for numerically stable
likelihood computation. The deprecated estimate_likelihood
is provided for backward compatibility.
Required Methods§
fn estimate_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &AssayErrorModels,
) -> Result<f64, PharmsolError>
👎Deprecated since 0.23.0: Use estimate_log_likelihood() instead for better numerical stability
fn estimate_likelihood( &self, subject: &Subject, support_point: &Vec<f64>, error_models: &AssayErrorModels, ) -> Result<f64, PharmsolError>
Estimate the likelihood of the subject given the support point and error model.
Deprecated: Use estimate_log_likelihood instead
for better numerical stability, especially with many observations or extreme parameter values.
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 model
§Returns
The likelihood value (product of individual observation likelihoods)
fn estimate_log_likelihood(
&self,
subject: &Subject,
support_point: &Vec<f64>,
error_models: &AssayErrorModels,
) -> Result<f64, PharmsolError>
fn estimate_log_likelihood( &self, subject: &Subject, support_point: &Vec<f64>, error_models: &AssayErrorModels, ) -> 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.
Uses observation-based sigma, appropriate for non-parametric algorithms.
For parametric algorithms (SAEM, FOCE), use crate::ResidualErrorModels directly.
§Parameters
subject: The subject datasupport_point: The parameter valueserror_models: The error model
§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<&AssayErrorModels>,
) -> Result<(Self::P, Option<f64>), PharmsolError>
fn simulate_subject( &self, subject: &Subject, support_point: &Vec<f64>, error_models: Option<&AssayErrorModels>, ) -> 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.