Predicting failures of a part using historical failure data Suppose I want to forecast the number of failures of part $A$ operating in my system. In my repertoire, I have historical failure numbers for part $A$ as well as the number of units of part $A$ that were operating in the system when the part failed. The objective is to forecast failures from this historical data and determine what year inventory for part $A$ will be fully depleted. We assume that one failure depletes one unit of inventory.
Data example:




Years
Failures
In Service




2017
100
2000


2018
200
3000


2019
150
2500


2020
250
3300




One challenge of the data is that the in service number changes over time. For some years, fewer parts may be operating in the system than other years. Furthermore, failures for part $A$ are not necessarily linear. Current analysis simply takes an average of the last three years, e.g. $(200 + 150 + 250)/3 = 200$, and repeats this number in future forecasts (e.g. for 2021 we assume $200$ failures, in 2022 we assume $200$ failures, etc..) for parts that do not behavior linearly and fitting a simple linear regression line on parts where the failure history does behave linearly to estimate a "failure growth rate", which corresponds to the slope of this line.
I wish to enhance this analysis by incorporating the changing in service numbers and providing actual robust models for nonlinear historical failure data. The straightforward method seems to be to weigh the yearly historical failure numbers by the number of units in service that year, and then running a prediction model on this data (using all the tools in a data scientist's toolkit).
However, I am concerned with what happens to the in service number once part failures are replaced by newer parts. If failed parts are being replaced by newer parts, then does this not completely invalidate the trained prediction model since the newer parts won't necessarily follow the same distribution of the older parts with historical data? If this is the case, then is it even useful to use historical data of failures over theoretical approaches for forecasting future failures?

This sounds like a Poisson or negative binomial process.  You could model this using a generalized linear model accounting for the exposure of each part.  Newly added parts would have shorter exposure, older parts would have longer exposure.  To investigate a time trend you could include time as a factor in the model.  This could be performed in SAS Proc Genmod.  Here is a link to a paper on constructing prediction intervals for future observations based on historical data in non-normal models such as Poisson and negative binomial.
Johnson, G.S. (2021). Tolerance and Prediction Intervals for Non-normal Models. Researchgate.net.
