Enum ErrorModel
pub enum ErrorModel {
Additive {
lambda: f64,
poly: ErrorPoly,
},
Proportional {
gamma: f64,
poly: ErrorPoly,
},
}
Expand description
Model for calculating observation errors in pharmacometric analyses
An ErrorModel defines how the standard deviation of observations is calculated based on the type of error model used and its parameters.
Variants§
Additive
Additive error model, where error is independent of concentration
Contains:
lambda
- Lambda parameter for scaling errorspoly
- Error polynomial coefficients (c0, c1, c2, c3)
Fields
Proportional
Proportional error model, where error scales with concentration
Contains:
gamma
- Gamma parameter for scaling errorspoly
- Error polynomial coefficients (c0, c1, c2, c3)
Implementations§
§impl ErrorModel
impl ErrorModel
pub fn additive(poly: ErrorPoly, lambda: f64) -> ErrorModel
pub fn additive(poly: ErrorPoly, lambda: f64) -> ErrorModel
pub fn proportional(poly: ErrorPoly, gamma: f64) -> ErrorModel
pub fn proportional(poly: ErrorPoly, gamma: f64) -> ErrorModel
pub fn set_polynomial(&mut self, poly: ErrorPoly)
pub fn set_polynomial(&mut self, poly: ErrorPoly)
pub fn set_scalar(&mut self, scalar: f64)
pub fn set_scalar(&mut self, scalar: f64)
Set the scaling parameter
pub fn sigma(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
pub fn sigma(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
Estimate the standard deviation for a prediction
Calculates the standard deviation based on the error model type, using either observation-specific error polynomial coefficients or the model’s default coefficients.
§Arguments
prediction
- The prediction for which to estimate the standard deviation
§Returns
The estimated standard deviation of the prediction
pub fn variance(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
pub fn variance(&self, prediction: &Prediction) -> Result<f64, ErrorModelError>
Estimate the variance of the observation
This is a conveniecen function which calls ErrorModel::sigma, and squares the result.
pub fn sigma_from_value(&self, value: f64) -> Result<f64, ErrorModelError>
pub fn sigma_from_value(&self, value: f64) -> Result<f64, ErrorModelError>
Estimate the standard deviation for a raw observation value
Calculates the standard deviation based on the error model type, using the model’s default coefficients and a provided observation value.
§Arguments
value
- The observation value for which to estimate the standard deviation
§Returns
The estimated standard deviation for the given value
pub fn variance_from_value(&self, value: f64) -> Result<f64, ErrorModelError>
pub fn variance_from_value(&self, value: f64) -> Result<f64, ErrorModelError>
Estimate the variance for a raw observation value
This is a conveniecen function which calls ErrorModel::sigma_from_value, and squares the result.
Trait Implementations§
§impl Clone for ErrorModel
impl Clone for ErrorModel
§fn clone(&self) -> ErrorModel
fn clone(&self) -> ErrorModel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ErrorModel
impl Debug for ErrorModel
§impl<'de> Deserialize<'de> for ErrorModel
impl<'de> Deserialize<'de> for ErrorModel
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorModel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorModel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Error> for ErrorModel
impl From<Error> for ErrorModel
§impl Serialize for ErrorModel
impl Serialize for ErrorModel
§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 ErrorModel
impl RefUnwindSafe for ErrorModel
impl Send for ErrorModel
impl Sync for ErrorModel
impl Unpin for ErrorModel
impl UnwindSafe for ErrorModel
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> 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> 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.