cold_standby_dist: Cold-standby system distribution

View source: R/cold_standby.R

cold_standby_distR Documentation

Cold-standby system distribution

Description

Constructs a distribution representing a cold-standby system: one component active at a time with perfect, instantaneous switching to the next spare upon failure. System lifetime equals the sum of independent component lifetimes.

Estimates S(t) = P(T_1 + ... + T_m > t) by simulating mc system lifetimes and computing the empirical fraction exceeding t. The returned closure caches its sample vector: the first call generates mc samples, subsequent calls reuse them as long as mc is unchanged (a different mc triggers a fresh draw). This makes repeated S(t) calls deterministic given the same mc.

Computes the CDF by deferring to a fresh surv closure. The CDF closure has its own sample cache (independent of any external surv closure), so cdf(x)(t) + surv(x)(t) is generally not exactly 1 unless callers reuse a single surv closure: prefer ⁠S <- surv(x); F_t <- 1 - S(t)⁠ over computing both independently.

Usage

cold_standby_dist(components)

## S3 method for class 'cold_standby_dist'
sampler(x, ...)

## S3 method for class 'cold_standby_dist'
surv(x, ...)

## S3 method for class 'cold_standby_dist'
cdf(x, ...)

Arguments

components

List of dist objects representing per-stage component lifetimes.

x

A cold_standby_dist object.

...

Ignored.

Details

Cold standby is not a coherent system in the structure-function sense (its topology is temporal succession, not an order statistic), so the returned object does not inherit dist_structure. It IS a dist (with surv, cdf, sampler, mean available) and exposes ncomponents() and component() for inspection.

Defaults: sampler is exact (sample each component independently and sum); mean is exact when every component implements mean() (otherwise falls back to Monte Carlo via the sampler); surv and cdf use Monte Carlo with a default of 1e5 simulated lifetimes (override via the mc argument). The returned surv / cdf closures cache their samples after the first call so subsequent evaluations at different t values are deterministic given the same mc.

Methods inherited from algebraic.dist::univariate_dist that require density or sup (notably expectation, vcov) are NOT supported on cold-standby objects out of the box; specialized subclasses with closed-form aggregate distributions (e.g., iid exponential collapses to Gamma(m, rate)) should provide their own methods.

For reproducibility across calls to surv() itself (i.e., between separately constructed closures), set the RNG seed externally via set.seed() before invoking surv(x). Override the method on a subclass with an exact aggregate distribution (e.g., iid exponential collapses to Gamma(m, rate)) when an analytic form is available.

Value

An object of class c("cold_standby_dist", "univariate_dist", "continuous_dist", "dist").

Examples

# Cold standby of 3 iid Exp(1) components: aggregate is Gamma(3, 1)
sys <- cold_standby_dist(replicate(3,
  algebraic.dist::exponential(1), simplify = FALSE))
mean(sys)  # = 3

dist.structure documentation built on May 13, 2026, 1:07 a.m.