-php realization of trend forecast method

Source: Internet
Author: User
Tags array return variable

Trend Forecasting (Trend Forecast)/Trend Analysis (Trend method)

  Overview of Trend forecasting Method

Trend forecasting method is also called trend analysis method. Is the pattern of a function with a variable of time and a variable of time.

It also includes: Trend averaging method, exponential smoothing method, linear trend method, and non linear trend method.

The main advantage of the trend forecasting method is to consider the development trend of time series, so that the prediction results can be better conformed to the reality. Depending on the level of accuracy required, you can select one or two times to move the average to predict. The first is to calculate the average of the adjacent periods separately, and then to determine the trend and average of trends, and finally the product of the most recent average plus the trend average and the period of distance forecast time, which is the predicted value.

It is noteworthy that the first moving average in the trend moving average is different from the simple moving average method, also is the moving average of the t period, the trend moving averaging method is the average of the sum of the actual value of the T period to the t-n+1 period, while the simple moving average method is the average of the sum of the t-1 actual value to the T-n period. In the actual use of the process, must not be confused.

Edit

model of trend forecasting method

The trend moving average method is based on the first moving average starting point of the recent real value, and the slope of the trend change is estimated with two moving averages, namely:

  

  

In the formula, the At―― predicts the intercept of the line;

Bt―― predicts the slope of the line;

N―― the length of each moving average;

Number of t―― periods.

The forecast model of trend moving average method is:

  

In the formula, the K―― trend forecast period number;

YT + k―― t+k period forecast value.

Example: Take n = 5 and calculate the two moving averages as shown in table 1. Try the trend averaging method to find the 13th forecast value.

Table 1 Product sales and moving average

Month time t Actual Sales moving average at a time
(n = 5)
two times moving average
(n = 5)
1 1 1024
2 2 1040
3 3 1052
4 4 1056
5 5 1060 1046.40
6 6 1044 1050.40
7 7 1064 1055.20
8 8 1072 1059.20
9 9 1080 1064.00 1055.04
10 10 1088 1069.60 1059.68
11 11 1096 1080.00 1065.60
12 12 1092 1085.60 1071.68
Next January 13

Solution: Take t=12, then, 1085.60 and 1071.68 respectively

=2*1085.60-1071.68=1099.52

=0.5* (1085.60-1071.68) =6.96

YT + k=1099.53+6.96*1=1106.49

Edit

Case study of trend analysis methodEdit

Case one: Analysis of a company's trend analysis [1]

I. Company profile and Planning analysis

1. Corporate Development Strategy

The company is mainly engaged in the development, production, sales, service and computer software developing of railway locomotive driving safety equipment. By 2008, the total sales will reach 3.4 billion yuan, the company's staff training to achieve 70%, 80% of all types of technical personnel and management personnel have reached the undergraduate level, professional and technical personnel accounted for more than 80% of the total number of companies. The company will fully develop a new generation of security monitoring products such as transponder, and actively carry out the development of edge products such as locomotive status detection, the market will expand to the automobile, the ship "black box", the city of ATP, targeting foreign markets, to open up market areas.

2. The company's human resources status

The company has 220 employees at the end of 2005. Per capita sales income of 1.1 million yuan under 35 years old, 229 people, the average age of less than 30 years old, major in computer, automation, electronic-related professional, a small number of accounting and other professional 84% staff for college education, 78 undergraduate, master 6 people , 1 people in the doctor's reading.

Company Research and Development Department, production department, hardware and Software Development Department for the technical department. From table 1 visible Company's largest department for technical departments and service departments, marketing department is relatively weak, marketing department 34 people to complete the product sales task is very large. Research and development personnel strength is also relatively weak, high-tech talent and comprehensive management personnel lack. Structural redundancy is due to the weak technical force and the high number of service personnel. It can be seen that to meet the growing market demand in the future and maximize the benefits, the expansion and promotion of core scientific research ability is imperative.

Company's existing technical management personnel 6 people, design and development staff of 43 people (of whom professor-level senior Engineer 3 people, senior Engineer 5). Training management and secretarial 6 people. Marketing and after-sales service personnel 87 people, distributed throughout the country for security equipment products escort. From the personnel classification can be divided into management category, engineering Technology category and marketing category.

Second, the use of trend analysis method analysis

That is, according to the changes in the number of employees in the past in the enterprises or enterprises, the future trend of manpower demand is forecasted. The steps are as follows:

1. Determine the appropriate organizational factors associated with the number of labour forces. The organizational factors are directly related to the basic characteristics of the Organization in order to develop organizational planning based on this factor, and the changes in the selected factors must be proportional to the change in the number of labour required. Because the Times monitoring company is a production-oriented enterprise, organizational factors for sales.

2. The direct orientation of past trends in the future is based on the time factor as the only variable, identifying the quantitative relationship between past Labour forces and past organizational factors.

The number of the company is related to 2001-2005 years of sales and labor productivity.

3. Determine the trend of labour productivity, using data collected for a certain period of organizational factors and labor quantities, to calculate the average productivity change and organizational factors change $ $ to make amends $ to predict future changes. According to the trend of previous years, the productivity of the future years is forecast to be unchanged.

According to the above table, in accordance with the economic indicators of the company's development strategy, sales in 2008 reached 3-4 billion, the 2008 sales are expected to reach 380 million. The trend of increasing sales by 50 million per annum in 2006-2008 3 is forecasted below.

According to the 2005 labor productivity =23500÷220=106.81 million/person, forecast 2006-2008 labor productivity is invariable, 2006 forecast number =28000÷106.81=262;2007 year forecast number =33000÷106.81 = 309 people; The projected number of people in 2008 =38000÷106.81=356.

Through the above method, it can be predicted that the company should increase its staff by 2008 (356-220) = 136 people.

===================================

/**   * Numerical Trend calculation method    * @param int $datas Data sample    * @param int $k calculation period    * @param int $n mean length    * @return Array Predictive data    * @author leeldy   */  function cal_tendency ($datas, $k = 1, $n = False) {         //Data period       $t = count ($datas);    &NBSP ; Determine if n meets requirements       if ($n) {          if ($t < $n + $n-1) {              exit (' mean length n value is too large! ');         }     } else {         //MAX N value   &nbs P       $n = Intval (($t + 1)/2);     }      $m = Array (         //First average           1 => Array (),         //two average   & nbsp       2 => Array ()      );     //top N and &nbsP     $m _1 = 0;     //top n one-time average and       $m _2 = 0;     //First average start point subscript &n Bsp     $n _1 = $n-1-1;     //Two average start calculation point subscript       $n _2 = $n _1 + $n -1;         /calculation average       for ($i = 0; $i < $t; $i + +) {          &NBSP ;  //Data top N and           $m _1 = $datas [$i];              if ( $i > $n _1) {             //Start calculation one mean             &NBSP ; $m [1][$i] = $m _1/$n;             //removal first             & nbsp $m _1-= $datas [$i-$n + 1];                 //Average first N and               $m _2 = $m [1][$i];              if ($i > $n _2) {                 //Calculation two times average                   $m [2][$i] = $m _2/$n;                  $m _2 = $m [1][$i-$n + 1];  &NB Sp          }         }     }         //calculation of basic values and trend factors       $at = $m [1][$t-1] + $m [1][$t-1]-$m [2][$t -1];      $BT = 2/ ($n-1) * ($m [1][$t-1]-$m [2][$t-1]);         /calculation trend       $result = Array ( $at);      $i = 0;      while (+ + $i < $k) {          $result [$i] = $result [$i-1] + $BT;     }          return $result; }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.