Get the hazard function for a specific component
Source:R/generic_functions.R, R/methods.R
component_hazard.RdReturns a closure that computes the hazard rate for component j
of a series system. Useful for plotting hazard decompositions and
understanding each component's contribution to system risk.
Usage
component_hazard(x, j, ...)
# S3 method for class 'dfr_dist_series'
component_hazard(x, j, ...)Arguments
- x
A system object (e.g.,
dfr_dist_series).- j
Component index (integer,
1 <= j <= ncomponents(x)).- ...
Additional arguments passed to methods.
Value
A closure function(t, par = NULL, ...) that evaluates
component j's hazard rate. If par is NULL, the
component's default parameters (from the system) are used.
Details
The returned closure evaluates \(h_j(t, \theta_j)\) for component
j. The par argument accepts component-local
parameters (not the full system parameter vector). This is useful for:
Plotting individual hazard contributions
Verifying that \(\sum_j h_j(t) = h_{sys}(t)\)
Sensitivity analysis on a single component
Methods (by class)
component_hazard(dfr_dist_series): Hazard closure for component j of a series system. Returnsfunction(t, par_j = NULL, ...)wherepar_jare the component-local parameters.
See also
component to extract the full component object,
hazard for the system-level hazard,
dfr_dist_series for the constructor
Other system introspection:
component(),
ncomponents(),
param_layout(),
sample_components()
Examples
# \donttest{
library(flexhaz)
sys <- dfr_dist_series(list(
dfr_exponential(0.1),
dfr_exponential(0.2)
))
h1 <- component_hazard(sys, 1)
h2 <- component_hazard(sys, 2)
h_sys <- hazard(sys)
# Verify hazard sum property
t <- 10
h1(t) + h2(t) # 0.3
#> [1] 0.3
h_sys(t) # 0.3 (same!)
#> [1] 0.3
# }