This paper mainly uses the idea of pedigree clustering analysis, gray prediction and principal component analysis. The clustering analysis model, GM (1,1) model and principal component analysis model were established by using SPSS software to analyze the correlation matrices and principal component analysis. MATLAB software was used to calculate the correlation matrices. In January, The difference in price changes of major food prices in cities is calculated, and had forecasted the various food prices in June 2016. For the first issue, the main food is classified and the data are processed. After that, the SPSS software is used to classify the 27 kinds of food into four categories by using the pedigree cluster analysis model and the system clustering. The four categories are made by EXCEL. The price of food changes over time with a line chart that analyzes the characteristics of food price volatility. For the second issue, the gray prediction model is established based on the food classification of each kind of food price. First, the original data is cumulated, test and processed, so that the data have a strong regularity, and then establish a gray differential equation, and then use MATLAB software to solve the model. And then the residual test and post-check test, have C <0.35, the prediction accuracy is better. Finally, predict the price trend in June 2016 through the function. For the third issue, we analyzed the main components of 27 kinds of food types by celery, octopus, chicken (white striped chicken), duck and Chinese cabbage by using the data of principal given and analyzed by principal component analysis. It can be detected by measuring a small amount of food, this predict CPI value relatively accurate. Through the study of the characteristics of the region, select Shanghai and Shenyang, by looking for the relevant CPI and food price data, using spss software, principal component analysis, the impact of the CPI on several types of food, and then calculated by matlab algorithm weight, and then the data obtained by the analysis and comparison, different regions should be selected for different types of food for testing.