Function log_likelihood_matrix
pub fn log_likelihood_matrix(
equation: &impl Equation,
subjects: &Data,
support_points: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
error_models: &AssayErrorModels,
progress: bool,
) -> Result<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, PharmsolError>Expand description
Calculate the log-likelihood matrix for all subjects and support points.
This function computes log-likelihoods directly in log-space, which is numerically more stable than computing likelihoods and then taking logarithms. This is especially important when dealing with many observations or extreme parameter values that could cause the regular likelihood to underflow to zero.
§Parameters
equation: The equation to use for simulationsubjects: The subject datasupport_points: The support points to evaluate (rows = support points, cols = parameters)error_models: The error models to use (observation-based sigma)progress: Whether to display a progress bar during computation`
§Returns
A 2D array of log-likelihoods with shape (n_subjects, n_support_points)
§Example
ⓘ
use pharmsol::prelude::simulator::log_likelihood_matrix;
let log_liks = log_likelihood_matrix(
&equation,
&data,
&support_points,
&error_models,
false
)?;