Skip to contents

Returns the number of components \(m\) in a series system, corresponding to the number of terms in \(h_{sys}(t) = \sum_{j=1}^{m} h_j(t)\).

Usage

ncomponents(x, ...)

# S3 method for class 'dfr_dist_series'
ncomponents(x, ...)

Arguments

x

A system object (e.g., dfr_dist_series).

...

Additional arguments passed to methods.

Value

Integer, the number of components.

Details

For a dfr_dist_series object created from a list of m components, this simply returns m. This is useful for programmatically iterating over components, e.g., for plotting hazard decompositions or computing failure attribution.

Methods (by class)

  • ncomponents(dfr_dist_series): Number of components in a series system.

See also

component to extract individual components, dfr_dist_series for the constructor

Other system introspection: component(), component_hazard(), param_layout(), sample_components()

Examples

# \donttest{
library(flexhaz)

sys <- dfr_dist_series(list(
    dfr_exponential(0.1),
    dfr_weibull(shape = 2, scale = 100),
    dfr_gompertz(a = 0.01, b = 0.05)
))
ncomponents(sys)  # 3
#> [1] 3
# }