\section{Introduction}

Big data provides us an unprecedented opportunity to construct the real-time and high-frequency macroeconomic indicators, which can not only play a unique role in early warning and monitoring in the process of macroeconomic operation, but also provide a new perspective for the research in the field of economics. However, most of China's important macroeconomic indicators, such as the Consumer Price Index (CPI), which is used to measure the level of inflation, can only be released monthly, and there is a lag in its release. But the development of scanner data provides a new data source for the compilation of CPI, which can not only improve the effectiveness of CPI release, but also realize the compilation of CPI at a higher time frequency. At present, the Netherlands, Norway, Switzerland, Sweden and New Zealand and other countries have officially applied scanner data to the compilation of their own CPI.

To our best knowledge, there is no research results that directly apply scanner data to the compilation of CPI in China, so we use the scanner data of supermarket retail sales provided by CAA to compile the Scanner-data Food Consumer Price Index, namely S-FCPI. It not only makes up for the gap in such studies, and due to its unique advantages, such as strong timeliness, diversified time frequency and wide geographical coverage, it provides a new perspective for real-time monitoring of changes in the price level of various goods, reflecting macroeconomic operation, measuring inflation inertia and inflation prediction, which is a beneficial supplement to China's CPI.

Scanner data refers to the highly structured data containing goods prices, sales volume, sales location and other information formed by scanning the barcode of the goods when the goods is sold, which not only provides a new source of data for the compilation of price indexes by national statistical agencies and related research, but also makes it possible to compile superlative price indexes at detailed aggregation levels since prices and quantities are available (see \cite{2011Eliminating}).  Among the countries that currently use scanner data to compile CPI, the Dutch first tried to apply scanner data to the compilation of CPI in 1997 and constructed the price index of coffee at first (see \cite{1997Estimation}). After a series of tests on the index effect, the scanner data was formally applied to the compilation of Dutch CPI in 2002. At present, the goods categories of the Dutch using scanner data to compile CPI have been expanded from the original food category to six categories in COICOP.

In Norway, the scanner data is officially used to compile the CPI in 2005, and the T\"ornqvist price index is applied to compile the basic classification price index. Now,  20\% of the data used to compile the Norway CPI is already scanner data, covering seven categories in COICOP (see \cite{nygaard2010chain}; \cite{johansen2011dealing}; \cite{rodriguez2006use}; \cite{johansen2012various}). In Switzerland, the scanner data is officially used to compile the CPI in 2008 which is provided by the two largest retail chains in Switzerland, and it covers six categories in COICOP (see \cite{muller2006recent}). New Zealand began to compile the CPI of electronics in September 2013 based on the scanner data provided by GfK and considering the rapid turnover of old and new products in electronics and the existence of seasonal products, as well as the price and sales volume information provided by scanner data, New Zealand uses T\"ornqvist price index as its index calculation formula. In addition to the practical application of the scanner data in the compilation of CPI in some countries, many scholars have also conducted a lot of research on how to overcome the impact of the potential problems when using scanner data, such as high loss rate of goods, large fluctuation of prices and sales volume affected by promotion. For example, \cite{ivancic2011scanner} put forward the RYGEKS (Rolling Year GEKS) price index in their research, then \cite{2011Eliminating} introduced the T\"ornqvist price index into the RYGEKS price index, which can be free from the impact of chain drift, and New Zealand uses this method to compile the CPI now. And  \cite{RePEc:swe:wpaper:2018-13} suggested that CCDI index and mean splice method should be used to update the price index in order to control the degree of chain drift.

However, due to information protection and other reasons, retail enterprises are often reluctant to provide their own scanner data, and the cost of purchasing access to scanner data also makes the higher cost of conducting the relevant research. Therefore, considering the correlation between online and offline goods prices, some research have turned their perspectives to online price data. Currently, the relatively mature research results are the Billion Price Project (BPP) carried out by MIT, and the iCPI issued by researchers from Tsinghua University. \cite{cavallo2016billion}, the founders of MIT Billion Price Program, introduced the data source, data processing and application value of BPP in detail in their research. Considering that large multi-channel retailers (i.e. retailers selling online and offline at the same time, such as Wal Mart) participate in most retail sales in most countries, BPP takes the price data of such retailers as the main data source, but BPP of China only includes fresh food and supermarket food. \cite{HARCHAOUI2018225} showed in their research that since online goods prices can reflect changes in offline goods prices to a certain extent, BPP can be used as one of the indicators to enhance the timeliness of national CPI. In addition, their research also realized mixed frequency prediction of U.S. CPI based on the U.S. BPP index and MIDAS model. The iCPI released by the iCPI project team of Tsinghua University is a relatively mature online price index in China at present. \cite{LiuTaoxiong2019} discussed in detail the data source, compilation method and application value of iCPI in their research. iCPI takes China's online shopping platforms (such as Taobao, JD, Suning, etc.) and goods prices information platforms (such as Price Quotations, Soufun, etc.) as the main data sources, and the classification of goods categories is basically consistent with China's CPI. In addition, iCPI can achieve the compilation of daily and weekly high-frequency price indexes, but the main disadvantage of iCPI is that it cannot reflect the change of regional price level.

The remainder of the paper is organized as follows. Section \ref{sec:Data and S-FCPI} features the data source of S-FCPI and introduces the compilation method of S-FCPI. Section \ref{sec:CPI and S-FCPI} analyzes the correlation between S-FCPI and CPI and other macro indicators, thus proving the reliability of S-FCPI. Section \ref{sec:Predicting CPI by S-FCPI} uses S-FCPI to realize the quantitative and qualitative prediction of CPI growth rate. Section \ref{sec:Conclusion} is conclusion which summarizes the results.

\section{Data source and S-FCPI}
\label{sec:Data and S-FCPI}

The retail scanner data of Chinese supermarkets integrated by CAA not only provide massive goods prices data, but also provide location, volume, amount, and detailed information, which provide the potential for constructing a consumer price index. This paper employed the supermarket retail scanner big data from CAA to construct China's Food Consumer Price Index, named S-FCPI (Scanner-data Food Consumer Price Index). In this section, we elaborate data collection, data processing and S-FCPI construction.

\subsection{Data collecting}

The data source for compiling S-FCPI is the retail scanner data of Chinese supermarkets provided by China Ant Business Alliance (CAA), which is a retail resource alliance organization, since its establishment in 2017 by 12 chain retail enterprises in 6 provinces of China, CAA has experienced rapid development for five years. In 2020, it has more than 100 member enterprises in 32 provinces, cities, and autonomous regions of China, with a total annual turnover of nearly 100 billion Yuan. By utilizing the Alibaba Cloud and the MaxComputing platform~\cite{aliyun}, CAA collected and pre-processed the scanner big data generated by its member enterprises in real time.

The traditional survey-based method in most countries to collect retail data has remained the same, in which the process is expensive, complex and often slow. Scanner big data provided by CAA has the main advantages:
\begin{itemize}
  \item Low cost. Each sale of goods is equivalent to data collection, which reduces the cost compared with market survey.
  \item High frequency. The data will be uploaded to the database in real time when the goods are sold, and the sales time record is accurate to seconds, so the data can be aggregated into different time dimensions according to the research requirement.
  \item Large volume. The database stores the sales data of 12 million goods which covering 32 administrative regions in China, and the goods are divided into 13 first-level categories, 67 second-level categories, 419 third-level categories and 776 fourth-level categories by CAA.
\end{itemize}

\subsection{Data processing}

Despite of the significant advantages of scanner data, it takes effort to process the data due to its massive data, which also puts forward higher requirements for the optimization of data processing, which the most critical is the choice of data aggregation route.

Specifically, goods sales summary table (daily), goods barcode information table and goods category table are the basic dataset when compelling S-FCPI. Among them, the goods sales summary table (daily) is the most important dataset, and it takes the date as a partition, which corresponds to independent folders on the distributed system in essence, and each folder stores scanner data of all stores on the same day. Its significance is to avoid unnecessary scanning of the whole dataset to optimize the query and improve the efficiency of data processing. However, when compiling S-FCPI, it needs to use the above datasets to vertically aggregate scanner data at the daily, weekly and monthly level according to the time dimension, and horizontally aggregate scanner data at the city (county), procincial (district) and national level According to the geographical dimension. Therefore, two possible data aggregation routes are as follows: vertical aggregation according to time dimension and then horizontal aggregation according to geographical dimension; horizontal aggregation according to geographical dimension and then vertical aggregation according time dimension.

Since the above two data aggregation routes cannot avoid full dataset scans, the aggregation route with the least number of full dataset scans is the most efficient one on the premise of the same aggregation results. For the first aggregation route, it only needs to scan goods sales summary table (daily) once to obtain the daily aggregated data at the city (county) level, then aggregate it into weekly, monthly aggregated data at the city (county) level, and finally aggregate the daily, weekly, monthly aggregated data at the city (county) level respectively into procincial (district) and national level. For the second aggregation route, it needs to scan goods sales summary table (daily) three times to obtain the daily aggregated data at the city (county), procincial (district) and national level, then aggregate them respectively into weekly and monthly level. Therefore, the first aggregation route can effectively reduce the number of full dataset scans and improve the efficiency of data aggregation, so we choose it as the final data aggregation route.

\subsection{Index construction}

To ensure the scientificity and rigor of the compilation of S-FCPI as well as the correctness and validity of the results, we mainly refer to the theories and methods of compiling CPI in China, and the ``Circulation and Consumer Price Statistical Report System (2021)'' published by the National Bureau of Statistics of China. In addition, other relevant materials such as ``Consumer Price Index Manual: Concepts and Methods (2020)'' published by the International Monetary Fund and the International Labour Organization are also referred. The detailed compilation process of S-FCPI is shown in Figure~\ref{The compilation process of S-FCPI.}.

\begin{figure}[!h]
	\centering
		\includegraphics[scale=.6]{figs/flow.pdf}
	\caption{The construction process of S-FCPI.}
\label{The compilation process of S-FCPI.}
\end{figure}

\subsubsection{Categories of goods}

In order to make the price changes reflected by S-FCPI reliable, we mainly refer to the ``Classification of Personal Consumption by Purpose'' published by the United Nations, and ``Circulation and Consumer Price Statistical Reporting System (2021)'' to reclassify the categories of goods in the CAA database. The S-FCPI's categories of goods are generally consistent with China's CPI, and the specific categories of goods are shown in Table~\ref{Goods categories}.

\begin{table}[H]
\caption{Goods categories of S-FCPI.}\label{Goods categories}
\begin{tabular}{ll}
\toprule
Sub-category                  & Basic category                                                                                \\ \midrule
Grain                         & Rice, noodles, other grains, and grain products                                                                                \\
Tuber                         & Tuber, Tuber products                                                                                \\
Bean                          & Dried beans, soy products                                                                                \\
Edible oil                    & \begin{tabular}[c]{@{}l@{}}Rapeseed oil, soybean oil, peanut oil, sunflower oil, camellia oil, blend oil, \\ linseed oil, corn oil, olive oil, butter, other edible oils\end{tabular}                           \\
Vegetables and edible fungi   & \begin{tabular}[c]{@{}l@{}}Onion, ginger, garlic and pepper, root vegetables, mushroom vegetables, \\ nightshade vegetables, leafy vegetables, \\ dried vegetables and dried bacteria and products\end{tabular} \\
Neat of animal                & \begin{tabular}[c]{@{}l@{}}Pork, beef, mutton, other livestock meat and by-products, \\ livestock meat products\end{tabular}                                                                                \\
Meat of poultries             & Chicken, duck, other poultry meat and products                                                                                \\
Aquatic products              & \begin{tabular}[c]{@{}l@{}}Fish, shrimp, crab, shellfish, algae, soft pod, \\ other aquatic products\end{tabular}                                                                                \\
Eggs                          & \begin{tabular}[c]{@{}l@{}}Eggs, duck eggs, goose eggs, quail eggs, pigeon eggs, \\ other egg products and products\end{tabular}                                                                                \\
Dairy                         & \begin{tabular}[c]{@{}l@{}}Pure milk, pure goat milk, yogurt, milk powder, milk beverage, \\ other milk products\end{tabular}                                                                                \\
Dried fresh melons and fruits & Fresh fruit, nuts, candied dried fruit, other melon and fruit products                                                                                \\
Candy and pastries            & Sugar, sweets and chocolate, pastries, other confectionery pastries                                                                                \\
Condiments                    & \begin{tabular}[c]{@{}l@{}}Edible salt, soy sauce, vinegar, cooking wine, chicken essence, \\ monosodium glutamate, sesame oil, seasoning sauce, chili oil, \\ spices, other condiments\end{tabular}            \\
Other food categories         & Convenience food, starch, and products, puffed food, baby food                                                                                \\ \bottomrule
\end{tabular}
\end{table}

\subsubsection{Collection of goods prices}

There is a significant difference between S-FCPI and CPI in the way of price collection. Specifically, the representative goods under each category of CPI are selected by local investigation teams based on the sales volume and supplemented by the opinions of the relevant local departments. It means that CPI constructs a fixed basket of goods and thus may have errors due to the incomplete selection of goods. The difference is that S-FCPI regards all goods with sales data as representative goods and uses the product ID to match the sales data of the different periods, that is, S-FCPI constructs a variable basket of goods to ensure that the goods in the basket meet the homogeneity and comparability.

On the frequency of goods prices collection, the data for compiling CPI is obtained through manual investigation by investigators, and different investigation frequencies are set according to the types of goods (1 to 5 times per month). But for the scanner data, each order can be regarded as a price collection of all goods in the bill, therefore, the scanner data realize the real-time collection of goods prices, which also enables S-FCPI to be constructed not only into monthly with the same frequency as CPI, but also can be constructed into daily and weekly with higher frequency.

On the location of goods prices collection, the National Bureau of Statistics of China determines it by sampling cities (counties) and price survey points \footnote{The sampling of cities (counties) is stratified sampling According to the size of cities, population, and income, and some small or medium-sized cities (counties) are appropriately added for investigation to enhance the representativeness of provincial price indexes. The sampling of the price survey points is to conduct equidistant sampling after sorting the transaction volume of each farmers market (fresh market), supermarket, etc. in descending order in the sampled cities (counties).}. S-FCPI regards all stores of CAA member enterprises as goods prices collection location instead of sampling, so it can not only be constructed into national provincial price index with the same geographical dimension as CPI, but it can also be constructed into a more detailed geographic dimension, such as county price index.

\subsubsection{Weights setting of S-FCPI}
Since different categories of goods account for different proportions in household consumption, it needs to set corresponding weights for compiling S-FCPI. The CPI weights are mainly derived from the household survey data in the base year, and it is adjusted slightly by using typical survey data an
d expert assessments. In addition, CPI has no weight data below the basic category, and only has weight data above the basic category. Different from the CPI weights, the S-FCPI weights are calculated based on the CAA database which enables timely adjustment of the weights according to the consumption structure of consumers during the reporting period. The main idea of S-FCPI weights is to select the corresponding aggregate data according to the time dimension and geographic dimension of S-FCPI, then the weights are obtained by calculating the share of goods sales.

On the composition of weights, the CPI weights include the city (county) , procincial (district) and national weights, the provincial (district) and national weights are further divided into the corresponding urban and rural weights. The composition of S-FCPI weights is roughly the same as CPI weights, which also includes the city (county), procincial (district) and national weights, and all weights include the frequency of daily, weekly, and monthly.

On the update frequency of weights, the CPI weights are updated every five years since 2000, and slightly adjusted with relevant data during the period. However, the update frequency of CPI weighs is still relatively low, which may lead to non-sampling error of CPI weights. S-FCPI improves the updating frequency of weights and realizes the updating frequency of weights with daily, weekly, monthly, or other frequencies to reflect the changes of residents' consumption structure and pattern more accurately and timely.

\subsubsection{Index calculation}

The calculation of S-FCPI can be divided into four steps: calculating the unit price, calculating the relative number of price changes, compiling the basic categorical price index, and summarizing to the high-level price index. We use the monthly chain price index as the example to introduce the process of calculating S-FCPI.

\textbf{Step one, calculating the unit price.} Since the CAA database provides both the price and sales volume information of goods, S-FCPI uses the weighted average method to calculate the unit price instead of the simple arithmetic average used by CPI, thus more accurately reflecting the differences between different stores. The specific calculation method is to take the share of sales volume of goods as the weight, calculate the weighted average price of goods in one store firstly, then calculate the weighted average price of goods in multiple stores and take it as the unit price of goods.Taking goods \textit{k} as an example, the calculation formula of unit price is as follows, where $U_k^t$ is unit price, $sales_k^t$ is total sales, $q_k^t$ is total sales volumes.

\begin{equation}
U_k^t=\frac{sales_k^t}{q_k^t}\label{eq:U}
\end{equation}

\textbf{Step two, calculating the relative number of price changes.} Consistent with the compilation method of CPI, the relative number of price changes of each good in S-FCPI is calculated by comparing the unit prices of the two periods. Equation (\ref{eq:R}) is the calculation formula where $R_k^t$ is relative number of price changes, $U_k^t$ and $U_k^{t-1}$ are the unit prices in period \textit{t} and period \textit{t}-1, respectively.

\begin{equation}
R_k^t=\frac{U_k^t}{U_k^{t-1}}\label{eq:R}
\end{equation}

\textbf{Step three, compiling the basic categorical price index. } Different countries in the world have different theoretical bases for compiling their own basic categorical CPI. One is the Fixed basket index theory represented by China~\cite{XU2006cpi}, which core idea is to select a series of goods and services closely related to the daily life and consumption of residents and form an abstract goods basket, the change of the overall price level is reflected by investigating the change of the cost of purchasing the goods basket in different periods. The other is the cost-of-living index theory represented by the United States(see \cite{konus1939problem}; \cite{abraham2003toward}; \cite{diewert2001consumer}; \cite{triplett2001should}), which core idea is to reflect the change of the overall price level by comparing the minimum expenditure required by consumers in different periods to reach a certain utility level. Since there are two different theoretical bases for CPI, namely, the fixed basket index theory and the cost-of-living index theory, theoretically speaking, when CPI is constructed based on different theoretical bases, the index calculation method adopted should also have different emphasis.

Jevons price index is an index calculation method that does not consider consumer preference, which is used for the calculation of the basic categorical price index of China's CPI, so we take it as one of the calculation methods of the basic categorical price index of S-FCPI. Taking the basic category \textit{j} under the sub-category \textit{i} of a city (county) as an example, the calculation formula of the Jevons price index is shown in Equation ((\ref{eq:J})), where $M_{jk}^t$ is the number of goods in basic category \textit{j}.

\begin{equation}
J_j^t=\prod_{k=1}^{M_{jk}^t}\left(R_{jk}^t\right)^\frac{1}{M_{jk}^t}\label{eq:J}
\end{equation}

In relevant research, the index calculation method that does not consider consumer preference (unweighted index form) is often used due to the limitation of the availability of weights data, while the development of scanner data makes it possible to compile basic categorical price index when considering consumer preference (weighted index form), and CPI Manual (2020) also points out that when detailed price and sales data are available, the weighted index form will be a better choice. Therefore, we also use T\"ornqvist (see \cite{DIEWERT1976115}; \cite{1979The}) and GFT (see \cite{basmann1983budget}; \cite{basmann2013generalized}; \cite{swann1999economic}) price indices to compile the basic categorical price index of S-FCPI. Taking the basic category \textit{j} under the sub-category \textit{i} of a city (county) as an example, the calculation formulas of T\"ornqvist and GFT price index are as follows, where $S_{jk}^t$ is the share of sales of goods \textit{k}.

\begin{equation}
T_j^t=\prod_{k=1}^{M_{jk}^t}\left(R_{jk}^t\right)^\frac{S_{jk}^{t-1}+S_{jk}^t}{2}\label{eq:T}
\end{equation}

\begin{equation}
G_j^t=\prod_{k=1}^{M_{jk}^t}\left(R_{jk}^t\right)^{S_{jk}^t}\label{eq:G}
\end{equation}

\begin{equation}
S_{jk}^t=\frac{{sales}_{jk}^t}{\sum_{k=1}^{M_{jk}^t}{sales}_{jk}^t}\label{eq:Share}
\end{equation}

\textbf{Step four, summarizing to the high-level price index.} China's CPI uses the Laspeyres price index for high-level summary, and its weights are the household consumption expenditure data obtained from the survey, but the weights update frequency is low, which may lead to non-sampling errors of weight. Therefore, S-FCPI takes the share of sales in the reporting period as the weight and uses the Paasche price index to conduct high-level summary, so that it can more accurately and timely reflect the changes in residents' consumption structure and prices. The high-level summary process of S-FCPI is shown in Figure \ref{High-level summary process of S-FCPI.}.

\begin{figure}[!h]
	\centering
		\includegraphics[scale=.5]{figs/flow2.pdf}
	\caption{High-level summary process of S-FCPI.}
	\label{High-level summary process of S-FCPI.}
\end{figure}

The first level of summary is city (county) level S-FCPI internal summarize. The basic category S-FCPI at the city (county) level is summarized into the sub-category S-FCPI at the city (county) level, and then summarized into the S-FCPI at the city (county) level. The second level of summary is to summarize the city (county) level S-FCPI to provincial (district) level. It includes summarizing the city (county) level basic category S-FCPI to provincial (district) level, summarizing the city (county) level sub-category S-FCPI to provincial (district) level, and summarizing the city (county) level S-FCPI to provincial (district) level. The third level of summary is to summarize the provincial (districts) level S-FCPI to national level. It includes summarizing the provincial (districts) level basic category S-FCPI to national level, summarizing the provincial (districts) level sub-category S-FCPI to national level, and summarizing the provincial (districts) level S-FCPI to national level. In conclusion, whether it is daily, weekly, and monthly S-FCPI, or chain, year-on-year or fixed-base S-FCPI, it can be constructed according to the above process, and the reliability of S-FCPI will be verified from multiple perspectives in the next chapter.

\section{Relationship between CPI and S-FCPI}
\label{sec:CPI and S-FCPI}

S-FCPI has significant advantages of diversified index frequency, release without lag, and wide geographical dimension, it provides a new perspective for real-time monitoring of goods prices changes, reflecting macroeconomic operating conditions, measuring inflation inertia, predicting inflation (CPI), and another related research. Based on this, this chapter will use the monthly S-FCPI data from February 2018 to May 2022 and other macro indicators such as CPI to analyze the reliability of S-FCPI from multiple perspectives.

\subsection{Features selection}

Table \ref{Feature description.} shows the relevant indicators used in the following analysis and their specific meanings. The CPI, FCPI and FRPI published by the National Bureau of Statistics of China is selected to explore the correlation between S-FCPI and them. The online food price index published by the iCPI project is selected to analyze the correlation between S-FCPI and iCPI, as well as their ability to capture the change of CPI. The broad money supply M2 published by the National Bureau of Statistics of China and Shibor published on the official website of Shanghai Interbank Offered rate are selected to measure the impact of monetary shock, that is, the impact of demand shock on food prices. The consumer confidence index is selected to measure the correlation between consumers' subjective feelings on the current economic situation and food price changes.

Among the above indicators, the data of CPI, FCPI, FRPI and M2 are obtained from the official website of the National Bureau of Statistics of China, the data of iCPI is obtained from the official website of the iCPI project of Tsinghua University, the data of Shibor is obtained from the official website of Shanghai Interbank Offered Rate, and the consumer confidence index is obtained from the China Economic Information NET.

\begin{table}[width=.9\linewidth,pos=h]
\caption{Feature description. Here, we leave out the category $i$ in the indexes, e.g., $T$ is short for $T_i$. $i$ represents the category of foods in our study. 0: food, 1: grain; 2: tuber; 3: bean; 4: edible oil; 5: vegetables and edible fungi; 6: neat of animal; 7: meat of poultries; 8: aquatic products; 9: eggs; 10: dairy; 11: dried and fresh fruits; 12: candy and pastries; 13: condiment; 14: other food categories.}
\label{Feature description.}
\begin{tabular}{@{}lll@{}}
\toprule
Category                       & Index & Description                  \\ \midrule
\multirow{3}{*}{S-FCPI}        & $T$             & Monthly chain S-FCPI in T\"ornqvist form \\
                               & $G$             & Monthly chain S-FCPI in GFT form       \\
                               & $J$             & Monthly chain S-FCPI in Jevons form    \\ \midrule
\multirow{4}{*}{CPI}           & CPI           & China monthly chain CPI                \\
                               & FCPI          & China monthly chain FCPI               \\
                               & FRPI          & China monthly chain RPI of food        \\
                               & iCPI          & Monthly chain iCPI of food             \\ \midrule
\multirow{3}{*}{Other indexes} & M2               & Broad money                            \\
                               & Shibor           & Shanghai Interbank Offered rate        \\
                               & CC               & Consumer confidence index              \\ \bottomrule
\end{tabular}
\end{table}

\subsection{Month-on-month volatility analysis}

The chain index can be used to reflect the change degree of indicators in the report period compared with the previous period, therefore, to evaluate the ability of S-FCPI to reflect the fluctuation of price level, we draw the monthly chain price indexes of S-FCPI, CPI, FCPI and iCPI as the time series chart shown in Figure \ref{Month-on-month CPI and S-FCPI.}. Among them, the time range of S-FCPI, CPI, and FCPI is 52 months from February 2018 to May 2022, and the time range of iCPI is 41 months from January 2019 to May 2022.

\begin{figure}[!h]
	\centering
 		\includegraphics[scale=.45]{figs/SFCPI-month.pdf}
	\caption{Month-on-month CPI and S-FCPI.}
	\label{Month-on-month CPI and S-FCPI.}
\end{figure}

In addition, to quantitatively measure the proportion of months with the same change directions of S-FCPI, CPI, FCPI and iCPI, we calculate the co-directional rate among different indicators and reports it in Table \ref{Co-directional rate.}.
Here, co-directional rate $=\frac{m}{M}\times100\%$,
where $m$ is total number of months with the same change directions, $M$ is total number of months.

\begin{table}[width=.9\linewidth,cols=4,pos=h]
\caption{Co-directional rate (\%) between S-FCPI and other macro indicators.}\label{Co-directional rate.}
\begin{tabular*}{0.5\textwidth}{@{}LLLL@{} }
\toprule
 & CPI & FCPI & iCPI \\
\midrule
$T$ & 65.38 & 71.15 & 58.54\\
$G$ & 61.54 & 71.15 & 51.22\\
$J$ & 61.54 & 71.15 & 58.54\\
iCPI & 69.23 & 56.10 & - \\
\bottomrule
\end{tabular*}
\end{table}

Figure \ref{Month-on-month CPI and S-FCPI.} and Table \ref{Co-directional rate.} show that the variation directions and level of price reflected by S-FCPI and CPI are relatively close. Between January 2018 and May 2022, $T$ and CPI changed in the same directions in 34 months, accounting for 65.38\%; $G$ and CPI changed in the same directions for 27 months, accounting for 51.92\%; $J$ and CPI changed in the same directions for 27 months, accounting for 51.9\%.

The variation directions of price reflected by S-FCPI and FCPI is relatively close, but the variation level of FCPI is larger. Between January 2018 and May 2022, $T$ and FCPI changed in the same directions in 37 months, accounting for 71.15\%; $G$ and FCPI changed in the same directions for 32 months, accounting for 61.54\%; $J$ and FCPI changed in the same directions for 32 months, accounting for 61.54\%. However, Figure \ref{Month-on-month CPI and S-FCPI.} also shows that FCPI has a larger range of variation, we think that the main reason for this difference lies in the different collection methods of price data. Specifically, the raw data of CPI are collected on a few days of the month, so it can only reflect changes of price on a few days and more volatile. But S-FCPI uses the price data of all goods on sale in a month, which reduces the fluctuation caused by randomness, and finally shows that S-FCPI has a smaller variation level.

The variation directions and level of price reflected by S-FCPI and iCPI are relatively close. In addition to comparing S-FCPI with CPI and FCPI, we also compare S-FCPI with food iCPI to verify the correlation between online and offline prices. Between January 2018 and May 2022, $T$ and iCPI changed in the same directions in 24 months, accounting for 58.54\%; $G$ and iCPI changed in the same directions for 21 months, accounting for 51.22\%; $J$ and iCPI changed in the same directions for 24 months, accounting for 58.54\%, it means that the prices of online and offline goods are related.

\subsection{Month-on-month correlation analysis}
In relevant research, the chain index growth rate is usually used when analyzing the correlation between the two chain indexes, therefore, we firstly calculate the logarithmic growth rate of the chain index of each indicator, then calculates the correlation coefficient between the logarithmic growth rates of each indicator to analyze the correlation between them.

The calculation formula of logarithmic growth rate is shown in Equation (\ref{eq:growth rate}), where ${x\_rate}_t$ is logarithmic growth rate of the chain index of indicator \textit{x} from period \textit{t}-1 to period \textit{t}.
\begin{equation}
{x_{rate}}_t=\ln{x_t}-\ln{x_{t-1}}\label{eq:growth rate}.
\end{equation}
In the below, we leave out subscript $_{rate}$ in the indexes while discussing the growth rates.

\begin{table}[width=.9\linewidth,cols=5,pos=h]
\caption{Correlation between S-FCPI and other macro indicators. Note: $^{***}$, $^{**}$ and $^{*}$ are significant at the level of 1\%, 5\% and 10\% respectively.}\label{Correlation}
\begin{tabular*}{0.8\textwidth}{@{}LLLLLLLL@{}}
\toprule
& CPI & FCPI & FRPI & iCPI & M2 & Shibor & CC \\
\midrule
CPI & 1 & $0.966^{***}$ & $0.959^{***}$ & $0.509^{**}$ & $-0.449^{**}$ & $0.092$ & $-0.100$\\
FCPI & $0.966^{***}$ & $1$ & $0.992^{***}$ & $0.494^{**}$ & $-0.465^{**}$ & $0.019$ & $-0.218$\\
$T$ & $0.742^{***}$ & $0.775^{***}$ & $0.788^{***}$ & $0.415^{**}$ & $-0.484^{**}$ & $-0.128$ & $-0.263$\\
$G$ & $0.718^{***}$ & $0.761^{***}$ & $0.773^{***}$ & $0.470^{**}$ & $-0.587^{***}$ & $-0.193$ & $-0.297$\\
$J$ & $0.770^{***}$ & $0.786^{***}$ & $0.801^{***}$ & $0.375^{*}$ & $-0.381^{*}$ & $-0.146$ & $-0.189$\\
iCPI & $0.509^{**}$ & $0.494^{**}$ & $0.535^{***}$ & $1$ & $-0.703^{***}$ & $0.042$ & $-0.181$ \\
\bottomrule
\end{tabular*}
\end{table}

Table \ref{Correlation} shows that there is significant positive relationship between the growth rate of S-FCPI and the growth rate of CPI, FCPI, and FRPI in the same period at the significance level of 1\%. Specifically, the $J$ constructed by the Jevons price index, which is the same as the index formula used by the National Bureau of Statistics of China to compile CPI, and its growth rate $J$ has the strongest correlation with CPI, FCPI and FRPI, and the Pearson correlation coefficients are 0.770, 0.786, and 0.801, respectively. For $T$ constructed by T\"ornqvist price index, the correlation between its growth rate $T$ and CPI, FCPI, and FRPI is second, and the Pearson correlation coefficients are 0.742, 0.775, and 0.788, respectively. While $G$ constructed by GFT price index, its growth rate $G$ has lower correlation with CPI, FCPI, and FRPI, and the Pearson correlation coefficients are 0.718, 0.761, and 0.773, respectively.

Moreover, the growth rates of S-FCPI, CPI and FCPI are consistent with the growth rates of other macro indicators in the same period in terms of correlation and direction.
Specifically, $T$, $G$, $J$, CPI and +FCPI have significant positive correlations with iCPI at the significance level of 5\% ($J$ is at the significance level of 1\%). The Pearson correlation coefficient ranges from 0.375 to 0.510, which indicates a positive correlation between the variation of online and offline price. And they have a significant negative correlation with M2 at the significance level of 5\% ($T$ at the significance level of 10\%, $G$ at the significance level of 1\%), and the Pearson correlation coefficient is between -0.580 and -0.380, it indicates that when the price level rises, that is, when the current inflationary pressure increases, the monetary authority will reduce the contemporaneous money supply. In addition, none of them has a significant correlation with Shibor and CC.

\section{Predicting CPI by S-FCPI}
\label{sec:Predicting CPI by S-FCPI}
Considering that CPI is an important indicator for measuring the degree of inflation in China, the prediction of CPI growth rate undoubtedly has certain practical significance. In this chapter, the quantitative and qualitative predictions of CPI will be realized from two perspectives: first, predicting growth rate of CPI; second, predicting the directions and levels of CPI growth rate.

\subsection{Predicting the growth rate of CPI}
When predicting the growth rate of CPI, six machine learning models, namely Linear Regression, Random Forest, K-Neighbors, Adaboost, GBDT, and Bagging are used respectively. The target variable of the model is the current growth rate of CPI, and the features are the current growth rate of S-FCPI in T\"ornqvist form and its first-order and second-order lag terms. The prediction period is set to 12 months, so the last 12 months of the data are selected as the test data, it contains 12 months of data from June 2021 to May 2022, and the rest of the period is used as the training data, it contains 37 months of data from May 2018 to May 2021.

In addition to predicting the CPI growth rate, we also predict the FCPI growth rate, and except that the target variables are different, the rest are the same as the prediction of CPI growth rate. Table \ref{tbl:predicting CPI growth rate} reports the evaluation indicators of the prediction effects of six regression models, Figure \ref{fig:Predict CPI growth rates.} and Figure \ref{fig:Predict FCPI growth rates.} report the prediction effect of CPI and FCPI growth rate respectively, where the left side of the dotted line is the in-sample prediction, and the right side of the dotted line is the out-of-sample prediction.

\begin{table}[H]
\caption{Evaluation indicators of predicting CPI growth rate.}\label{tbl:predicting CPI growth rate}
\begin{tabular}{lllllll}
\toprule
                  & \multicolumn{3}{c}{CPI} & \multicolumn{3}{c}{FCPI} \\
                  & MAE       & RMSE      & $R^2$      & MAE        & RMSE       & $R^2$       \\ \midrule
Linear Regression & 0.0034    & 0.0039    & 0.398   & 0.0097     & 0.0134     & 0.489    \\
Random Forest     & 0.0031    & 0.0039    & 0.415   & 0.0095     & 0.0129     & 0.530    \\
K-Neighbors       & 0.0040    & 0.0050    & 0.013   & 0.0156     & 0.0186     & 0.015    \\
Adaboost          & 0.0036    & 0.0042    & 0.301   & 0.0117     & 0.0138     & 0.460    \\
GBDT              & 0.0026    & 0.0032    & 0.585   & 0.0112     & 0.0144     & 0.413    \\
Bagging           & 0.0030    & 0.0035    & 0.514   & 0.0103     & 0.0126     & 0.550    \\ \bottomrule
\end{tabular}
\end{table}

\begin{figure}[!h]
	\centering
 		\includegraphics[scale=.45]{figs/CPI-pred.pdf}
	\caption{Prediction results of CPI growth rates by S-FCPI.}
	\label{fig:Predict CPI growth rates.}
\end{figure}

\begin{figure}[!h]
	\centering
 		\includegraphics[scale=.45]{figs/FCPI-pred.pdf}
	\caption{Prediction results of FCPI growth rates by S-FCPI.}
	\label{fig:Predict FCPI growth rates.}
\end{figure}

Table \ref{tbl:predicting CPI growth rate} and Figure \ref{fig:Predict CPI growth rates.} show that the GBDT model has the best prediction effect on CPI growth rate, its MAE (0.0026) and RMSE (0.0032) are the smallest among the six models, and meanwhile the $R^2$ (0.583) is the largest. The prediction effect of Bagging model is second to GBDT model, which MAE, RMSE and $R^2$ is 0.0030, 0.0035, and 0.514, while the prediction effects of the other models are relatively poor, which will not be described in detail.

Table \ref{tbl:predicting CPI growth rate} and Figure \ref{fig:Predict FCPI growth rates.} show that the Bagging model has the best prediction effect on FCPI growth rate, its RMSE (0.0126) is the smallest among the six models and the $R^2$ (0.550) is the largest. The prediction effect of Random Forest model is second to Bagging model, which MAE, RMSE and $R^2$ is 0.0095, 0.0129, and 0.530, respectively, and using the logistic regression and the Adaboost models can also achieve a good prediction effect on the FCPI growth rate.

\subsection{Predicting the directions and levels of CPI growth rate}
For the study of macroeconomic operation, while focusing on the Accuracy of quantitative prediction results, the relevant research often pays more attention to capture the characteristics of the changing trend in the process of macroeconomic operation, that is, the qualitative prediction of directions and levels of CPI growth rate. Therefore, we use the S-FCPI growth rate to qualitatively predict the CPI growth rate from the following two perspectives: first, predicting the directions of CPI growth rate; second, predicting the levels of CPI growth rate.

Predicting the directions of CPI growth rate is a binary classification task essentially, so we use Naive Bayes, Logistic Regression, Random Forest, K-Neighbors, Adaboost and GBDT for binary classification prediction. We take whether the CPI growth rate is greater than 0 as the target variable, the month with CPI growth rate not less than 0 (CPI) is labeled as 1, which is a positive sample, and the month with CPI growth rate less than 0 (CPI) is labeled as -1, which is a negative sample. The features are current growth rate of S-FCPI in T\"ornqvist form and its first-order lag term. The prediction period is also set to 12 months, and the division between the training data and the test data is as same as the prediction of CPI growth rate. The training data contains 38 months of data from April 2018 to May 2021, of which 23 months are labeled as 1 and 15 months are labeled as -1. The test data contains 12 months of data from June 2021 to May 2022, of which 5 months are labeled as 1 and 7 months are labeled as -1.

The binary classification often pays more attention to the prediction performance of the model for a certain type of samples, but when predicting the directions of CPI growth rate, the prediction performance of the model for the two types of samples is equally important. Therefore, we use F1 score as an index to evaluate the performance of the model in predicting positive samples, and we use Accuracy to evaluate the overall predicting performance of the model.

In addition to predicting the directions of CPI growth rate, we also predict the directions of FCPI growth rate, and except that the target variables are different, the rest are the same as the prediction of the directions of CPI growth rate. Table \ref{tbl:predicting directions of CPI growth rate} reports the evaluation indicators of the prediction effects.

\begin{table}[]
\caption{Evaluation indicators of predicting the directions of CPI growth rate.}\label{tbl:predicting directions of CPI growth rate}
\begin{tabular}{lllll}
\toprule
                    & \multicolumn{2}{c}{CPI} & \multicolumn{2}{c}{FCPI} \\
                    & F1-score       & Accuracy       & F1-score         & Accuracy        \\ \midrule
Naive Bayes         & 0.667          & 0.583          & 0.824            & 0.750           \\
Logistic Regression & 0.588          & 0.417          & 0.737            & 0.583           \\
Random Forest       & 0.615          & 0.583          & 0.800            & 0.750           \\
K-Neighbors         & 0.769          & 0.750          & 0.933            & 0.917           \\
Adaboost            & 0.800          & 0.833          & 0.800            & 0.750           \\
GBDT                & 0.727          & 0.750          & 0.800            & 0.750           \\ \bottomrule
\end{tabular}
\end{table}

Table \ref{tbl:predicting directions of CPI growth rate} shows that the Adaboost model has the best prediction effect on the directions of CPI growth rate, which Accuracy is 83.3\% and accurately predicts the directions of CPI growth rate in 10 months of 12 months. The prediction effect of K-nearest and GBDT models are second to Adaboost model, which Accuracy is 75\%. For the prediction of directions of FCPI growth rate, the K-nearest mode has the best prediction effect on the directions of FCPI growth rate, which Accuracy is 91.7\% and accurately predicts the directions of FCPI growth rate in 11 months of 12 months. The prediction effect of Naive Bayes, Random Forest, and GBDT models are second to K-Neighbors model, which Accuracy is 75\%. In conclusion, the prediction effect of K-nearest neighbor, Adaboost and GBDT models are generally excellent, and the directions of CPI and FCPI growth rate can be accurately predicted by using the S-FCPI growth rate and its first-order lag term.

Since the growth rate of CPI changes to a large extent in some periods, we further divide the growth rate of CPI into three categories and takes them as the target variable of the prediction model to achieve the prediction of the levels of the CPI growth rate. Specifically, the month with CPI growth rate bigger than 0.003 ($\mu+\sigma/2$) is labeled as 1 which means the CPI growth rate has risen sharply, the month with CPI growth rate smaller than -0.003 ($\mu-\sigma/2$) is labeled as -1 which means the CPI growth rate has fallen sharply, and the other months are labeled as 0 which means the CPI growth rate fluctuates within a reasonable range. The features, the division of training data and test data, the prediction model and the model evaluation index are all the same as the prediction of the directions of CPI growth rate, which will not be described in detail. Finally, the training data contains 38 months of data from April 2018 to May 2021, of which 11 months are labeled as 1, 17 months are labeled as 0, and 10 months are labeled as -1. The teat data contains 12 months of data from June 2021 to May 2022, of which 4 months are labeled as 1, 5 months are labeled as 0, and 3 months are labeled as -1.

In addition to predicting the levels of CPI growth rate, we also predict the levels of FCPI growth rate. Table \ref{tbl:predicting levels of CPI growth rate} reports the evaluation indicators of the prediction effects.

\begin{table}[]
\caption{Evaluation indicators of predicting the levels of CPI growth rate.}\label{tbl:predicting levels of CPI growth rate}
\begin{tabular}{lllll}
\toprule
                    & \multicolumn{2}{c}{CPI} & \multicolumn{2}{c}{FCPI} \\
                    & F1-score       & Accuracy       & F1-score         & Accuracy        \\ \midrule
Naive Bayes         & 0.522          & 0.583          & 0.311            & 0.417           \\
Logistic Regression & 0.415          & 0.500          & 0.398            & 0.417           \\
Random Forest       & 0.815          & 0.833          & 0.667            & 0.667          \\
K-Neighbors         & 0.655          & 0.667          & 0.302            & 0.417           \\
Adaboost            & 0.815          & 0.833          & 0.311            & 0.417           \\
GBDT                & 0.739          & 0.750          & 0.667            & 0.667           \\ \bottomrule
\end{tabular}
\end{table}

Table \ref{tbl:predicting levels of CPI growth rate} shows that the Random Forest and Adaboost models has the best prediction effect on the levels of CPI growth rate, which Accuracy is 83.3\% and accurately predicts the levels of CPI growth rate in 10 months of 12 months. The prediction effect of GBDT model is second to them, which Accuracy is 75\%. For the prediction of the levels of FCPI growth rate, the Random Forest and GBDT models has the best prediction effect on the levels of FCPI growth rate, which Accuracy is 66.7\% and accurately predicts the levels of FCPI growth rate in 8 months of 12 months. While the prediction effect of the other models on the levels of FCPI growth rate is poor, which will not be described in detail.

In conclusion, this chapter mainly uses a variety of machine learning models to realize the quantitative prediction of CPI and FCPI growth rate, and also realizes the qualitative prediction of the directions and levels of CPI and FCPI growth rate, and obtains relatively accurate prediction effect. Therefore, the S-FCPI which with no lag can provide a new data source for the research of macro and micro economic problems such as inflation (CPI) prediction.

\section{Conclusion}
\label{sec:Conclusion}

In the era of big data, it is of great significance to build real-time and high-frequency macroeconomic indicators and the conditions are already in place. Such indicators can not only play a unique role in early warning and monitoring of macroeconomic operation, but also provide a new perspective for relevant research.  The development of scanner data provides a new data source for the compilation of CPI, applying it to the compilation of CPI can not only improve the effectiveness and frequency of CPI release, but can also make up for the defect that CPI has no weights data under the basic category. However, there is no such research result in China at present. Based on this, we use the supermarket retail scanner data provided by CAA to compile the Scanner-data Food Consumer Price Index (S-FCPI), and the main conclusions are as follows:

First, based on the compilation method of China's CPI and the method of big data, we compile the S-FCPI based on scanner data. S-FCPI has achieved a timeless release with daily, weekly, and monthly frequency, formed an index system at the city (county), provincial (district) and national levels in the geographical dimension, and formed an index system covering 75 basic categories, 14 sub-categories and general food category in the goods category dimension. S-FCPI fully proves the feasibility of using scanner data to compile price index in China and makes up for the research gap that China currently has no direct application of scanner data to the compilation of CPI. Second, we use macro indicators to test the reliability of S-FCPI from three perspectives of month-on-month volatility analysis, month-on-month correlation analysis. The conclusion of month-on-month volatility analysis shows that the price changes reflected by S-FCPI and macro indicators such as CPI are consistent, the conclusion of month-on-month correlation analysis shows that there is a highly positive correlation between S-FCPI and the growth rate of macro indicators such as CPI. Third, we use multiple machine learning models to achieve the quantitative and qualitative prediction of cpi growth rate, which proves the application value of S-FCPI in inflation prediction. In quantitative prediction, we use the growth rate of S-FCPI and its first-order and second-order lag terms to predict the growth rate of CPI and FCPI, the GBDT regressor has the best prediction effect on the CPI growth rate which the $R^2$ is 0.585, the Random Forest regressor has the best prediction effect on the FCPI growth rate which the $R^2$ is 0.530. In qualitative prediction, we use the growth rate of S-FCPI and its first-order term to predict the directions and levels of CPI and FCPI growth rate, the Adaboost classifier has the best prediction effect on the directions of CPI growth rate which the F1-score is 0.800 and the Accuracy is 0.833, and the K-Neighbors classifier has the best prediction effect on the directions of FCPI growth rate which the F1-score is 0.933 and the Accuracy is 0.917. Both Adaboost and Random Forest classifiers have the best prediction effect on the levels of CPI growth rate which the F1-score is 0.815 and the Accuracy is 0.833, Both GBDT and Random Forest classifiers have the best prediction effect on the levels of FCPI growth rate which the F1-score is 0.667 and the Accuracy is 0.667.

Relying on the unique advantages of S-FCPI, low cost, high frequency and large volume, it can not only reflect the changes in goods prices in a higher time frequency and wider geographical dimension than CPI, but can also provide a new perspective for monitoring macroeconomic operation, forecasting inflation (CPI) and other macro and micro economic issues, which is a beneficial supplement to China's CPI. However, S-FCPI still has some defects, such as only using food data of CAA database and not using online price data. In the future, S-FCPI will carry out follow-up research from multiple directions: in the research of index compilation, S-FCPI will further expand goods categories and combine the online price data; in the research of index theory, S-FCPI will conduct in-depth research on the application of chain drift and transcendental index in scanner data; in the research of economic issues, S-FCPI will conduct in-depth research on the measurement of inflation inertia, the analysis of goods prices stickiness and the heterogeneity of goods prices fluctuation among regions.