Skip to main content

SDE

Struct SDE 

Source
pub struct SDE { /* private fields */ }
Expand description

Stochastic Differential Equation solver for pharmacometric models.

This struct represents a stochastic differential equation system and provides methods to simulate particles and estimate likelihood for PKPD modeling.

SDE models introduce stochasticity into the system dynamics, allowing for more realistic modeling of biological variability and uncertainty.

Implementations§

Source§

impl SDE

Source

pub fn new( drift: fn(&NalgebraVec<f64>, &NalgebraVec<f64>, f64, &mut NalgebraVec<f64>, &NalgebraVec<f64>, &Covariates), diffusion: fn(&NalgebraVec<f64>, &mut NalgebraVec<f64>), lag: fn(&NalgebraVec<f64>, f64, &Covariates) -> HashMap<usize, f64>, fa: fn(&NalgebraVec<f64>, f64, &Covariates) -> HashMap<usize, f64>, init: fn(&NalgebraVec<f64>, f64, &Covariates, &mut NalgebraVec<f64>), out: fn(&NalgebraVec<f64>, &NalgebraVec<f64>, f64, &Covariates, &mut NalgebraVec<f64>), nparticles: usize, ) -> SDE

Creates a new stochastic differential equation solver with default Neqs.

Use builder methods to configure dimensions:

SDE::new(drift, diffusion, lag, fa, init, out, nparticles)
    .with_nstates(2)
    .with_ndrugs(1)
    .with_nout(1)
Source

pub fn with_nstates(self, nstates: usize) -> SDE

Set the number of state variables.

Source

pub fn with_ndrugs(self, ndrugs: usize) -> SDE

Set the number of drug input channels (size of bolus[] and rateiv[]).

Source

pub fn with_nout(self, nout: usize) -> SDE

Set the number of output equations.

Trait Implementations§

Source§

impl Cache for SDE

Source§

fn with_cache_capacity(self, size: u64) -> SDE

Enable caching with the given maximum number of entries. Read more
Source§

fn enable_cache(self) -> SDE

Enable caching with the default size (100,000 entries). Read more
Source§

fn clear_cache(&self)

Clear all entries from this equation’s cache, if caching is enabled. Read more
Source§

fn disable_cache(self) -> SDE

Disable caching. Read more
Source§

impl Clone for SDE

Source§

fn clone(&self) -> SDE

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SDE

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Equation for SDE

Source§

fn estimate_likelihood( &self, subject: &Subject, support_point: &[f64], error_models: &AssayErrorModels, ) -> Result<f64, PharmsolError>

👎Deprecated since 0.23.0:

Use estimate_log_likelihood() instead for better numerical stability

Estimates the likelihood of observed data given a model and parameters.

§Arguments
  • subject - Subject data containing observations
  • support_point - Parameter vector for the model
  • error_model - Error model to use for likelihood calculations
§Returns

The log-likelihood of the observed data given the model and parameters.

Source§

fn estimate_log_likelihood( &self, subject: &Subject, support_point: &[f64], error_models: &AssayErrorModels, ) -> Result<f64, PharmsolError>

Estimate the log-likelihood of the subject given the support point and error model. Read more
Source§

fn kind() -> EqnKind

Source§

fn estimate_predictions( &self, subject: &Subject, support_point: &[f64], ) -> Result<Self::P, PharmsolError>

Generate predictions for a subject with given parameters. Read more
Source§

fn nouteqs(&self) -> usize

Get the number of output equations in the model.
Source§

fn nstates(&self) -> usize

Get the number of state variables in the model.
Source§

fn simulate_subject( &self, subject: &Subject, support_point: &[f64], error_models: Option<&AssayErrorModels>, ) -> Result<(Self::P, Option<f64>), PharmsolError>

Simulate a subject with given parameters and optionally calculate likelihood. Read more
Source§

impl EquationTypes for SDE

Source§

type S = Vec<Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>>

The state vector type
Source§

type P = ArrayBase<OwnedRepr<Prediction>, Dim<[usize; 2]>>

The predictions container type

Auto Trait Implementations§

§

impl Freeze for SDE

§

impl !RefUnwindSafe for SDE

§

impl Send for SDE

§

impl Sync for SDE

§

impl Unpin for SDE

§

impl UnsafeUnpin for SDE

§

impl !UnwindSafe for SDE

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T> SendAlias for T

Source§

impl<T> SyncAlias for T