# Patent

## Title
Inventory early warning agent with correction by error correlation calculation

## Abstract

An inventory agent operating on software includes instructions operable to cause a programmable processor to receive inventory data relating to stock in an inventory. The inventory data includes planned inventory data and actual inventory data. The instructions are operable to cause the programmable processor to use the inventory data to calculate one or more correlations in errors between the planned inventory data and the actual inventory data, use the one or more correlations in errors to estimate a probability density for one or more errors, calculate a predicted inventory level, calculate a likely error of the predicted inventory level using the estimate of the probability density, and adjust the predicted inventory level with the likely error to estimate a likely actual inventory level. The inventory agent may be implemented in a supply chain management system.

## Background
RELATED APPLICATIONS
This application claims priority based on U.S. Provisional Application Ser. No. 60/336,227, filed Nov. 14, 2001, for SCM Supply Network Planning, and U.S. Provisional Application Ser. No. 60/384,638, filed May 31, 2002, for Inventory Early Warning Agent, the disclosures of which applications are incorporated here by reference in their entirety.


TECHNICAL FIELD
This invention relates to agents, and more particularly to an inventory early warning agent used in a supply chain management system.
BACKGROUND
Today's companies need to adapt to many competitive pressures. For example, financial markets are increasingly demanding that companies use capital more efficiently; other businesses are seeking global playing fields to maintain growth and diversify risk; customers are demanding service as markets of one and forcing companies toward mass customization; and innovation cycles are continually accelerating.
These pressures on businesses are driving changes that have enormous implications for supply networks. For some companies, shrinking capital availability is forcing companies to streamline manufacturing and supply operations and build efficiencies, which are critical to the supply network. For other companies, information ubiquity is driving and facilitating globalization, which shrinks distances to markets and resources. The information ubiquity also requires levels of supply network visibility and collaboration that were not essential in traditional supply chains. Customers are armed with information about the real value of products, which is shrinking customer loyalty and requiring customer-service levels too expensive for companies that are unable to manage supply chain efficiencies. Finally, shrinkages in the time available to build and launch products are forcing companies to innovate at velocities far greater than before.
Ultimately, competitive pressures push profit margins lower. Product manufacturers must find ways to improve efficiency, thereby reducing costs, to survive in highly competitive markets. Supply chain efficiency plays a key role in improving margins and can be a determining factor in the success of manufacturers.
A supply chain is a network of facilities and distribution options that performs the functions of procuring materials, transforming the materials into semi-finished and finished products, and distributing the finished products to customers. Supply chain management (“SCM”) is a business policy that aims to improve all activities along the supply chain. SCM results in improved integration and visibility within individual companies, as well as flexibility across supply and demand environments. As a result, a company's competitive position is greatly enhanced by building supply networks that are more responsive than the current sequential supply chains.
SAP AG and SAP America, Inc. provide SCM solutions for product manufacturers to help them reach their goals. Some of the SCM solutions are based on the mySAP.com e-business platform. One of the building blocks of the e-business platform is the SAP R/3 component that provides enterprise resource planning functionality. The SAP R/3 product includes a Web Application Server (“Web AS”), an R/3 core, and various R/3 extensions. The SCM Extensions of R/3 provide various planning, coordination, execution, and optimization solutions that are associated with a supply chain.
SUMMARY
In one general aspect, an inventory agent operating on software includes instructions operable to cause a programmable processor to receive inventory data relating to stock in an inventory. The inventory data includes planned inventory data and actual inventory data. The instructions are operable to cause the programmable processor to use the inventory data to calculate one or more correlations in errors between the planned inventory data and the actual inventory data, use the one or more correlations in errors to estimate a probability density for one or more errors, calculate a predicted inventory level, calculate a likely error of the predicted inventory level using the estimate of the probability density, and adjust the predicted inventory level with the likely error to estimate a likely actual inventory level.
Embodiments of the inventory agent may include one or more of the following features. For example, the inventory agent may further include instructions for defining confidence intervals around the likely actual inventory level. The confidence intervals may include a high bound and a low bound. The probability density may be the midpoint of the confidence intervals.
The inventory agent may be implemented in a supply chain management system. The inventory agent may further include instructions to calculate an upside 10% confidence bound and a downside 10% confidence bound. The inventory agent may still further include instructions to use the calculated upside 10% confidence bound and the downside 10% confidence bound in determining whether to order additional stock for the inventory.
The instructions to calculate a predicted inventory level may further include processing the inventory data with a conditional probabilistic predictive statistical algorithm. The statistical algorithm may use a conditional probabilistic model to process the data. The conditional probabilistic model may use a conditional Gaussian approximation. The conditional probabilistic model may use historical inventory data and current inventory data. The inventory data applied to the conditional probabilistic predictive statistical algorithm may include actual cumulative replenishment, forecast cumulative replenishment, actual cumulative consumption, and forecast cumulative consumption data.
The inventory agent may further include instructions for using the likely actual inventory level to determine whether to order additional stock for inventory. The inventory agent may further include instructions operable to cause the inventory agent to order a replenishment of the inventory.
The inventory data may be generated using a radio-frequency identification device, upon the sale of the stock in the inventory, and/or upon the transfer of the stock in the inventory.
The inventory agent may further include instructions operable to record data related to inventory consumption and replenishment. The inventory agent may still further include instructions operable to use the recorded data to calculate cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment. The inventory agent may still further include instructions operable to use the recorded data to calculate a second planned inventory and a second actual inventory. The inventory agent may further include instructions operable to use the inventory data to calculate one or more correlations in errors between the second planned inventory data and the second actual inventory data; and use the one or more correlations in errors to estimate a second probability density for one or more errors.
The inventory agent may still further include instructions operable to use the inventory data with the calculated cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment to calculate a second predicted inventory level, calculate a second predicted inventory level, calculate a likely error of the second predicted inventory level using the estimate of the probability density, and adjust the second predicted inventory level with the likely error to estimate a second likely actual inventory level.
The instructions to calculate a second predicted inventory level further include instructions for processing the inventory data with a conditional probabilistic predictive statistical algorithm. The statistical algorithm may use a conditional probabilistic model to process the data.
In another general aspect, a system includes one or more computer systems and an inventory agent computer coupled to the computer systems over a network. The inventory agent computer is operable to receive inventory data relating to stock in an inventory. The data includes planned inventory data and actual inventory data. The inventory agent computer is operable to use the inventory data to calculate one or more correlations in errors between the planned inventory data and the actual inventory data; use the one or more correlations to estimate a probability density for one or more errors; calculate a predicted inventory level; calculate a likely error of the predicted inventory level using the estimate of the probability density; and adjust the predicted inventory level with the likely error to estimate a likely actual inventory level.
Embodiments of the system may include one or more of the following features. For example, the system may further include instructions for defining confidence intervals around the likely actual inventory level. The confidence intervals may include a high bound and a low bound. The probability density may be the midpoint of the confidence intervals.
The system may be implemented in a supply chain management system. The inventory agent computer may further include instructions to calculate an upside 10% confidence bound and a downside 10% confidence bound. The inventory agent computer may still further include instructions to use the calculated upside 10% confidence bound and the downside 10% confidence bound in determining whether to order additional stock for the inventory.
The instructions to calculate a predicted inventory level may further include processing the inventory data with a conditional probabilistic predictive statistical algorithm. The statistical algorithm may use a conditional probabilistic model to process the data. The conditional probabilistic model may use a conditional Gaussian approximation. The conditional probabilistic model may use historical inventory data and current inventory data. The inventory data applied to the conditional probabilistic predictive statistical algorithm may include actual cumulative replenishment, forecast cumulative replenishment, actual cumulative consumption, and forecast cumulative consumption data.
The inventory agent computer may further include instructions for using the likely actual inventory level to determine whether to order additional stock for inventory. The inventory agent computer may further include instructions operable to cause the inventory agent computer to order a replenishment of the inventory.
The inventory data may be generated using a radio-frequency identification device, upon the sale of the stock in the inventory, and/or upon the transfer of the stock in the inventory.
The inventory agent computer may further include instructions operable to record data related to inventory consumption and replenishment. The inventory agent computer may still further include instructions operable to use the recorded data to calculate cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment. The inventory agent computer may still further include instructions operable to use the recorded data to calculate a second planned inventory and a second actual inventory. The inventory agent computer may further include instructions operable to use the inventory data to calculate one or more correlations in errors between the second planned inventory data and the second actual inventory data; and use the one or more correlations in errors to estimate a second probability density for one or more errors.
The inventory agent computer may still further include instructions operable to use the inventory data with the calculated cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment to calculate a second predicted inventory level, calculate a second predicted inventory level, calculate a likely error of the second predicted inventory level using the estimate of the probability density, and adjust the second predicted inventory level with the likely error to estimate a second likely actual inventory level.
The instructions to calculate a second predicted inventory level further include instructions for processing the inventory data with a conditional probabilistic predictive statistical algorithm. The statistical algorithm may use a conditional probabilistic model to process the data.
The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the invention will be apparent from the description, the drawings, and the claims.



DESCRIPTION OF DRAWINGS
FIG. 1 is a plan view of an inventory early warning agent application to a shelf level monitoring system.
FIG. 2 is a plan view of an agent framework architecture that includes three agents.
FIG. 3 is a plan view of a directory service of an agent community that includes three agent frameworks.
FIG. 4 is a plan view of the messaging architecture of the agent community of FIG. 3.
FIG. 5 is a plan view of a communication sequence between a pair of agents.
FIG. 6 is a graph illustrating cumulative inventory variables over time.
FIG. 7 is a flow chart illustrating the operation of an IEWA to predict an inventory level.



Like reference symbols in the various drawings indicate like elements.
DETAILED DESCRIPTION
An agent is an active program that performs some high-level business functions, such as monitoring the inventory for a particular SKU for potential stock out situations and sending alerts when various thresholds are reached. For example, an agent can be programmed as an inventory early warning agent (“IEWA”) that monitors one or more inventories in a factory, warehouse, store, or shelf within a store. The IEWA is programmed to monitor the inventory based on real time data that is obtained, for example, from cash registers or radio-frequency identification devices that scan information relating to an item being purchased or transferred and use that information to update the IEWA as to the level of stock on a particular shelf.
As described in more detail below, the IEWA is a predictive and adaptive inventory management application that can be used to monitor and predict future inventory levels by modeling variability in both demand and supply related supply chain activities. The IEWA uses learning techniques that can estimate potential variation in inventory levels in the near future in order to identify potentially risky situations early enough to allow for corrective measures. To provide increased effectiveness the IEWA is operated with minimal human intervention, parameter adjustment, and manual calibration. These characteristics are achieved with machine-learning techniques to recognize patterns of behavior from historical data around consumption and replenishment and around the performance of resources and supply chain partners. The IEWA can use two types of modes of operation for its predictive function: in a first mode use the IEWA predictive models built from detailed activities; and in a second mode use the IEWA predictive models built from the aggregation of multiple activities.
In the detailed mode of operation, potential variation in inventory is estimated for each planned replenishment or consumption activity. For example, given historical performance data, the IEWA estimates whether a planned truckload of 12 ounce bottles of Bob's bottles will arrive any time within four hours prior to and six hours after the planned delivery time with a quantity that is between 95% and 100% of the requested quantity. A second stage of processing then combines the estimates of potential variation for individual activities into an estimate of the potential variation of the projected inventory levels.
In the aggregate mode of operation, potential variation of the projected inventory level is estimated directly from projected cumulative replenishment and consumption. This estimate is calculated as the aggregation of replenishment and consumption activities.
Both modes of operation provide advantages. For example, the detailed mode of operation is advantageous when low volumes of detailed data are available and when the degree of variation in activities is highly dependent on the particular resource or partner involved. The aggregate mode of operation is advantageous when it is necessary to deal with high volumes of data, or when it is difficult to track the outcome of any particular planned activity. Although either mode of operation can be applied to the IEWA, only the aggregate model is discussed in detail below.
Referring to FIG. 1, a store 100 may want to have a minimum quantity of items 105 on a shelf 110 at any particular time such that the shelf can be stored with as large a variety of items as possible. For example, by limiting the quantity of a particular brand of tomato soup on a shelf at any particular time, a grocery store can display more brands of tomato soup on that shelf. To accomplish this type of shelving scenario, the store must carefully monitor the amount of stock on the shelf on a real time basis to prevent the shelf from emptying out. Currently, many stores use their employees to visually monitor empty space on the shelf and replenish the shelf when it looks empty. This is labor intensive and inexact. As illustrated in FIG. 1, the IEWA 115 receives shelf quantity data from a shelf-monitoring program 120 that, for example, monitors the quantity of a particular SKU number on the shelf. When an item 105 is scanned at the cash register, a database that contains the shelf location of the item is accessed and the program reduces the number of items on that shelf 110 by the number of items being purchased at that time. The IEWA 115 then uses algorithms to determine whether there is likely to be an undesirable variation in inventory and, if there will be one, when to send an order to replenish the shelf 110 with items of that particular SKU. When the quantity of items 105 on the shelf 110 reaches a certain level, the IEWA 115 sends a message to a planning module 125 along a first message path 130. The planning module 125 then sends return messages to the IEWA 115 along the first message path 130 and to the shelf-monitoring program 120 along a second message path 135. The shelf-monitoring program 120 then sends a return message to the planning module 125 along the second message path 135. The planning module 120 next sends a message to an execution module 140 along a message path 145. The planning module 125 and the execution module 140 may be components within a supply chain management application 150 or may be separate stand-alone components. After receiving the message from the planning module 125, the execution module 140 sends a first message to a manufacturing facility 155 along a message path 160 and a second message to a distributions center 165 along a message path 170. Based on this series of messages, the store is able to replenish its shelf with the item 105.
The IEWA 115 also can be used when the shelf is replenished. For example, when the shelf 105 is replenished, the shelf-monitoring program 120 sends a message to the execution module 140 along the message path 135, which sends a message to the distribution center 165 along the message path 170. These messages are used to update the distribution center of the amount of stock on the shelf 105. The distribution center can use the same IEWA or a separate IEWA to apply predictive models to the distribution center to estimate whether and when there will be an undesirable variation in inventory levels.
At another level, a store can use an IEWA to monitor the levels of an item on the shelf and in the inventory for one or more items to estimate potential undesirable variations in inventory levels. When items are sold, for example, by being scanned at a cash register, the IEWA takes that sales data and uses algorithms to determine whether there will be an undesirable variation in the inventory levels and when to send an order to replenish the shelf and/or order more of that item from a warehouse or distribution center.
At an even higher level, a warehouse or distribution center can use an IEWA to monitor the levels of an item within the warehouse, such as on shelves, on pallets, in quarantine, or at another location within the warehouse, to determine whether there will be an undesirable variation in the inventory levels and when to send an order to replenish. Customers of the warehouse, such as a retailer or a factory, order the item from the warehouse. For example, a consumer product goods (“CPG”) retailer may order a pallet load of an item which the warehouse operator loads onto a delivery truck of either the warehouse, the retailer, or a third party logistics supplier. When the pallet is loaded on the truck, the warehouse operator may use a wireless communications device to notify the inventory management software that a pallet-load of a particular item has been transferred from the warehouse. Either the wireless communications device or the inventory management software may be programmed to notify the IEWA that a pallet-load of the particular item has been transferred from the warehouse. The IEWA takes that transfer data and analyzes it using algorithms to determine whether there is likely to be an undesirable variation in inventory levels and when to order addition stock of that item. One example of a framework of the IEWAs, an example of a messaging system used by the IEWAs, and the algorithms used by the IEWAs are described in more detail below.
Referring to FIG. 2, an agent framework architecture 200 includes three agents 205, 210, 215, each of which communicates with an agent framework 217 that provides frameworks services: a message transport service (“MTS”) 220, a directory facilitator (“DF”) 225, an agent management service 230 (“AMS”), and a Post Office 235. The agents 205, 210, 215 may be IEWAs. The agent framework refers to the container that provides programmatic support for agents. In this context, an agent framework can be implemented in Java code that runs in a single virtual machine on a particular host. Additional services are used to support the agents running inside the framework. These additional services include life cycle management, directory services, communication, configuration, logging, persistence, and notification.
The MTS 220 is a service that is provided by a particular agent framework and allows agents to send messages, such as an AclMessage, to other agents. An AclMessage encapsulates a communication between two agents and has some characteristics in common with an email message, such as, for example, specifying a sender and recipient, having a subject, and providing message content.
The DF 225 is a service provided by a particular agent framework and provides the framework's agents with access to the central directory service. The directory service is a central service that provides identity (white page) and capability (yellow page) search facilities across an agent community. There is one directory service for one agent community. A directory service might be federated with the directory service for another agent community. An agent community is a collection of agent frameworks (and therefore agents) that collaborate to provide various business functions. A community may consist of several agent frameworks, and each framework may in turn contain several agents.
The AMS 230 is a service provided by a particular agent framework and provides agent lifecycle management facilities within the framework. The facilities allow remote management of a community of agent frameworks by essentially providing an external interface to the AMS in each agent framework. For example, the AMS allows administrators and control agents to manage the execution of other agents by stopping, starting and suspending agents. The agent framework architecture 200 also includes an administrative user interface (“AUI”) that allows a system administrator to manage an agent community. The AUI uses the directory service to identify currently running agent frameworks. It then uses each framework's AMS to manage the agents within that framework.
The post office 235 is a service provided by a particular agent framework. The post office 235 receives and maintains AclMessages addressed to the agents within that framework.
FIG. 3 illustrates the directory service 240 of an agent community 245 that includes three agent frameworks 217a, 217b, 217c, each of which runs on a separate host machine. The directory service 240 is a centralized service that is used to unify the agent community 245. The service can be implemented using the Java Naming and Directory Interface (“JDNI”). FIG. 3 shows only three agent frameworks 217a, 217b, 217c and, for simplicity, each agent framework contains only a single agent 205a, 205b, 205c, respectively. Nonetheless, the directory service can be implemented with more agent frameworks and each agent framework can include more agents.
The directory facilitator 225 (“DF”) in each agent framework 217 updates the directory service 240, registering new agents as they are started up and deregistering agents as they are shut down. The directory service 240 then allows agents to search for other agents, both by identity (e.g., using a service that is analogous to a white page service) and capability (e.g., using a service that is analogous to a yellow page service). The DF 225 provides access to this functionality within each agent framework 217.
FIG. 4 illustrates the messaging architecture of the agent community 245. If the agent 205a requires the type of service provided by the agent 205b, it uses its DF function 225a to perform a capability directory lookup. The DF 225a informs the agent 205a that the agent 205b is capable of the type of service that it desires. The agent 205a then formulates an AclMessage and asks its local MTS 220a to deliver that message. The MTS 220a uses the DF 225a to locate the Post Office 235b for the agent 205b, and delivers the message to that Post Office 235b. The messaging architecture can be implemented using Java's Remote Method Invocation (“RMI”) to deliver the message to the Post Office 235b. By providing flexibility in the design of the framework 217, the architecture can be implemented using other message transport mechanisms in the MTS, such as SOAP, JMS, CORBA, and JINI.
FIG. 5 illustrates a communication sequence for a typical communication scenario 300 that is indicative of the type of interactions that occur within the agent community 245. For example, the agent 205a can be implemented as an inventory early warning agent that is used to monitor the level of inventory on a shelf or within a store or a warehouse, process the inventory information, determine whether to replenish the inventory, and communicate a request to replenish the inventory. The agent 205a can receive inventory data from, for example, a computer system that receives sales data from a cash register scanning system. The agent 205a accumulates the sales data and processes the data continuously, periodically, or in a batch mode. As described in greater detail below, the agent 205a also must analyze the data and determine whether to request a replenishment of the inventory. The analysis can be as simple as a comparison of the amount of stock remaining to a threshold value or as complex as a statistical analysis of the likelihood that the stock will be emptied if the stock is not replenished within a set time. The scenario of FIG. 5 assumes that the agent 205a has determined that additional stock is required and will contact the agent 205b to deliver a replenishment request in a message. The agent 205b can be, for example, an agent used at a manufacturer or warehouse to communicate inventory levels to agents at stores that are served by the manufacturer or warehouse.
In the scenario of FIG. 5, the agent 205a wishes to send a message to agent 205b. The diagram shows the sequence of messages between participating objects to accomplish this scenario. First the agent 205a invokes a search Directory method 305, which is processed by the DF 205 and the result is returned to the agent 205a in a message 307. The agent 205a creates an AclMessage 310, retrieves the identification of agent 205b from the search result, sets the identification in the message's recipient field, and invokes a sendAclMessage 310. The sendAclMessage 310 is processed by the message transport service 220a (“MTS”), which communicates with the DF 225a in a findPostOffice communication 315 to find the Post Office address 320 for the agent 205b. The Post Office address 320 is communicated to the MTS 220a, which then delivers a message 325 to that Post Office 235b. The agent 205b queries the Post Office 235b in a query 327 and then uses a retrieval 329 to retrieve the message from the Post Office 235b for processing. The Post Office 235b also sends an acknowledgement communication 330 to the MTS 220a, which sends a communication 335 to the agent 205a. Like the agent 205a, the agent 205b can use an analytical method to determine whether to tell either the manufacturer to build more product or the warehouse to ship more product.
As described briefly above, the agents 205 may perform analysis of the inventory data that they receive to determine if there is likely to be a potential variation in inventory levels and, if so, when to request a replenishment of the inventory from a warehouse or the production of goods by a manufacturer to replenish the inventory in a warehouse or at a store. The analysis may be a simple process involving the comparison of inventory on the shelf or in a warehouse to a threshold value. If the inventory level is above the threshold value, the agent does not request replenishment but if the inventory level is at or below the threshold value the agent requests replenishment. Such an analysis does not take into account the likelihood that the stock on the shelf or in the warehouse will be sold quickly or slowly or that there may be some variability in the rate at which the stock is sold. Moreover, such an analysis does not take into account the likelihood that the warehouse or manufacturer will have sufficient stock on hand to supply the store, much less the likelihood that the warehouse or manufacturer can make a timely delivery. To ensure that the store, warehouse, or manufacturer has adequate quantities of stock to meet its needs while also minimizing excessive inventory levels, the agent 205 uses a conditional probabilistic predictive statistical analysis to predict an expected inventory level, an upside confidence bound, and a downside confidence bound. For many companies, an expected inventory level that is near or below zero is undesirable. The company can determine the minimum low level, compare the expected inventory level to the company's minimum low level, and order more stock if these expected levels are below the minimum low level.
Referring to FIG. 6, the input data for the conditional probabilistic predictive statistical analysis is forecast cumulative consumption, forecast cumulative replenishment, actual cumulative consumption, and actual cumulative replenishment. FIG. 6 illustrates these values over time. In particular, the input data for the analysis includes a time advance, an actual cumulative replenishment, a forecast cumulative replenishment, an actual cumulative consumption, and a forecast cumulative consumption. The time advance variable is the setting describing how far in advance the prediction is intended. For example, a company concerned about its inventory levels for the next week would set the time advance to be seven days into the future. The actual cumulative replenishment variable describes the total amount of new material actually received into inventory up until the time advance is reached. The forecast cumulative replenishment describes the total amount of new material activities expected to be received into inventory up until the time advance is reached. The actual cumulative consumption describes the total amount of material actually withdrawn from inventory up until the time advance is reached. The forecast cumulative consumption describes the total amount of material expected to be withdrawn from inventory up until the time advance is reached. Of the predicted output values, the expected inventory level is the expected inventory level for the given time advance. The upside 10% confidence bound is the inventory value that the inventory level has a 10% chance of exceeding. The downside 10% confidence bound is the inventory value that the inventory level has a 10% chance of being below.
Any suitable statistical method can be used to determine the inventory level and confidence bounds. For example, the statistical analysis used by the agent 205 can be implemented with a predictive statistical model that can predict the variability at any point along the planned inventory trajectory, can be started with very little historical inventory data, and that improves as the data is generated over time. The plot of planned and actual inventory trajectories illustrated in FIG. 6 creates a number of records for training the predictive model: one for each time point in the plot. As such, such a dataset will only be complete when the data has been actually generated right up until the end of the plot.
One such statistical model that can be used is a probabilistic inference model based on a conditional Gaussian approximation. This model, its derivation, and its application to the inventory early warning agent are explained in more detail below.
To derive the model used for explanation purposes, there is an assumption of a known, planned forecast for inventory levels over time. The planned forecast is a piecewise constant function specified by its breakpoints. As illustrated in FIG. 6, the historical data is a record of planned and actual inventory levels over time. This data is generated as follows. Initially, at any given point in time, for example, day one, there is a forecast for consumption and replenishment for the next τ time periods and thus a forecast for the actual inventory levels out to time τ. Along with this predicted consumption there is assumed to be a planned replenishment resulting in planned inventory levels out τ time periods into the future. The next day a new forecast is generated for consumption and replenishment out to time τ+1 resulting in another planned inventory. Using this historical data, D, the model is based on determining the density P(I|D), where I is the vector of actual inventory levels at q predefined times [I(t1) K I(tq)]T in the future.
To actually develop a prediction algorithm, assume that inventory level plans are generated in regular fixed intervals, Δ (e.g., every day at midnight), and set the origin of time to be the time at which there is the earliest historical plan in the dataset. This origin of time may be recent and provide a very limited number of data points. Thus, plans are generated at times nΔ for n ∈Z+, where n is the index of the most recent planning period. Further, assume that all plans are generated out to a horizon of τ(>Δ) and indicate the inventory levels of plans generated at time nΔ by Inp(nΔ+δ), where 0≦δ≦τ is a continuous quantity. Because plans are generated at midnight, δ=0 in the future. This inventory plan is piecewise constant and specified by its breakpoints (Inp(b),δnp(b)) for δnp(b)≧0 and b∈[1,K,Bn] where Bnp is the number of breakpoints defining the nth plan. For conciseness define Inp(·) and δnp(·) to be the Bnp vectors with components [Inp(b)K Inp(Bnp)]T and [δnp(b)K δnp(Bnp)]T. Furthermore, let Ia (t) be the actual inventory at time t>0. The inventory is not measured at all times, but can be interpolated from a piecewise constant function. The breakpoints defining the actual inventory are given by (Ia(b), ta(b)) for b∈[1,Ba] where Ba  is the number of breakpoints defining the actual inventory and all t(b)≧0. Ia(·) and ta(·)$ are the Ba  vectors [Ia (b)K Ia(Ba)]T and [ta (b)K ta (Ba)]T, respectively.
Based on the definitions above, for any time t there are a number of plans that predict the inventory at that time. For example, the most recent plan was formed at s=└t/Δ┘ and the oldest plan was generated at s=└(t−τ)/Δ┘ where s=quantity of stock ordered at the beginning of the period t. If t=mΔ+δ with 0≦δ≦τ the most recent plan was formed at s(m,δ)=└m+δ/Δ┘ and the oldest plan was formed at s(m,δ)=└m−(τ−δ)/Δ┘ where m=the model stock quantity, e.g., the company-specified desirable amount of stock on the shelf or in the warehouse. The number of plans forecasting any particular time is always ┌τ/Δ┐ but the number of plans generated for time mΔ+δ at or before mΔ is s(δ)=┌(τ−δ)/Δ┐.
Based on the above notation it is straightforward to develop or build the model and specify the data from which to build the model. Specifically, if n is the index of the most recent planning period, the times at which the model must predict the inventory levels are given by tβ=nΔ−δβ. By defining the q vector δ≡[δ1,K,δq]T, the model can be used to determine P(I|n,δ,I2p(·1),δ2p(·1),Ia(·), ta (·)), where I2p(·1)=[I1p(·)L INp(·)]T and δ2p(·1)=[δ1p(·)L δNp(·)]T. To understand how the algorithm works it is helpful to understand how order streams are converted to the inventory levels that serve as the input to the aggregate predictor. Since the algorithm works entirely with inventory levels (whether planned or actual), consumption and replenishment order streams need to be converted into inventory levels. Conceptually, this is straightforward: replenishment orders increase the inventory while consumption orders decrease inventory. The only complication is that consumption and replenishment are only measured at certain times such that there is not data describing what happened to the inventory between those times at which the inventory was measured. Additionally, the times at which the measurements are taken may be irregularly spaced. Both of these problems are easily solved with a model of inventory levels between measurements.
The model of inventory levels is based on scenarios to which the inventory is actually subjected. As such, there are a variety of occurrences that might happen to the inventory levels between measurements. The simplest case is that the inventory was unchanging between measurements. This is termed the piecewise constant case since it is possible to interpolate inventory levels between measurements by using a piecewise constant function. Alternatively, if successive inventories are measured as (I1, t1) and (I2, t2) it is possible to linearly interpolate the inventory level at time t (where t1≦t≦t2) as I(t)=I1+(I2−I1)(t−t1)/(t2−t1). The model is based on the assumption of a piecewise constant rather than piecewise linear interpolation, although either choice or other interpolation mechanism is acceptable for data preparation since the algorithm is independent as to the choice. All the algorithm requires is that the inventory levels be measured at equally spaced intervals, Δ, and this can always be accomplished by interpolation by either method.
The particular approach used with the IEWA uses the essential idea of exploiting correlations in errors between planned inventories and the actual inventories themselves. These correlations are used to estimate a probability density for a number of errors and then condition this density on the available data at the time a prediction needs to be made to find the likely errors at the time of prediction. The most likely correction to the planned inventory can then be applied to estimate the most likely actual inventory. The full probability can be used to define confidence intervals around this most likely prediction. Examples of correlations in errors include seasonal errors in inventory, such as season changes in inventory related to holidays or other seasonal events.
The estimation of the actual inventories uses an estimation of the systematic errors made in the planning process. Consequently, the model uses an error function defined so that Ia (t)=Inp(t−nΔ)+ƒn(t−nΔ) where nΔ is the time at which the plan was generated and which must satisfy t−nΔ≦τ. For prediction into the future the model needs only an estimate of ƒn(t) since I(nΔ+δβ)=Ia (nΔ+δβ)=Imp((n−m)Δ+δβ)+ƒm((n−m)Δ+δβ) for all q choices of δ. In the model, fn is defined as fn=[ƒn(nΔ+δ1)L ƒn(nΔ+δq)]T, the vector of errors made by the n th plan as it forecasts the future. Knowing the probability density for fn is all that is needed since the density for Ia  simply shifts the mean.
The next step is to estimate P(fn) given the historical data by exploiting two types of correlations that likely exist in the data. First, the elements of fn are likely correlated because if inventory is high (or low) at time nΔ+δ1 then it is also likely to be high (or low) at the later time nΔ+δ2 so long as δ2 is not much greater than δ1. Moreover, it is reasonable to assume that the plans formed at subsequent planning periods will be correlated since the more recent plan is probably an update of an older plan. To capture such relationships in the historical data, the algorithm uses a model of the joint density P(fn,fn−1,L, fn−p). A reasonable choice of p is p=τ, although a good choice of p is that value determined by an autoregression algorithm. A suitable model for the joint density is that of a Gaussian joint density, as follows:




  
    
      
        
          P
          ⁡
          
            (
            
              f
              n
              %
            
            )
          
        
        =
        
          
            1
            
              
                
                  
                    (
                    
                      2
                      ⁢
                      
                        
                      
                      ⁢
                      π
                    
                    )
                  
                  
                    
                      (
                      
                        p
                        +
                        1
                      
                      )
                    
                    ⁢
                    q
                  
                
                ⁢
                det
                ⁢
                
                  
                
                ⁢
                
                  Σ
                  %
                
              
            
          
          ⁢
          
            exp
            ⁡
            
              [
              
                
                  -
                  
                    1
                    2
                  
                
                ⁢
                
                  
                    (
                    
                      
                        f
                        %
                      
                      -
                      
                        μ
                        %
                      
                    
                    )
                  
                  T
                
                ⁢
                
                  
                
                ⁢
                
                  
                    Σ
                    %1
                  
                  ⁡
                  
                    (
                    
                      
                        f
                        %
                      
                      -
                      
                        μ
                        %
                      
                    
                    )
                  
                
              
              ]
            
          
        
      
    
    
      
        (
        0.1
        )
      
    
  




where f is the vector of length (p+1)q given by f=[fnTfn−1TL fn−pT]T. As described in more detail below, this Gaussian model can be used for predicting inventory levels and calculating the mean and covariance.

If predicting forward from time nΔ, P(fn) gives the distribution over the possibilities from which it is possible to infer expected values and confidence intervals. In general, this is obtained from P( fn) by marginalizing over the previous errors fn−1, L, fn−p. However, the inventory situation is not this simple because it is desirable to condition the estimate on previously observed errors and not simply use a static estimate. In addition, many of the elements of the previous errors fn−i are for times greater than nΔ and consequently are unknown for the purposes of prediction. The unknown elements from fn−i are those for which (n−i)Δ+δa>nΔ or more simply those for which δa>iΔ.
As a solution, define




  
    f
    
      n
      -
      i
    
  
  =
  
    
      [
      
        
          
            (
            
              f
              
                n
                -
                i
              
              ≤
            
            )
          
          T
        
        ⁢
        
          
        
        ⁢
        
          
            (
            
              f
              
                n
                -
                i
              
              >
            
            )
          
          T
        
      
      ]
    
    T
  




where fn−1≦={fn−1|δα≦iΔ} and





  
    f
    
      n
      -
      i
    
    >
  
  =
  
    
      {
      
        
          f
          
            n
            -
            i
          
        
        |
        
          
            δ
            α
          
          >
          
            i
            ⁢
            
              
            
            ⁢
            Δ
          
        
      
      }
    
    .
  




The density that then must be determined from P( fn) is P(fn|fn−1≦,L,fn−p≦), which is easily determined by integration and an application of Bayes rule.

The first step is integrating to determine P(fn|fn−1≦L,fn−p≦), as illustrated below:

P(fn|fn−1≦,L,fn−p≦)=∫dƒn−122 L dƒn−p>P(fn,fn−1≦,fn−1>L,fn−p≦,fn−p>)  (0.2)

where P(fn,fn−1≦,fn−1>L,fn−p≦,fn−p>) is given by Eq. (0.1). The integration results in another Gaussian distribution with mean μ≦ and covariance Σ≦. If N> is a subset of {1,2,L, (p+1)q} giving the indices in fn of fn−1>,L,fn−p> and N≦={1,2,L, (p+1)q}\N> then

μ≦= μ(N≦) and Σ≦= Σ(N≦,N≦).  (0.3)

The notation a(Nr) indicates the |Nr|-vector formed from a by keeping the elements in the ordered index set Nr. The elements are ordered according to the order in N. Similarly A(Nr, Nc) is the |Nr|×|Nc| matrix formed from A by keeping the rows in Nr and the columns in Nc in their respective orders. This description uses the common notation that |S| gives the number of elements in the set or vector S.
Applying Bayes rule results in

P(fn|fn−1≦,L,fn−p≦)=P(fn,fn−1≦,L, fn−p≦)/∫P(fn,fn−1≦,L,fn−p≦)dfn.

A standard calculation yields this conditional probability as Gaussian having mean and covariance given by





  
    
      
        
          μ
          ⁡
          
            (
            
              f
              n
              
                %
                ≤
              
            
            )
          
        
        =
        
          
            
              μ
              1
            
            +
            
              
                Σ
                
                  1
                  ,
                  2
                
              
              ⁢
              
                
                  Σ
                  2
                  
                    -
                    1
                  
                
                ⁡
                
                  (
                  
                    
                      f
                      n
                      
                        %
                        ≤
                      
                    
                    -
                    
                      μ
                      2
                    
                  
                  )
                
              
              ⁢
              
                
              
              ⁢
              and
              ⁢
              
                
              
              ⁢
              
                Σ
                ⁡
                
                  (
                  
                    f
                    n
                    
                      %
                      ≤
                    
                  
                  )
                
              
            
          
          =
          
            
              Σ
              1
            
            -
            
              
                Σ
                
                  1
                  ,
                  2
                
              
              ⁢
              
                Σ
                2
                
                  -
                  1
                
              
              ⁢
              
                Σ
                
                  2
                  ,
                  1
                
              
            
          
        
      
    
    
      
        (
        0.4
        )
      
    
  




where fn=[(fn−1≦)T L (fn−p≦)T]T. The above formula assumes that Σ2 is invertible. In many situations this may not be the case (e.g., if the planned and actual activities are always in complete agreement). As such, Eq. (0.4) is modified to be:





  
    
      
        
          μ
          ⁡
          
            (
            
              f
              n
              
                %
                ≤
              
            
            )
          
        
        =
        
          
            
              μ
              1
            
            +
            
              
                
                  
                    Σ
                    
                      1
                      ,
                      2
                    
                  
                  ⁡
                  
                    (
                    
                      
                        Σ
                        2
                      
                      +
                      
                        λ
                        ⁢
                        
                          
                        
                        ⁢
                        I
                      
                    
                    )
                  
                
                
                  -
                  1
                
              
              ⁢
              
                (
                
                  
                    f
                    n
                    
                      %
                      ≤
                    
                  
                  -
                  
                    μ
                    2
                  
                
                )
              
              ⁢
              
                
              
              ⁢
              and
              ⁢
              
                
              
              ⁢
              
                Σ
                ⁡
                
                  (
                  
                    f
                    n
                    
                      %
                      ≤
                    
                  
                  )
                
              
            
          
          =
          
            
              Σ
              1
            
            -
            
              
                
                  
                    Σ
                    
                      1
                      ,
                      2
                    
                  
                  ⁡
                  
                    (
                    
                      
                        Σ
                        2
                      
                      +
                      
                        λ
                        ⁢
                        
                          
                        
                        ⁢
                        I
                      
                    
                    )
                  
                
                
                  -
                  1
                
              
              ⁢
              
                
              
              ⁢
              
                Σ
                
                  2
                  ,
                  1
                
              
            
          
        
      
    
    
      
        (
        0.5
        )
      
    
  




where I is the identity matrix having the same size as Σ2 and λ is a small positive quantity (e.g., 10−5). In Eq. (0.5) the μ vectors are given by

μ1=μ≦(N1), μ2=μ≦(N2)  (0.6)

and the Σ matrices are defined by

Σ1=Σ≦(N1,N1), Σ1,2=Σ≦(N1,N2), Σ2,1=Σ≦(N2,N1), and Σ2=Σ≦(N2,N2)  (0.7)

where the index sets are N1={1,2,L,q} and N2={q+1,q+2,L,| fn|+q}.

Using the above results, the complete algorithm can be used to make the prediction as follows: (1) assuming a value of p (or having the algorithm determine p), construct an estimate of μ and Σ from the historical data; (2) construct the index set N≦ and form μ≦ and Σ≦ from μ and Σ according to Eq. (0.3); (3) using historical error values construct the vectors of past errors fn−1≦,L,fn−p≦; (4) build μ( fn) and Σ( fn) according to Eqs. (0.5), (0.6) and (0.7); and (5) return




  
    
      [
      
        
          
            I
            p
          
          ⁡
          
            (
            
              
                n
                ⁢
                
                  
                
                ⁢
                Δ
              
              +
              
                δ
                1
              
            
            )
          
        
        ⁢
        L
        ⁢
        
          
        
        ⁢
        
          
            I
            p
          
          ⁡
          
            (
            
              
                n
                ⁢
                
                  
                
                ⁢
                Δ
              
              +
              
                δ
                q
              
            
            )
          
        
      
      ]
    
    T
  
  +
  
    μ
    ⁡
    
      (
      
        f
        n
        
          %
          ≤
        
      
      )
    
  




as the predicted actual inventory levels and return Σ( fn) as the covariance on this estimate.

The first two steps can be done offline in a discrete calculation since they have no dependence on the time for which the prediction is being made. To accomplish the first step and determine the parameters of the Gaussian, there a number of approaches or models that can be used. A first model is based on frequency counts while a second and a third method use an autoregressive model of the multivariate time series {f1}. The second and third models differ in the underlying simplifications made, with the second model being more accurate but more complex.
If there is sufficient historical inventory data, the simplest possible way to determine the parameters of the Gaussian is through unbiased frequency count estimates. From the historical record it is relatively easily to build up the following estimates:




  
    
      
        
          μ
          ^
        
        =
        
          
            
              
                
                  Σ
                  n
                
                ⁢
                
                  f
                  n
                  %
                
              
              
                
                  Σ
                  n
                
                ⁢
                1
              
            
            ⁢
            
              
            
            ⁢
            and
            ⁢
            
              
            
            ⁢
            
              Σ
              ^
            
          
          =
          
            
              
                
                  Σ
                  n
                
                ⁡
                
                  (
                  
                    
                      f
                      n
                      %
                    
                    -
                    
                      μ
                      ^
                    
                  
                  )
                
              
              ⁢
              
                
                  (
                  
                    
                      f
                      n
                      %
                    
                    -
                    
                      μ
                      ^
                    
                  
                  )
                
                T
              
            
            
              
                -
                1
              
              +
              
                
                  Σ
                  n
                
                ⁢
                1
              
            
          
        
      
    
    
      
        (
        0.8
        )
      
    
  




As additional inventory data is generated, these estimates are easily updated online. As such, the model is adaptive to and learns from changes in conditions.

Because subsequent plans are likely to be related to each other (e.g., the latter plan is probably a modification of the former plan) it is a reasonable assumption to model the time series {f1} as an autoregressive process of order p:




  
    
      
        
          f
          n
        
        =
        
          
            w
            p
          
          +
          
            ε
            n
          
          +
          
            
              ∑
              
                j
                =
                1
              
              p
            
            ⁢
            
              
                A
                j
                p
              
              ⁢
              
                f
                
                  n
                  -
                  j
                
              
            
          
        
      
    
    
      
        (
        0.9
        )
      
    
  




where the errors, εn, are modeled as i.i.d. zero-mean Gaussian variables described by N(0,Cp). There are many software packages which will efficiently estimate the parameters by maximizing the Gaussian likelihood (e.g., least squares) so the model uses the assumption that wp, Cp, and all A1p are all available. Some packages will attempt to determine the best value of p using a Bayesian information criterion. However, a natural choice in the present setting is p=τ. The proposed predictive algorithm makes use of a number of p.

This probability can be determined as follows:

P(fn,fn−1,L,fn−p)=P(fn|fn−1,L,fn−p)P(fn−1, L, fn−p) where





  
    P
    ⁡
    
      (
      
        
          
            f
            n
          
          |
          
            f
            
              n
              -
              1
            
          
        
        ,
        L
        ,
        
          f
          
            n
            -
            p
          
        
      
      )
    
  
  =
  
    
      1
      
        
          
            
              (
              
                2
                ⁢
                
                  
                
                ⁢
                π
              
              )
            
            τ
          
          ⁢
          
            
          
          ⁢
          det
          ⁢
          
            
          
          ⁢
          C
        
      
    
    ⁢
    
      
    
    ⁢
    
      exp
      ⁡
      
        [
        
          
            -
            
              1
              2
            
          
          ⁢
          
            
              (
              
                
                  f
                  n
                
                -
                
                  w
                  p
                
                -
                
                  
                    ∑
                    
                      j
                      =
                      1
                    
                    p
                  
                  ⁢
                  
                    
                      A
                      j
                      p
                    
                    ⁢
                    
                      f
                      
                        n
                        -
                        j
                      
                    
                  
                
              
              )
            
            T
          
          ⁢
          
            
          
          ⁢
          
            
              C
              p
              
                -
                1
              
            
            ⁡
            
              (
              
                
                  f
                  n
                
                -
                
                  w
                  p
                
                -
                
                  
                    ∑
                    
                      j
                      =
                      1
                    
                    p
                  
                  ⁢
                  
                    
                      A
                      j
                      p
                    
                    ⁢
                    
                      f
                      
                        n
                        -
                        j
                      
                    
                  
                
              
              )
            
          
        
        ]
      
    
  




The model uses a simplification in order to tractably model P(fn−1,L,fn−p), which can be written as




  
    P
    ⁡
    
      (
      
        
          f
          
            n
            -
            1
          
        
        ,
        L
        ,
        
          f
          
            n
            -
            p
          
        
      
      )
    
  
  =
  
    
      ∏
      
        j
        =
        1
      
      p
    
    ⁢
    
      
        P
        ⁡
        
          (
          
            f
            
              n
              -
              j
            
          
          )
        
      
      .
    
  




The remaining probability P(f) is assumed to be Gaussian, therefore, P(f)=exp[−(f−μ)TΣ(f−μ)/2]/√{square root over ((2π)τ detΣ)} where μ and Σ can be estimated by simple frequency counts from the historical data:





  
    
      
        μ
        =
        
          
            
              
                
                  Σ
                  n
                
                ⁢
                
                  f
                  n
                
              
              
                
                  Σ
                  n
                
                ⁢
                1
              
            
            ⁢
            
              
            
            ⁢
            and
            ⁢
            
              
            
            ⁢
            Σ
          
          =
          
            
              
                
                  Σ
                  n
                
                ⁡
                
                  (
                  
                    
                      f
                      n
                    
                    -
                    μ
                  
                  )
                
              
              ⁢
              
                
                  (
                  
                    
                      f
                      n
                    
                    -
                    μ
                  
                  )
                
                T
              
            
            
              
                -
                1
              
              +
              
                
                  Σ
                  n
                
                ⁢
                1
              
            
          
        
      
    
    
      
        (
        0.10
        )
      
    
  




The joint probability is then




  
    P
    ⁡
    
      (
      
        
          f
          n
        
        ,
        
          f
          
            n
            -
            1
          
        
        ,
        L
        ,
        
          f
          
            n
            -
            p
          
        
      
      )
    
  
  =
  
    
      1
      
        
          
            
              (
              
                2
                ⁢
                
                  
                
                ⁢
                π
              
              )
            
            
              
                (
                
                  p
                  +
                  1
                
                )
              
              ⁢
              q
            
          
          ⁢
          
            
          
          ⁢
          det
          ⁢
          
            
          
          ⁢
          
            Σ
            %
          
        
      
    
    ⁢
    
      
    
    ⁢
    
      exp
      ⁡
      
        [
        
          
            -
            
              1
              2
            
          
          ⁢
          
            
              (
              
                
                  f
                  %
                
                -
                
                  μ
                  %
                
              
              )
            
            T
          
          ⁢
          
            
          
          ⁢
          
            
              Σ
              
                %
                ⁢
                
                  
                
                -
                1
              
            
            ⁡
            
              (
              
                
                  f
                  %
                
                -
                
                  μ
                  %
                
              
              )
            
          
        
        ]
      
    
  




where





  
    f
    %
  
  =
  
    
      [
      
        
          f
          n
        
        ⁢
        
          
        
        ⁢
        
          f
          
            n
            -
            1
          
        
        ⁢
        
          
        
        ⁢
        L
        ⁢
        
          
        
        ⁢
        
          f
          
            n
            -
            p
          
        
      
      ]
    
    T
  




and the parameters of the Gaussian are




  
    
      μ
      %
    
    =
    
      
        Σ
        %
      
      ⁡
      
        [
        
          
            
              
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  w
                  p
                
              
            
          
          
            
              
                
                  
                    Σ
                    
                      -
                      1
                    
                  
                  ⁢
                  μ
                
                +
                
                  
                    
                      (
                      
                        A
                        1
                        p
                      
                      )
                    
                    T
                  
                  ⁢
                  
                    C
                    p
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    w
                    p
                  
                
              
            
          
          
            
              M
            
          
          
            
              
                
                  
                    Σ
                    
                      -
                      1
                    
                  
                  ⁢
                  μ
                
                +
                
                  
                    
                      (
                      
                        A
                        p
                        p
                      
                      )
                    
                    T
                  
                  ⁢
                  
                    C
                    p
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    w
                    p
                  
                
              
            
          
        
        ]
      
    
  




  and




  
    
      Σ
      
        %
        -
        1
      
    
    =
    
      
        [
        
          
            
              
                C
                p
                
                  -
                  1
                
              
            
            
              
                
                  -
                  
                    C
                    p
                    
                      -
                      1
                    
                  
                
                ⁢
                
                  A
                  1
                  p
                
              
            
            
              L
            
            
              
                
                  -
                  
                    C
                    p
                    
                      -
                      1
                    
                  
                
                ⁢
                
                  A
                  p
                  p
                
              
            
          
          
            
              
                
                  -
                  
                    
                      (
                      
                        A
                        1
                        p
                      
                      )
                    
                    T
                  
                
                ⁢
                
                  C
                  p
                  
                    -
                    1
                  
                
              
            
            
              
                
                  Σ
                  
                    -
                    1
                  
                
                +
                
                  
                    
                      (
                      
                        A
                        1
                        p
                      
                      )
                    
                    T
                  
                  ⁢
                  
                    C
                    p
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    A
                    1
                    p
                  
                
              
            
            
              L
            
            
              
                
                  
                    (
                    
                      A
                      1
                      p
                    
                    )
                  
                  T
                
                ⁢
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  p
                  p
                
              
            
          
          
            
              M
            
            
              M
            
            
              O
            
            
              M
            
          
          
            
              
                
                  -
                  
                    
                      (
                      
                        A
                        p
                        p
                      
                      )
                    
                    T
                  
                
                ⁢
                
                  C
                  p
                  
                    -
                    1
                  
                
              
            
            
              
                
                  -
                  
                    
                      (
                      
                        A
                        p
                        p
                      
                      )
                    
                    T
                  
                
                ⁢
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  1
                  p
                
              
            
            
              L
            
            
              
                
                  Σ
                  
                    -
                    1
                  
                
                +
                
                  
                    
                      (
                      
                        A
                        p
                        p
                      
                      )
                    
                    T
                  
                  ⁢
                  
                    C
                    p
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    A
                    p
                    p
                  
                
              
            
          
        
        ]
      
      .
    
  



Σ−1 can be inverted using the identity that if



  
    A
    =
    
      [
      
        
          
            
              
                V
                1
              
              ⁢
              
                V
                1
                T
              
            
          
          
            
              
                V
                1
              
              ⁢
              
                V
                2
                T
              
            
          
          
            L
          
          
            
              
                V
                1
              
              ⁢
              
                V
                p
                T
              
            
          
        
        
          
            
              
                V
                2
              
              ⁢
              
                V
                1
                T
              
            
          
          
            
              B
              +
              
                
                  V
                  2
                
                ⁢
                
                  V
                  2
                  T
                
              
            
          
          
            L
          
          
            
              
                V
                2
              
              ⁢
              
                V
                p
                T
              
            
          
        
        
          
            M
          
          
            M
          
          
            O
          
          
            M
          
        
        
          
            
              
                V
                p
              
              ⁢
              
                V
                1
                T
              
            
          
          
            
              
                V
                p
              
              ⁢
              
                V
                2
                T
              
            
          
          
            L
          
          
            
              B
              +
              
                
                  V
                  p
                
                ⁢
                
                  V
                  p
                  T
                
              
            
          
        
      
      ]
    
  




  then




  
    
      A
      
        -
        1
      
    
    =
    
      [
      
        
          
            
              
                
                  (
                  
                    V
                    1
                    T
                  
                  )
                
                
                  -
                  1
                
              
              ⁢
              
                (
                
                  I
                  +
                  
                    
                      V
                      2
                      T
                    
                    ⁢
                    
                      B
                      
                        -
                        1
                      
                    
                    ⁢
                    
                      V
                      2
                    
                  
                  +
                  L
                  +
                  
                    
                      V
                      p
                      T
                    
                    ⁢
                    
                      B
                      
                        -
                        1
                      
                    
                    ⁢
                    
                      V
                      p
                    
                  
                
                )
              
              ⁢
              
                V
                1
                
                  -
                  1
                
              
            
          
          
            
              
                -
                
                  
                    (
                    
                      V
                      1
                      T
                    
                    )
                  
                  
                    -
                    1
                  
                
              
              ⁢
              
                V
                2
                T
              
              ⁢
              
                B
                
                  -
                  1
                
              
            
          
          
            L
          
          
            
              
                -
                
                  
                    (
                    
                      V
                      1
                      T
                    
                    )
                  
                  
                    -
                    1
                  
                
              
              ⁢
              
                V
                p
                T
              
              ⁢
              
                B
                
                  -
                  1
                
              
            
          
        
        
          
            
              
                B
                
                  -
                  1
                
              
              ⁢
              
                V
                2
              
              ⁢
              
                V
                1
                
                  -
                  1
                
              
            
          
          
            
              B
              
                -
                1
              
            
          
          
            L
          
          
            0
          
        
        
          
            M
          
          
            M
          
          
            O
          
          
            M
          
        
        
          
            
              
                B
                
                  -
                  1
                
              
              ⁢
              
                V
                p
              
              ⁢
              
                V
                1
                
                  -
                  1
                
              
            
          
          
            0
          
          
            L
          
          
            
              B
              
                -
                1
              
            
          
        
      
      ]
    
  



In the present case take B=Σ−1, V1=−Cp−1/2, and Vi=AiTCp−1/2 for i∈[2,L, p] where Cp−1/2 is the Cholesky decomposition of C−1 to find




  
    Σ
    %
  
  =
  
    [
    
      
        
          
            
              C
              p
            
            +
            
              
                A
                1
                p
              
              ⁢
              
                
                  Σ
                  ⁡
                  
                    (
                    
                      A
                      1
                      p
                    
                    )
                  
                
                T
              
            
            +
            L
            +
            
              
                A
                p
                p
              
              ⁢
              
                
                  Σ
                  ⁡
                  
                    (
                    
                      A
                      p
                      p
                    
                    )
                  
                
                T
              
            
          
        
        
          
            
              A
              1
              p
            
            ⁢
            Σ
          
        
        
          L
        
        
          
            
              A
              p
              p
            
            ⁢
            Σ
          
        
      
      
        
          
            
              Σ
              ⁡
              
                (
                
                  A
                  1
                  p
                
                )
              
            
            T
          
        
        
          Σ
        
        
          L
        
        
          0
        
      
      
        
          M
        
        
          M
        
        
          O
        
        
          M
        
      
      
        
          
            
              Σ
              ⁡
              
                (
                
                  A
                  p
                  p
                
                )
              
            
            T
          
        
        
          0
        
        
          L
        
        
          Σ
        
      
    
    ]
  




and, by multiplying, the mean is found to be:





  
    μ
    %
  
  =
  
    
      [
      
        
          
            
              
                w
                p
              
              +
              
                
                  (
                  
                    
                      A
                      1
                      p
                    
                    +
                    L
                    +
                    
                      A
                      p
                      p
                    
                  
                  )
                
                ⁢
                μ
              
              +
              
                
                  (
                  
                    
                      
                        A
                        1
                        p
                      
                      ⁢
                      
                        
                          Σ
                          ⁡
                          
                            (
                            
                              A
                              1
                              p
                            
                            )
                          
                        
                        T
                      
                    
                    +
                    L
                    +
                    
                      
                        A
                        p
                        p
                      
                      ⁢
                      
                        
                          Σ
                          ⁡
                          
                            (
                            
                              A
                              p
                              p
                            
                            )
                          
                        
                        T
                      
                    
                  
                  )
                
                ⁢
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  w
                  p
                
              
            
          
        
        
          
            μ
          
        
        
          
            M
          
        
        
          
            μ
          
        
      
      ]
    
    ⁢
    
      
    
    .
  




As noted above, P(fn−1,L,fn−p) was simplified to the form




  
    ∏
    
      j
      =
      1
    
    p
  
  ⁢
  
    
      P
      (
      
        f
        
          n
          -
          j
        
      
      )
    
    .
  




This can be improved by writing





  
    
      
        
          P
          ⁡
          
            (
            
              
                f
                
                  n
                  -
                  1
                
              
              ,
              L
              ,
              
                f
                
                  n
                  -
                  p
                
              
            
            )
          
        
        =
      
    
  
  
    
      
        
          
        
        ⁢
        
          
            
              P
              ⁡
              
                (
                
                  
                    
                      f
                      
                        n
                        -
                        1
                      
                    
                    |
                    
                      f
                      
                        n
                        -
                        2
                      
                    
                  
                  ,
                  L
                  ,
                  
                    f
                    
                      n
                      -
                      p
                    
                  
                
                )
              
            
            
              
                
                  1
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  2
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  43
                
                ⁢
                
                  
                
              
              
                AR
                ⁡
                
                  (
                  
                    p
                    -
                    1
                  
                  )
                
              
            
          
          ⁢
          
            
          
          ⁢
          
            
              P
              ⁡
              
                (
                
                  
                    
                      f
                      
                        n
                        -
                        2
                      
                    
                    |
                    
                      f
                      
                        n
                        -
                        3
                      
                    
                  
                  ,
                  L
                  ,
                  
                    f
                    
                      n
                      -
                      p
                    
                  
                
                )
              
            
            
              
                
                  1
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  2
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  43
                
                ⁢
                
                  
                
              
              
                AR
                ⁡
                
                  (
                  
                    p
                    -
                    2
                  
                  )
                
              
            
          
          ⁢
          L
          ⁢
          
            
          
          ⁢
          
            
              P
              ⁡
              
                (
                
                  
                    f
                    
                      n
                      -
                      p
                      +
                      1
                    
                  
                  |
                  
                    f
                    
                      n
                      -
                      p
                    
                  
                
                )
              
            
            
              
                
                  1
                  ⁢
                  
                    
                  
                  ⁢
                  44
                  ⁢
                  
                    
                  
                  ⁢
                  2
                  ⁢
                  
                    
                  
                  ⁢
                  4
                  ⁢
                  
                    
                  
                  ⁢
                  43
                
                ⁢
                
                  
                
              
              
                AR
                ⁡
                
                  (
                  1
                  )
                
              
            
          
          ⁢
          
            
          
          ⁢
          
            
              P
              ⁡
              
                (
                
                  f
                  
                    n
                    -
                    p
                  
                
                )
              
            
            .
          
        
      
    
  




As noted in the above equations, each conditional probability can be modeled as an autoregressive process of successively smaller orders. The parameters of each process can be determined from the historical times series. For the final unconditional probability the model uses the same Gaussian assumption as before. Each conditional probability for the AR(p−i) process is written as




  
    
      
        
          P
          ⁡
          
            (
            
              
                
                  f
                  
                    n
                    -
                    1
                  
                
                |
                
                  f
                  
                    n
                    -
                    i
                    -
                    1
                  
                
              
              ,
              L
              ,
              
                f
                
                  n
                  -
                  p
                
              
            
            )
          
        
        =
      
    
  
  
    
      
        
          
        
        ⁢
        
          
            exp
            ⁡
            
              [
              
                
                  -
                  
                    1
                    2
                  
                
                ⁢
                
                  
                    (
                    
                      
                        f
                        
                          n
                          -
                          i
                        
                      
                      -
                      
                        w
                        
                          p
                          -
                          i
                        
                      
                      -
                      
                        
                          ∑
                          
                            j
                            =
                            1
                          
                          
                            p
                            -
                            i
                          
                        
                        ⁢
                        
                          
                            A
                            j
                            
                              p
                              -
                              i
                            
                          
                          ⁢
                          
                            f
                            
                              n
                              -
                              j
                              -
                              i
                            
                          
                        
                      
                    
                    )
                  
                  T
                
                ⁢
                
                  
                
                ⁢
                
                  
                    C
                    
                      p
                      -
                      i
                    
                    
                      -
                      1
                    
                  
                  (
                  
                    
                  
                  ⁢
                  
                    
                      f
                      
                        n
                        -
                        i
                      
                    
                    -
                    
                      w
                      
                        p
                        -
                        i
                      
                    
                    -
                    
                      
                        ∑
                        
                          j
                          =
                          1
                        
                        
                          p
                          -
                          i
                        
                      
                      ⁢
                      
                        
                          A
                          j
                          
                            p
                            -
                            i
                          
                        
                        ⁢
                        
                          f
                          
                            n
                            -
                            j
                            -
                            i
                          
                        
                      
                    
                  
                  )
                
              
              ]
            
          
          
            
              
                
                  (
                  
                    2
                    ⁢
                    
                      
                    
                    ⁢
                    π
                  
                  )
                
                q
              
              ⁢
              
                
              
              ⁢
              det
              ⁢
              
                
              
              ⁢
              
                C
                
                  p
                  -
                  i
                
              
            
          
        
      
    
  




and the unconditional probability for fn−p is the same as before having mean μ and covariance Σ. Combining all these results shows that the joint density P(fn,L,fn−p) is Gaussian with precision (inverse covariance) given by Σ−1  (whose rows and columns have been ordered according to f), which can be formed as Σ−1=VpVpT+L+V1V1T+V0V0T where C0≡Σ and the (i+1)q×q matrices V1 are given by





  
    
      V
      p
    
    =
    
      [
      
        
          
            
              -
              
                C
                p
                
                  
                    -
                    1
                  
                  /
                  2
                
              
            
          
        
        
          
            
              
                
                  (
                  
                    A
                    p
                  
                  )
                
                T
              
              ⁢
              
                C
                p
                
                  
                    -
                    1
                  
                  /
                  2
                
              
            
          
        
      
      ]
    
  
  ,
  
    
      V
      
        p
        -
        1
      
    
    =
    
      [
      
        
          
            0
          
        
        
          
            
              -
              
                C
                
                  p
                  -
                  1
                
                
                  
                    -
                    1
                  
                  /
                  2
                
              
            
          
        
        
          
            
              
                
                  (
                  
                    A
                    
                      p
                      -
                      1
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  1
                
                
                  
                    -
                    1
                  
                  /
                  2
                
              
            
          
        
      
      ]
    
  
  ,
  L
  ,
  
    
      V
      0
    
    =
    
      [
      
        
          
            0
          
        
        
          
            M
          
        
        
          
            0
          
        
        
          
            
              -
              
                C
                0
                
                  
                    -
                    1
                  
                  /
                  2
                
              
            
          
        
      
      ]
    
  




and Ap is the q×pq matrix given by Ap=[A1pA2pL App]. Given this particular form for the precision matrix, its Cholesky decomposition can immediately be written down as





  
    [
    
      
        
          
            -
            
              C
              p
              
                
                  -
                  1
                
                /
                2
              
            
          
        
        
          0
        
        
          L
        
        
          0
        
      
      
        
          
            
              
                (
                
                  A
                  1
                  p
                
                )
              
              T
            
            ⁢
            
              C
              p
              
                
                  -
                  1
                
                /
                2
              
            
          
        
        
          
            -
            
              C
              
                p
                -
                1
              
              
                
                  -
                  1
                
                /
                2
              
            
          
        
        
          L
        
        
          0
        
      
      
        
          M
        
        
          M
        
        
          O
        
        
          M
        
      
      
        
          
            
              
                (
                
                  A
                  p
                  p
                
                )
              
              T
            
            ⁢
            
              C
              p
              
                
                  -
                  1
                
                /
                2
              
            
          
        
        
          
            
              
                (
                
                  A
                  
                    p
                    -
                    1
                  
                  
                    p
                    -
                    1
                  
                
                )
              
              T
            
            ⁢
            
              C
              p
              
                
                  -
                  1
                
                /
                2
              
            
          
        
        
          L
        
        
          
            -
            
              C
              0
              
                
                  -
                  1
                
                /
                2
              
            
          
        
      
    
    ]
  
  .




In this form the inverse is easier to calculate. If an inverse of the form below is necessary:




   
  
    [
    
      
        
          
            -
            
              
                (
                
                  C
                  p
                  
                    1
                    /
                    2
                  
                
                )
              
              T
            
          
        
        
          0
        
        
          L
        
        
          0
        
      
      
        
          
            
              
                (
                
                  C
                  
                    p
                    -
                    1
                  
                  
                    1
                    /
                    2
                  
                
                )
              
              T
            
            ⁢
            
              Q
              1
              p
            
          
        
        
          
            -
            
              
                (
                
                  C
                  
                    p
                    -
                    1
                  
                  
                    1
                    /
                    2
                  
                
                )
              
              T
            
          
        
        
          L
        
        
          0
        
      
      
        
          M
        
        
          M
        
        
          O
        
        
          M
        
      
      
        
          
            
              
                (
                
                  C
                  0
                  
                    1
                    /
                    2
                  
                
                )
              
              T
            
            ⁢
            
              Q
              p
              p
            
          
        
        
          
            
              
                (
                
                  C
                  0
                  
                    1
                    /
                    2
                  
                
                )
              
              T
            
            ⁢
            
              Q
              
                p
                -
                1
              
              
                p
                -
                1
              
            
          
        
        
          L
        
        
          
            -
            
              
                (
                
                  C
                  0
                  
                    1
                    /
                    2
                  
                
                )
              
              T
            
          
        
      
    
    ]
  




then the Q matrices must satisfy:





  
    I
    ⁢
    
      
    
    ⁢
    
      δ
      
        i
        ,
        j
      
    
  
  =
  
    
      
        ∑
        
          α
          =
          j
        
        
          min
          ⁡
          
            (
            
              
                p
                -
                j
              
              ,
              i
            
            )
          
        
      
      ⁢
      
        
          
            (
            
              A
              
                i
                -
                α
              
              
                p
                -
                α
              
            
            )
          
          T
        
        ⁢
        
          Q
          
            α
            -
            j
          
          
            p
            -
            j
          
        
        ⁢
        
          
        
        ⁢
        for
        ⁢
        
          
        
        ⁢
        0
      
    
    ≤
    
      i
      +
      j
    
    ≤
    
      p
      ⁢
      
        
      
      ⁢
      and
      ⁢
      
        
      
      ⁢
      j
    
    ≤
    i
  




where A0i=Q0i≡−I. The iterative solution satisfying the requirement is given by





  
    Q
    i
    
      p
      -
      j
    
  
  =
  
    
      
        ∑
        
          α
          =
          j
        
        
          i
          +
          j
          -
          1
        
      
      ⁢
      
        
          
            (
            
              A
              
                i
                +
                j
                -
                α
              
              
                p
                -
                α
              
            
            )
          
          T
        
        ⁢
        
          Q
          
            α
            -
            j
          
          
            p
            -
            j
          
        
        ⁢
        
          
        
        ⁢
        starting
        ⁢
        
          
        
        ⁢
        from
        ⁢
        
          
        
        ⁢
        
          Q
          0
          
            p
            -
            j
          
        
      
    
    =
    
      -
      
        I
        .
      
    
  




Thus the covariance matrix, Σ, is equal to




   
  
    [
    
      
        
          
            
              ∑
              
                k
                =
                0
              
              p
            
            ⁢
            
              
                
                  (
                  
                    Q
                    k
                    p
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  k
                
              
              ⁢
              
                Q
                k
                p
              
            
          
        
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                1
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    
                      k
                      +
                      1
                    
                    p
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  1
                  -
                  k
                
              
              ⁢
              
                Q
                k
                
                  p
                  -
                  1
                
              
            
          
        
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                2
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    
                      k
                      +
                      2
                    
                    p
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  2
                  -
                  k
                
              
              ⁢
              
                Q
                k
                
                  p
                  -
                  2
                
              
            
          
        
        
          L
        
        
          
            
              
                (
                
                  Q
                  p
                  p
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              0
              0
            
          
        
      
      
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                1
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    k
                    
                      p
                      -
                      1
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  1
                  -
                  k
                
              
              ⁢
              
                Q
                
                  k
                  +
                  1
                
                p
              
            
          
        
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                1
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    k
                    
                      p
                      -
                      1
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  1
                  -
                  k
                
              
              ⁢
              
                Q
                k
                
                  p
                  -
                  1
                
              
            
          
        
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                2
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    
                      k
                      +
                      1
                    
                    
                      p
                      -
                      1
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  2
                  -
                  k
                
              
              ⁢
              
                Q
                k
                
                  p
                  -
                  2
                
              
            
          
        
        
          L
        
        
          
            
              
                (
                
                  Q
                  
                    p
                    -
                    1
                  
                  
                    p
                    -
                    1
                  
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              0
              0
            
          
        
      
      
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                2
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    k
                    
                      p
                      -
                      2
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  2
                  -
                  k
                
              
              ⁢
              
                Q
                
                  k
                  +
                  2
                
                p
              
            
          
        
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                2
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    k
                    
                      p
                      -
                      2
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  2
                  -
                  k
                
              
              ⁢
              
                Q
                
                  k
                  +
                  1
                
                
                  p
                  -
                  1
                
              
            
          
        
        
          
            
              ∑
              
                k
                =
                0
              
              
                p
                -
                2
              
            
            ⁢
            
              
                
                  (
                  
                    Q
                    k
                    
                      p
                      -
                      2
                    
                  
                  )
                
                T
              
              ⁢
              
                C
                
                  p
                  -
                  2
                  -
                  k
                
              
              ⁢
              
                Q
                
                  k
                  +
                  1
                
                
                  p
                  -
                  2
                
              
            
          
        
        
          L
        
        
          
            
              
                (
                
                  Q
                  
                    p
                    -
                    2
                  
                  
                    p
                    -
                    2
                  
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              0
              0
            
          
        
      
      
        
          M
        
        
          M
        
        
          M
        
        
          O
        
        
          M
        
      
      
        
          
            
              
                (
                
                  Q
                  0
                  0
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              p
              p
            
          
        
        
          
            
              
                (
                
                  Q
                  0
                  0
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              
                p
                -
                1
              
              
                p
                -
                1
              
            
          
        
        
          
            
              
                (
                
                  Q
                  0
                  0
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              
                p
                -
                2
              
              
                p
                -
                2
              
            
          
        
        
          L
        
        
          
            
              
                (
                
                  Q
                  0
                  0
                
                )
              
              T
            
            ⁢
            
              C
              0
            
            ⁢
            
              Q
              0
              0
            
          
        
      
    
    ]
  
  ⁢
  
    
  




This matrix can be easily implemented in software as executable instructions to provide the covariance.
Having determined the covariance matrix, the mean is determined by completing the square:




  
    μ
    %
  
  =
  
    
      
        Σ
        %
      
      ⁡
      
        [
        
          
            
              
                C
                p
                
                  -
                  1
                
              
            
            
              0
            
            
              0
            
            
              L
            
            
              0
            
          
          
            
              
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  1
                  p
                
              
            
            
              
                C
                
                  p
                  -
                  1
                
                
                  -
                  1
                
              
            
            
              0
            
            
              L
            
            
              0
            
          
          
            
              
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  2
                  p
                
              
            
            
              
                
                  C
                  
                    p
                    -
                    1
                  
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  1
                  
                    p
                    -
                    1
                  
                
              
            
            
              
                C
                
                  p
                  -
                  2
                
                
                  -
                  1
                
              
            
            
              L
            
            
              0
            
          
          
            
              M
            
            
              M
            
            
              M
            
            
              O
            
            
              M
            
          
          
            
              
                
                  C
                  p
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  p
                  p
                
              
            
            
              
                
                  C
                  
                    p
                    -
                    1
                  
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  
                    p
                    -
                    1
                  
                  
                    p
                    -
                    1
                  
                
              
            
            
              
                
                  C
                  
                    p
                    -
                    1
                  
                  
                    -
                    1
                  
                
                ⁢
                
                  A
                  
                    p
                    -
                    2
                  
                  
                    p
                    -
                    2
                  
                
              
            
            
              L
            
            
              
                C
                0
                
                  -
                  1
                
              
            
          
        
        ]
      
    
    ⁡
    
      [
      
        
          
            
              w
              p
            
          
        
        
          
            
              w
              
                p
                -
                1
              
            
          
        
        
          
            
              w
              
                p
                -
                2
              
            
          
        
        
          
            M
          
        
        
          
            
              w
              0
            
          
        
      
      ]
    
  




with Σ as above. Again this matrix and its square are easily implemented in software as executable instructions.

Although complex on paper, the algorithm is computationally very efficient. During the training phase the covariance matrix and its mean can be estimated with a single pass through the data by recording frequency counts. If there are D data points then the complexity of accomplishing both tasks is of the order O(D(p+1)q((p+1)q+1)). Prediction is not much more complicated. The dominant factor is the computation of Σ2−1, which is of order O(|N2|3). Moreover, this matrix inverse can be stored and need not be recalculated with each prediction.
To be used as an online algorithm, the above algorithm must be modified so that it can operate in an online mode in which all parameters of the algorithm (i.e., the mean and covariance) are continually updated as new data arrives so that it is adaptive. This is straightforward because updates to the mean and covariance are simple to implement in software. The algorithm also can be modified to discount data from the past by a factor 0≦λ≦1. This allows the algorithm to learn from recent events and adapt to changing conditions. Thus, if the data f1,L,fT−2,fT−1,fT is available at time T, the estimate of the mean is




  
    
      
        
          
            μ
            ^
          
          T
        
        =
        
          
            
              f
              T
            
            +
            
              λ
              ⁢
              
                
              
              ⁢
              
                f
                
                  T
                  -
                  1
                
              
            
            +
            
              
                λ
                2
              
              ⁢
              
                f
                
                  T
                  -
                  2
                
              
            
            +
            L
            +
            
              
                λ
                
                  T
                  -
                  1
                
              
              ⁢
              
                f
                1
              
            
          
          
            
              D
              T
            
            ⁡
            
              (
              λ
              )
            
          
        
      
    
    
      
        (
        0.11
        )
      
    
  




and the estimate of the covariance at time T as





  
    
      
        
          
            Σ
            ^
          
          T
        
        =
        
          
            
              
                
                  
                    
                      (
                      
                        
                          f
                          T
                        
                        -
                        
                          μ
                          ^
                        
                      
                      )
                    
                    ⁢
                    
                      
                        (
                        
                          
                            f
                            T
                          
                          -
                          
                            μ
                            ^
                          
                        
                        )
                      
                      T
                    
                  
                  +
                  
                    
                      λ
                      ⁡
                      
                        (
                        
                          
                            f
                            
                              T
                              -
                              1
                            
                          
                          -
                          
                            μ
                            ^
                          
                        
                        )
                      
                    
                    ⁢
                    
                      
                        (
                        
                          
                            f
                            
                              T
                              -
                              1
                            
                          
                          -
                          
                            μ
                            ^
                          
                        
                        )
                      
                      T
                    
                  
                  +
                
              
            
            
              
                
                  L
                  +
                  
                    
                      
                        λ
                        
                          T
                          -
                          1
                        
                      
                      ⁡
                      
                        (
                        
                          
                            f
                            1
                          
                          -
                          
                            μ
                            ^
                          
                        
                        )
                      
                    
                    ⁢
                    
                      
                        (
                        
                          
                            f
                            1
                          
                          -
                          
                            μ
                            ^
                          
                        
                        )
                      
                      T
                    
                  
                
              
            
          
          
            
              -
              1
            
            +
            
              
                D
                T
              
              ⁡
              
                (
                λ
                )
              
            
          
        
      
    
    
      
        (
        0.12
        )
      
    
  




where the denominator is given by DT(λ)=1+λ+L+λT−1=(1−λT)/(1−λ). With these definitions the algorithm can be implemented in software to provide running estimates of the mean and covariance and update them as





  
    
      
        
          
            μ
            ^
          
          T
        
        =
        
          
            
              f
              T
            
            
              
                D
                T
              
              ⁡
              
                (
                λ
                )
              
            
          
          +
          
            λ
            ⁢
            
              
                
                  D
                  
                    T
                    -
                    1
                  
                
                ⁡
                
                  (
                  λ
                  )
                
              
              
                
                  D
                  T
                
                ⁡
                
                  (
                  λ
                  )
                
              
            
            ⁢
            
              
                μ
                ^
              
              
                T
                -
                1
              
            
          
        
      
    
    
      
        (
        0.13
        )
      
    
  








  
    
      
        and
        ⁢
        
          

        
        ⁢
        
          
            
              Σ
              ^
            
            T
          
          =
          
            
              
                
                  (
                  
                    
                      f
                      T
                    
                    -
                    
                      μ
                      ^
                    
                  
                  )
                
                ⁢
                
                  
                    (
                    
                      
                        f
                        T
                      
                      -
                      
                        μ
                        ^
                      
                    
                    )
                  
                  T
                
              
              
                
                  -
                  1
                
                +
                
                  
                    D
                    T
                  
                  ⁡
                  
                    (
                    λ
                    )
                  
                
              
            
            +
            
              λ
              ⁢
              
                
                  
                    -
                    1
                  
                  +
                  
                    
                      D
                      
                        T
                        -
                        1
                      
                    
                    ⁡
                    
                      (
                      λ
                      )
                    
                  
                
                
                  
                    -
                    1
                  
                  +
                  
                    
                      D
                      T
                    
                    ⁡
                    
                      (
                      λ
                      )
                    
                  
                
              
              ⁢
              
                
                  Σ
                  ^
                
                
                  T
                  -
                  1
                
              
            
          
        
      
    
    
      
        (
        0.14
        )
      
    
  




The discount factor λ should be set to match the time scale for variation of the problem. If behavior is stationary then λ=1 otherwise λ should be set from the data. One quick and basic manner to accomplish this is to match some characteristic time of variation, T to the average discount time 1/(1−λ), i.e., λ=( T−1)/ T. Another way to set λ is by minimizing the cross-validation error.
Referring to FIG. 7, in one implementation 400 in a supply chain management system, the IEWA uses a probabilistic predictive algorithm embodied in executable instructions on one or more computer systems to estimate future inventory levels as follows: First, the IEWA takes any historical inventory data to calculate a Gaussian distribution with a mean and covariance and provide an inventory prediction at a set time in the future (step 405). The software can be further programmed to compare the prediction to a first company-specified low inventor threshold and to a second company-specified high inventory threshold (step 410). The IEWA can be programmed to order additional stock for inventory if the predicted level is below the low inventory threshold (step 415) or cancel existing replenishment orders if the threshold is above the high inventory threshold (step 420). The IEWA then records time dependent data related to inventory consumption and replenishment (step 425) so that it can calculate time dependent cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment (step 430). This data can vary over time, seasonally, and for unknown reasons, such as recessions or other changes in economic conditions. The IEWA uses this new data with the historical data to update the Gaussian distribution, mean, and covariance and calculate a new predicted inventory level for the next time period (step 435). Over time, the data accumulated has the likelihood of improving the predicted inventory level within the supply chain management system as the amount of data increases in volume.
A number of embodiments of the invention have been described. Nevertheless, it will be understood that various modifications may be made without departing from the spirit and scope of the invention. Accordingly, other embodiments are within the scope of the following claims.

## Claims

1. An inventory agent operating on software comprising instructions operable to cause a programmable processor to:
receive inventory data related to stock in an inventory, the inventory data comprising planned inventory data and actual inventory data;
use the inventory data to calculate one or more correlations in errors between the planned inventory data and the actual inventory data;
use the one or more correlations to estimate a probability density for one or more errors;
calculate a predicted inventory level;
calculate an estimated error of the predicted inventory level using the probability density; and
adjust the predicted inventory level with the estimated error to estimate an actual inventory level.

2. The inventory agent of claim 1, further comprising instructions for defining confidence intervals around the actual inventory level.

3. The inventory agent of claim 2, wherein the confidence intervals include a high bound and a low bound.

4. The inventory agent of claim 3, wherein the probability density is the midpoint of the confidence intervals.

5. The inventory agent of claim 1, further comprising instructions to calculate an upside 10% confidence bound and a downside 10% confidence bound.

6. The inventory agent of claim 5, further comprising instructions to use the upside 10% confidence bound and the downside 10% confidence bound in determining whether to order additional stock for the inventory.

7. The inventory agent of claim 1, wherein the instructions to calculate the predicted inventory level further comprise instructions for processing the inventory data with a conditional probabilistic predictive statistical algorithm.

8. The inventory agent of claim 7, wherein the statistical algorithm uses a conditional probabilistic model to process the inventory data.

9. The inventory agent of claim 1, further comprising instructions for using the actual inventory level to determine whether to order additional stock for the inventory.

10. The inventory agent of claim 1, wherein the inventory data is generated using a radio-frequency identification device.

11. The inventory agent of claim 1, wherein the inventory data is generated upon a sale of the stock in the inventory.

12. The inventory agent of claim 1, wherein the inventory data is generated upon a transfer of the stock in the inventory.

13. The inventory agent of claim 8, wherein the conditional probabilistic model uses a conditional Gaussian approximation.

14. The inventory agent of claim 13, wherein the conditional probabilistic model uses historical inventory data and current inventory data.

15. The inventory agent of claim 7, wherein the inventory data applied to the conditional probabilistic predictive statistical algorithm includes actual cumulative replenishment, forecast cumulative replenishment, actual cumulative consumption, and forecast cumulative consumption data.

16. The inventory agent of claim 1, further comprising instructions operable to cause the inventory agent to order a replenishment of the inventory.

17. The inventory agent of claim 1, further comprising instructions operable to record data related to inventory consumption and replenishment.

18. The inventory agent of claim 17, further comprising instructions operable to use the recorded data to calculate cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment.

19. The inventory agent of claim 17, further comprising instructions operable to use the recorded data to calculate a second planned inventory and a second actual inventory.

20. The inventory agent of claim 19, further comprising instructions operable to use the inventory data to calculate one or more correlations in errors between the second planned inventory data and the second actual inventory data; and
use the one or more correlations in errors to estimate a second probability density for one or more errors.

21. The inventory agent of claim 20, further comprising instructions operable to:
use the inventory data with the calculated cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment to calculate a second predicted inventory level;
calculate a second predicted inventory level;
calculate an estimated error of the second predicted inventory level using the second probability density; and
adjust the second predicted inventory level with the estimated error of the second predicted inventory level to estimate a second actual inventory level.

22. The inventory agent of claim 21, wherein the instructions to calculate the second predicted inventory level further comprise processing the inventory data with a conditional probabilistic predictive statistical algorithm.

23. The inventory agent of claim 22, wherein the statistical algorithm uses a conditional probabilistic model to process the data.

24. The inventory agent of claim 1, wherein the inventory agent is implemented in a supply chain management system.

25. A system comprising one or more computer systems and an inventory agent computer coupled to the computer systems over a network, the inventory agent computer being operable to:
receive inventory data related to stock in an inventory, the inventory data comprising planned inventory data and actual inventory data;
use the inventory data to calculate one or more correlations in errors between the planned inventory data and the actual inventory data;
use the one or more correlations to estimate a probability density for one or more errors;
calculate a predicted inventory level;
calculate an estimated error of the predicted inventory level using the probability density; and
adjust the predicted inventory level with the estimated error to estimate an actual inventory level.

26. The system of claim 25, further comprising instructions for defining confidence intervals around the actual inventory level.

27. The system of claim 26, wherein the confidence intervals include a high bound and a low bound.

28. The system of claim 27, wherein the probability density is the midpoint of the confidence intervals.

29. The system of claim 25, further comprising instructions to calculate an upside 10% confidence bound and a downside 10% confidence bound.

30. The system of claim 29, further comprising instructions to use the calculated upside 10% confidence bound and the downside 10% confidence bound in determining whether to order additional stock for the inventory.

31. The system of claim 25, wherein the instructions to calculate the predicted inventory level further comprise instructions for processing the inventory data with a conditional probabilistic predictive statistical algorithm.

32. The system of claim 31, wherein the statistical algorithm uses a conditional probabilistic model to process the data.

33. The system of claim 25, further comprising instructions for using the actual inventory level to determine whether to order additional stock for the inventory.

34. The system of claim 25, further comprising instructions for using the probability density to define confidence intervals around the actual inventory level.

35. The system of claim 25, further comprising instructions to generate the inventory data upon receipt from a radio-frequency identification device.

36. The system of claim 25, further comprising instructions to generate the inventory data upon a sale of the stock in the inventory.

37. The system of claim 25, further comprising instructions to generate the inventory data upon a transfer of the stock in the inventory.

38. The system of claim 31, wherein the conditional probabilistic model uses a conditional Gaussian approximation.

39. The system of claim 38, further comprising instructions to use historical inventory data and current inventory data in the conditional probabilistic model.

40. The system of claim 39, wherein the inventory data applied to the conditional probabilistic predictive statistical algorithm includes actual cumulative replenishment, forecast cumulative replenishment, actual cumulative consumption, and forecast cumulative consumption data.

41. The system of claim 25, further comprising instructions operable to cause the inventory agent computer to order a replenishment of the inventory.

42. The system of claim 25, further comprising instructions operable to record data related to inventory consumption and replenishment.

43. The system of claim 42, further comprising instructions operable to use the recorded data to calculate cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment.

44. The system of claim 42, further comprising instructions operable to use the recorded data to calculate a second planned inventory and a second actual inventory.

45. The system of claim 44, further comprising instructions operable to use the inventory data to calculate one or more correlations in errors between the second planned inventory data and the second actual inventory data; and
use the one or more correlations in errors to estimate a second probability density for one or more errors.

46. The system of claim 45, further comprising instructions operable to:
use the inventory data with the calculated cumulative forecast consumption, cumulative forecast replenishment, cumulative actual consumption, and cumulative actual replenishment to calculate a second predicted inventory level;
calculate a second predicted inventory level;
calculate an estimated error of the second predicted inventory level using the second probability density; and
adjust the second predicted inventory level with the estimated error of the second predicted inventory level to estimate a second actual inventory level.

47. The system of claim 46, wherein the instructions to calculate the second predicted inventory level further comprise processing the inventory data with a conditional probabilistic predictive statistical algorithm.

48. The system of claim 47, wherein the statistical algorithm uses a conditional probabilistic model to process the data.

49. The system of claim 25, wherein the inventory agent computer is implemented in a supply chain management system.