Main Content

plot

Plot survival function for covariate survival remaining useful life model

Description

plot(mdl) plots the baseline survival function of the fitted covariate survival model mdl against the life time value for which it was computed. The plot data is stored in the BaselineCumulativeHazard property of mdl.

example

plot(mdl,covariates) plots the survival function computed for the covariate data in covariates. To obtain the survival function, the hazard rate is computed using the covariates and combined with the baseline survival function.

example

Examples

collapse all

Load training data.

load('covariateData.mat')

This data contains battery discharge times and related covariate information. The covariate variables are:

  • Temperature

  • Load

  • Manufacturer

The manufacturer information is a categorical variable that must be encoded.

Create a covariate survival model.

mdl = covariateSurvivalModel;

Train the survival model using the training data, specifying the life time variable, data variables, and encoded variable. There is no censor variable for this training data.

fit(mdl,covariateData,"DischargeTime",["Temperature","Load","Manufacturer"],[],"Manufacturer")
Successful convergence: Norm of gradient less than OPTIONS.TolFun

Plot the baseline survival function for the model.

plot(mdl)

Figure contains an axes object. The axes object with title Survival Function Plot, xlabel Time, ylabel S(t) contains an object of type stair. This object represents Baseline Survival Function.

Load training data.

load('covariateData.mat')

This data contains battery discharge times and related covariate information. The covariate variables are:

  • Temperature

  • Load

  • Manufacturer

The manufacturer information is a categorical variable that must be encoded.

Create a covariate survival model, and train it using the training data.

mdl = covariateSurvivalModel('LifeTimeVariable',"DischargeTime",'LifeTimeUnit',"hours",...
   'DataVariables',["Temperature","Load","Manufacturer"],'EncodedVariables',"Manufacturer");
fit(mdl,covariateData)
Successful convergence: Norm of gradient less than OPTIONS.TolFun

Suppose you have a battery pack manufactured by maker B that has run for 30 hours. Create a test data table that contains the usage time, DischargeTime, and the measured ambient temperature, TestAmbientTemperature, and current drawn, TestBatteryLoad.

TestBatteryLoad = 25;
TestAmbientTemperature = 60; 
DischargeTime = hours(30);
TestData = timetable(TestAmbientTemperature,TestBatteryLoad,"B",'RowTimes',hours(30));
TestData.Properties.VariableNames = {'Temperature','Load','Manufacturer'};
TestData.Properties.DimensionNames{1} = 'DischargeTime';

Predict the RUL for the battery.

estRUL = predictRUL(mdl,TestData)
estRUL = duration
   38.332 hr

Plot the survival function for the covariate data of the battery.

plot(mdl,TestData)

Figure contains an axes object. The axes object with title Survival Function Plot, xlabel Time, ylabel S(t) contains 2 objects of type stair. These objects represent Baseline Survival Function, Current Survival Function.

Input Arguments

collapse all

Covariate survival RUL model, specified as a covariateSurvivalModel object.

plot plots the data in the BaselineCumulativeHazard property of mdl, which is a two-column array. The second column contains the baseline survival functions values, and the first column contains the corresponding life time values. The life time values are plotted in the units specified by the LifeTimeUnits property of mdl.

Current covariate values for the component, specified as a:

  • Row vector whose elements specify the component covariate values only and not the life time values. The number of covariate values must match the number and order of the covariate data columns used when estimating mdl using fit.

  • table or timetable with one row. The table must contain the variables specified in the DataVariables property of mdl.

If the covariate data contains encoded variables, then you must specify covariates using a table or timetable.

To obtain the survival function, the hazard rate is computed using the covariates and combined with the baseline survival function. For more information, see Cox Proportional Hazards Model.

Version History

Introduced in R2018a