Learn R Programming

degradr (version 1.0.1)

fit_model: Fitting the Linear Mixed Effects Model

Description

Fits a linear or exponential mixed-effects model of degree \(p\) for the degradation process.

Usage

fit_model(data,
  type = "exponential",
  method = "lm",
  degree = 2,
  phi = NULL)

Value

Returns a list with the estimated model and prior distributions.

Arguments

data

A data frame with three columns: t for time, x for the degradation signal, and unit as the unit identifier. At least two distinct units are required.

type

Model type. Either "linear" or "exponential". The exponential model applies a logarithmic transformation to x - phi. Default is "exponential".

method

Estimation method. Either "nlme" to fit a nonlinear mixed-effects model using nlme::lme(), or "lm" to fit separate linear models per unit and estimate fixed and random effects from the set of coefficients. Default is "lm".

degree

Degree of the polynomial model. Default is 2. The fixed and random effects will include powers of time up to the specified degree.

phi

Initial degradation level for non-defective units. Used in the exponential model as a fixed offset to ensure that the logarithmic transformation is valid and interpretable. If NULL, it is automatically estimated as a value slightly below the minimum observed degradation level. Ignored when type = "linear".

Details

This function fits a linear or exponential polynomial mixed-effects model of degree p to degradation data collected over time from multiple units. The model captures both fixed effects (population-level degradation trends) and random effects (unit-specific deviations).

The exponential model applies a logarithmic transformation with an offset parameter phi. The offset phi can be provided or automatically estimated from the data.

At least two distinct units are required to estimate random effects. The degree parameter controls the polynomial order for the time terms in both fixed and random effects.

References

Liu, K. and Huang, S. (2016). Integration of Data Fusion Methodology and Degradation Modeling Process to Improve Prognostics. IEEE Transactions on Automation Science and Engineering, 13(1), 344--354.tools:::Rd_expr_doi("10.1109/TASE.2014.2349733")

Examples

Run this code
library(degradr)

# Load example data sets
data(filter_train)
data(filter_test)

# Show the original column names
colnames(filter_train)

# Rename the columns to match the expected format: t, x, unit
colnames(filter_train) <- c("t", "x", "unit")
colnames(filter_test)  <- c("t", "x", "unit", "RUL")

# Plot the training set
plot_degradr(data = filter_train, D = 600)

# Fit an exponential mixed-effects model of degree 1
model <- fit_model(data = filter_train, type = "exponential", degree = 1)

# Predict the remaining useful life (RUL) for the test units,
# assuming a fixed failure threshold D = 600
predict_rul(data = filter_test, model = model, D = 600)

Run the code above in your browser using DataLab