Struct AssayErrorModels
pub struct AssayErrorModels { /* private fields */ }Expand description
Collection of assay/measurement error models for all outputs.
This struct represents measurement/assay noise - the error associated with quantification of drug concentration in biological samples. Sigma is computed from the observation value.
Used by non-parametric algorithms (NPAG, NPOD, etc.).
For parametric algorithms (SAEM, FOCE), use crate::ResidualErrorModels instead,
which computes sigma from the prediction.
This is a wrapper around a vector of AssayErrorModels, its size is determined by the number of outputs in the model/dataset.
Implementations§
§impl AssayErrorModels
impl AssayErrorModels
pub fn new() -> AssayErrorModels
pub fn new() -> AssayErrorModels
pub fn error_model(
&self,
outeq: usize,
) -> Result<&AssayErrorModel, ErrorModelError>
pub fn error_model( &self, outeq: usize, ) -> Result<&AssayErrorModel, ErrorModelError>
Get the error model for a specific output equation
§Arguments
outeq- The index of the output equation for which to retrieve the error model.
§Returns
A reference to the AssayErrorModel for the specified output equation.
§Errors
If the output equation index is invalid, an ErrorModelError::InvalidOutputEquation is returned.
pub fn add(
self,
outeq: usize,
model: AssayErrorModel,
) -> Result<AssayErrorModels, ErrorModelError>
pub fn add( self, outeq: usize, model: AssayErrorModel, ) -> Result<AssayErrorModels, ErrorModelError>
Add a new error model for a specific output equation
§Arguments
outeq- The index of the output equation for which to add the error model.model- The AssayErrorModel to add for the specified output equation.
§Returns
A new instance of AssayErrorModels with the added model.
§Errors
If the output equation index is invalid or if a model already exists for that output equation, an ErrorModelError::ExistingOutputEquation is returned.
pub fn iter(&self) -> impl Iterator<Item = (usize, &AssayErrorModel)>
pub fn iter(&self) -> impl Iterator<Item = (usize, &AssayErrorModel)>
Returns an iterator over the error models in the collection.
§Returns
An iterator that yields tuples containing the index and a reference to each AssayErrorModel.
pub fn into_iter(self) -> impl Iterator<Item = (usize, AssayErrorModel)>
pub fn into_iter(self) -> impl Iterator<Item = (usize, AssayErrorModel)>
Returns an iterator that yields mutable references to the error models in the collection.
§Returns
An iterator that yields tuples containing the index and a mutable reference to each AssayErrorModel.
pub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (usize, &mut AssayErrorModel)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (usize, &mut AssayErrorModel)>
Returns a mutable iterator that yields mutable references to the error models in the collection.
§Returns
An iterator that yields tuples containing the index and a mutable reference to each AssayErrorModel.
pub fn hash(&self) -> u64
pub fn hash(&self) -> u64
Computes a hash for the error models collection. This hash is based on the output equations and their associated error models.
§Returns
A u64 hash value representing the error models collection.
pub fn errorpoly(&self, outeq: usize) -> Result<ErrorPoly, ErrorModelError>
pub fn errorpoly(&self, outeq: usize) -> Result<ErrorPoly, ErrorModelError>
pub fn factor(&self, outeq: usize) -> Result<f64, ErrorModelError>
pub fn factor(&self, outeq: usize) -> Result<f64, ErrorModelError>
pub fn set_errorpoly(
&mut self,
outeq: usize,
poly: ErrorPoly,
) -> Result<(), ErrorModelError>
pub fn set_errorpoly( &mut self, outeq: usize, poly: ErrorPoly, ) -> Result<(), ErrorModelError>
pub fn set_factor(
&mut self,
outeq: usize,
factor: f64,
) -> Result<(), ErrorModelError>
pub fn set_factor( &mut self, outeq: usize, factor: f64, ) -> Result<(), ErrorModelError>
Sets the factor value for the specified output equation.
§Arguments
outeq- The index of the output equation.factor- The new factor value to set.
pub fn factor_param(&self, outeq: usize) -> Result<Factor, ErrorModelError>
pub fn factor_param(&self, outeq: usize) -> Result<Factor, ErrorModelError>
pub fn set_factor_param(
&mut self,
outeq: usize,
param: Factor,
) -> Result<(), ErrorModelError>
pub fn set_factor_param( &mut self, outeq: usize, param: Factor, ) -> Result<(), ErrorModelError>
pub fn is_factor_fixed(&self, outeq: usize) -> Result<bool, ErrorModelError>
pub fn is_factor_fixed(&self, outeq: usize) -> Result<bool, ErrorModelError>
pub fn fix_factor(&mut self, outeq: usize) -> Result<(), ErrorModelError>
pub fn fix_factor(&mut self, outeq: usize) -> Result<(), ErrorModelError>
Makes the factor parameter fixed at its current value for the specified output equation.
§Arguments
outeq- The index of the output equation.
pub fn unfix_factor(&mut self, outeq: usize) -> Result<(), ErrorModelError>
pub fn unfix_factor(&mut self, outeq: usize) -> Result<(), ErrorModelError>
Makes the factor parameter variable at its current value for the specified output equation.
§Arguments
outeq- The index of the output equation.
pub fn is_proportional(&self, outeq: usize) -> bool
pub fn is_proportional(&self, outeq: usize) -> bool
pub fn is_additive(&self, outeq: usize) -> bool
pub fn is_additive(&self, outeq: usize) -> bool
pub fn sigma(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
pub fn sigma(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
Computes the standard deviation (sigma) for the specified output equation and prediction.
This always uses the observation value to compute sigma, which is appropriate
for non-parametric algorithms (NPAG, NPOD). For parametric algorithms (SAEM, FOCE),
use crate::ResidualErrorModels instead, which computes sigma from the prediction.
§Arguments
prediction- ThePredictionto use for the calculation.
§Returns
A Result containing the computed sigma value or an ErrorModelError if the calculation fails.
pub fn variance(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
pub fn variance(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
Computes the variance for the specified output equation and prediction.
§Arguments
outeq- The index of the output equation.prediction- ThePredictionto use for the calculation.
§Returns
A Result containing the computed variance or an ErrorModelError if the calculation fails.
pub fn sigma_from_value(
&self,
outeq: usize,
value: f64,
) -> Result<f64, ErrorModelError>
pub fn sigma_from_value( &self, outeq: usize, value: f64, ) -> Result<f64, ErrorModelError>
Computes the standard deviation (sigma) for the specified output equation and value.
§Arguments
outeq- The index of the output equation.value- The value to use for the calculation.
§Returns
A Result containing the computed sigma value or an ErrorModelError if the calculation fails.
pub fn variance_from_value(
&self,
outeq: usize,
value: f64,
) -> Result<f64, ErrorModelError>
pub fn variance_from_value( &self, outeq: usize, value: f64, ) -> Result<f64, ErrorModelError>
Computes the variance for the specified output equation and value.
§Arguments
outeq- The index of the output equation.value- The value to use for the calculation.
§Returns
A Result containing the computed variance or an ErrorModelError if the calculation fails.
Trait Implementations§
§impl Clone for AssayErrorModels
impl Clone for AssayErrorModels
§fn clone(&self) -> AssayErrorModels
fn clone(&self) -> AssayErrorModels
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for AssayErrorModels
impl Debug for AssayErrorModels
§impl Default for AssayErrorModels
impl Default for AssayErrorModels
§fn default() -> AssayErrorModels
fn default() -> AssayErrorModels
§impl<'de> Deserialize<'de> for AssayErrorModels
impl<'de> Deserialize<'de> for AssayErrorModels
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AssayErrorModels, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AssayErrorModels, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl From<Vec<AssayErrorModel>> for AssayErrorModels
impl From<Vec<AssayErrorModel>> for AssayErrorModels
§fn from(models: Vec<AssayErrorModel>) -> AssayErrorModels
fn from(models: Vec<AssayErrorModel>) -> AssayErrorModels
§impl<'a> IntoIterator for &'a AssayErrorModels
impl<'a> IntoIterator for &'a AssayErrorModels
§type Item = (usize, &'a AssayErrorModel)
type Item = (usize, &'a AssayErrorModel)
§type IntoIter = Enumerate<Iter<'a, AssayErrorModel>>
type IntoIter = Enumerate<Iter<'a, AssayErrorModel>>
§fn into_iter(self) -> <&'a AssayErrorModels as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a AssayErrorModels as IntoIterator>::IntoIter
§impl<'a> IntoIterator for &'a mut AssayErrorModels
impl<'a> IntoIterator for &'a mut AssayErrorModels
§type Item = (usize, &'a mut AssayErrorModel)
type Item = (usize, &'a mut AssayErrorModel)
§type IntoIter = Enumerate<IterMut<'a, AssayErrorModel>>
type IntoIter = Enumerate<IterMut<'a, AssayErrorModel>>
§fn into_iter(self) -> <&'a mut AssayErrorModels as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a mut AssayErrorModels as IntoIterator>::IntoIter
§impl IntoIterator for AssayErrorModels
impl IntoIterator for AssayErrorModels
§type Item = (usize, AssayErrorModel)
type Item = (usize, AssayErrorModel)
§type IntoIter = IntoIter<<AssayErrorModels as IntoIterator>::Item>
type IntoIter = IntoIter<<AssayErrorModels as IntoIterator>::Item>
§fn into_iter(self) -> <AssayErrorModels as IntoIterator>::IntoIter
fn into_iter(self) -> <AssayErrorModels as IntoIterator>::IntoIter
§impl Serialize for AssayErrorModels
impl Serialize for AssayErrorModels
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for AssayErrorModels
impl RefUnwindSafe for AssayErrorModels
impl Send for AssayErrorModels
impl Sync for AssayErrorModels
impl Unpin for AssayErrorModels
impl UnsafeUnpin for AssayErrorModels
impl UnwindSafe for AssayErrorModels
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Context for T
impl<T> Context for T
fn vector_from_element<V>(&self, len: usize, value: <V as VectorCommon>::T) -> Vwhere
V: Vector<C = Self>,
fn vector_from_vec<V>(&self, vec: Vec<<V as VectorCommon>::T>) -> Vwhere
V: Vector<C = Self>,
fn vector_zeros<V>(&self, len: usize) -> Vwhere
V: Vector<C = Self>,
fn dense_mat_zeros<V>(
&self,
rows: usize,
cols: usize,
) -> <V as DefaultDenseMatrix>::Mwhere
V: Vector<C = Self> + DefaultDenseMatrix,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.