Learn R Programming

degradr (version 1.0.1)

compute_healthindex: Constructing the Health Index on New Data Using Trained Weights

Description

Given a fitted "healthindex" object, this function constructs the univariate health index for new multivariate sensor data by applying the stored projection (weights and offsets).

Usage

compute_healthindex(model, data)

Value

A data frame (tibble) with the columns:

unit

Unit identifier.

t

Time index.

x

Constructed health index at each (unit, t).

Arguments

model

An object of class "healthindex" returned by fit_healthindex.

data

A data frame with new sensor readings over time. Must include the columns t (time) and unit (unit identifier), plus the same set of degradation signals used at training. All degradation signals must follow an upward trend.

Details

This function applies the projection learned in the first stage of fit_healthindex to new data:

See Also

fit_healthindex for learning the health index and mixed-effects model, predict_rul for RUL prediction based on the fitted model.

Examples

Run this code
library(degradr)
library(dplyr)
# Load example data
data(train_FD001)
data(test_FD001)
data <- train_FD001 %>%
  select(unit,t,T24,T50,P30,
         Nf,Ps30,phi, NRf,
         BPR,htBleed,
         W31, W32) %>%
  mutate(across(c(P30,phi,W31,W32), ~ . * -1))

test <- test_FD001 %>%
  select(unit,t,T24,T50,P30,
         Nf,Ps30,phi, NRf,
         BPR,htBleed,
         W31, W32) %>%
  mutate(across(c(P30,phi,W31,W32), ~ . * -1))

# Fit a health index model (exponential trajectory of degree 2)
model <- fit_healthindex(data = data, type = "exponential",
                         degree = 2, r = 0.8)

# Construct the health index on new data using stored weights/offsets
hi_new <- compute_healthindex(model = model, data = test)
head(hi_new)

Run the code above in your browser using DataLab