# A Robust Conformal Framework for IoT-Based Predictive Maintenance
## 3 CI Estimation in Predictive Maintenance
### Prophet  
Prophet is an open-source forecasting tool developed by Facebook (now Meta) for time series data [31], designed to be easy to use, interpretable, and capable of handling common time series patterns such as trends, seasonality, and holidays. Principally, Prophet falls under the umbrella of the probabilistic paradigm, leveraging Bayesian posterior inference to estimate uncertainty in the forecast, not requiring forcing the time series into a stationary state (e.g., integrating the lags) and well-handling missingness and noise in the data. The time series for a piecewise linear multiplicative \(y(t)\) prophet model can be shown in Equation (7):  
\[y(t)=1*(g(t)*s(t)*h(t))+\epsilon(t) \tag{7}\]  
where \(\epsilon(t)\) is the error term, and \(g(t)\), \(s(t)\), and \(h(t)\) represent the trend, seasonal, and holiday terms.  
* **Trend component:*
* The trend component is denoted as \(g(t)\), which represents the non-periodic and long-term changes in the value of a time series. It captures the underlying pattern or direction of the data over time, excluding short-term fluctuations or seasonal variations. A piecewise linear function is a common approach to modeling \(g(t)\), which estimates the trend as a series of connected linear segments. The mathematical formulation for \(g(t)\) is presented through Equation (8): \[g(t)=(k+\mathbf{a}(t)^{T}\boldsymbol{\delta})t+(m+\mathbf{a}(t)^{T} \boldsymbol{\gamma})\] (8) where the following is true:
* \(k\): initial growth rate;
* \(\boldsymbol{\delta}\): vector of rate adjustments at changepoints;
* \(\mathbf{a}(t)\): indicator vector for changepoints;
* \(m\): offset parameter;
* \(\boldsymbol{\gamma}\): vector of offset adjustments at changepoints, defined as \(\gamma_{j}=s_{j}\hat{g}_{j}\).
* **Seasonal component:*
* The function \(s(t)\) represents the seasonal component. It captures the seasonal effects in the data, such as daily, weekly, or yearly patterns. \(s(t)\) uses a Fourier series to model these seasonal effects, a mathematical tool that decomposes periodic functions into a sum of sine and cosine terms. For seasonality modeling, the Fourier series is defined as in Equation (9). \[s(t)=\sum_{n=1}^{N}\left(a_{n}\cos\left(\frac{2\pi nt}{P}\right)+b_{n}\sin \left(\frac{2\pi nt}{P}\right)\right)\] (9) where the following is true:
* \(N\) is the order of the Fourier series;
* \(P\) is the period of the seasonality;
* \(a_{n}\) and \(b_{n}\) are coefficients;
* \(t\) is the time variable.
* **Holidays component:** The holiday component, denoted by \(h(t)\). It models the effects of holidays or special events on the time series. Unlike regular seasonality, holidaysoften occur on irregular schedules and can significantly impact the data. To account for these effects, [PERSON] uses binary variables to indicate whether a given time point \(t\) falls on a holiday. Each holiday \(i\) is assigned a coefficient \(\kappa_{i}\), quantifying its impact on the time series. The overall holidays component is then calculated as the sum of these effects for all relevant holidays. The mathematical expression for \(h(t)\) is provided in the Equation (10).  
\[h(t)=\sum_{i}\kappa_{i}\cdot\mathbb{I}(t\in\mathrm{holiday}_{i}) \tag{10}\]  
where the following is true:  
* \(h(t)\): holidays component at time \(t\);
* \(\kappa_{i}\): coefficient representing the impact of holiday \(i\);
* \(\mathbb{I}(t\in\mathrm{holiday}_{i})\): indicator function that equals 1 if \(t\) falls on holiday \(i\) and 0 otherwise.  
In Prophet, CI can be estimated using two primary approaches: Monte Carlo sampling and posterior predictive distributions. Monte Carlo sampling generates multiple future scenarios by randomly sampling from the model's parameters, while posterior predictive distributions directly simulate forecasts based on the fitted model's uncertainty. Then, these simulated forecasts are used to compute empirical percentiles (e.g., 95% CI corresponds to the 2.5 th and 97.5 th percentiles), which define the CI.