Home php教程 php手册 趋势预测法-PHP实现

趋势预测法-PHP实现

Jun 21, 2016 am 08:49 AM
array nbsp

趋势预测法(Trend Forecast)/趋势分析法(Trend method)

 

趋势预测法概述

  趋势预测法又称趋势分析法。是指自变量为时间,因变量为时间的函数的模式。

  具体又包括:趋势平均法、指数平滑法、直线趋势法、非直线趋势法。

  趋势预测法的主要优点是考虑时间序列发展趋势,使预测结果能更好地符合实际。根据对准确程度要求不同, 可选择一次或二次移动平均值来进行预测。 首先是分别移动计算相邻数期的平均值,其次确定变动趋势和趋势平均值,最后以最近期的平均值加趋势平均值与距离预测时间的期数的乘积,即得预测值。

  值得注意得是,趋势移动平均法中的第一次移动平均与简单移动平均法不同, 同样是第 t 期的移动平均值,趋势移动平均法是求第 t 期实际值到第 t-n+1 期之和的平均值,而简单移动平均法是求第 t-1 项实际值到第 t-n 期之和的平均值。 在实际运用过程中,千万不能混淆。

[编辑]

趋势预测法的模型

  趋势移动平均法以最近实际值的一次移动平均值起点,以二次移动平均值估计趋势变化的斜率,建立预测模型,即:

  

  

  式中,at―― 预测直线的截距;

     bt―― 预测直线的斜率;

     n ―― 每次移动平均的长度;

     t ―― 期数。

  趋势移动平均法的预测模型为:

  

  式中, k ―― 趋势预测期数;

     yt + k―― 第t+k期预测值。

  例: 取 n = 5 ,计算出二次移动平均值如表1所示。试用趋势平均法求第 13 期的预测值。

  表1产品销售额及移动平均值

月份 时期 t 实际销售额 一次移动平均
( n = 5 )
二次移动平均
( 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
次年 1 月 13

  解:取t=12,则、分别为1085.60和1071.68

  =2*1085.60-1071.68=1099.52

  =0.5*(1085.60-1071.68)=6.96

  yt + k=1099.53+6.96*1=1106.49

[编辑]

趋势分析法案例分析

[编辑]

案例一:某公司的趋势分析法分析[1]

  一、公司概况及规划分析

  1.公司发展战略

  该公司主要从事铁路机车行车安全装备的研发、生产、销售、服务和计算机软件开发工作。到2008年,将争取销售总额达到3-4亿元,实现公司员工培训面达到70%,80%的各类技术人员和管理人员均达到本科以上水平,专业技术人员占公司总人数的80%以上。公司将全力开发新一代安全监控型产品如应答器,积极开展边缘产品的开发如机车状态检测,将市场拓展到汽车、船舶“黑匣子”、城轨ATP,瞄准国外市场,开拓市场新领域。

  2.公司人力资源现状

  公司2005年末有员工220人,人均销售收入110万元35岁以下青年员工 229人,平均年龄不到30岁,专业主要集中在计算机、自动化、电子相关专业,有少量财会专业和其他专业人员84%人员为大专以上学历,本科78人,硕士6人,在读博士1人。

  公司研发部、生产部、软硬件开发部合为技术部门.从表1可见公司最大部门为技术部门和服务部门,营销部能力相对薄弱,营销部34人所要完成的产品销售任务很大。研发人员力量也比较薄弱;高科技人才和综合性管理人才缺乏。由于技术力量的薄弱和服务人员偏多造成结构性冗余。可见,要满足未来日益扩大的市场需求和实现效益最大化,核心科研能力的扩充和提升势在必行。

  公司现有技术管理人员6人,设计开发人员43人(其中教授级高级工程师3人,高级工程师5人)。培训管理与文秘6人。市场推广和售后服务人员87人,分布在全国各地为安全装备产品保驾护航。从人员分类可分为管理类、工程技术类和营销类。

  二、采用趋势分析法的分析

  即根据企业或企业中各个部门过去的员工数量变动状况,对未来的人力需求变动趋势作出预测。其步骤如下:

  1.确定适当的与劳动力数量相关的组织因素。该组织因素与组织的基本特性直接相关,以便根据这一因素来制定组织规划, 所选因素的变化必须与所需劳动力数量的变化成比例。由于时代监控公司是生产型企业,组织因素为销售额。

  2.把过去的趋势直接导向未来是以时间因素为唯一变量的,找出过去的劳动力量与过去的组织因素之间的数量关系。

  该公司的数量关系为2001-2005年的销售额及劳动生产率。

  3.确定劳动生产率的趋势,利用收集到的一定时期的组织因素与劳动力数量的数据,计算出平均的生产率变化和组织因素的变化$作出修正$预测未来的变化。根据前几年的趋势,预测未来几年的劳动生产率不变。

  由上表可知,根据公司发展战略中的经济指标,在2008年销售额达到3-4个亿,预计2008年销售额将达3.8亿.从2006-2008年3年中每年增加销售额0.5亿的数量趋势作出以下预测。

  根据2005年的劳动生产率=23500÷220=106.81万元/人,预测2006-2008年劳动生产率不变的情况下,2006年的预测人数=28000÷106.81=262;2007年的预测人数=33000÷106.81=309人;2008年的预测人数=38000÷106.81=356人。

  通过上述方法,可预测出公司到2008年员工需增加(356-220)=136人。

 

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

/** 

 * 数值趋势测算法 

 * @param int $datas 数据样本 

 * @param int $k 测算期数 

 * @param int $n 平均值长度 

 * @return array 预测数据 

 * @author leeldy 

 */ 

function cal_tendency($datas, $k = 1, $n = false) { 

 

 

    //数据期数 

    $t = count($datas); 

    //判断n是否满足要求 

    if ($n) { 

        if ($t

            exit('平均值长度n数值过大!'); 

        } 

    } else { 

        //取最大的n值 

        $n = intval(($t + 1) / 2); 

    } 

    $m = array( 

        //一次平均值 

        1 => array(), 

        //二次平均值 

        2 => array() 

    ); 

    //前n项和 

    $m_1 = 0; 

    //前n项一次平均值和 

    $m_2 = 0; 

    //一次平均值开始计算点下标 

    $n_1 = $n - 1 - 1; 

    //二次平均值开始计算点下标 

    $n_2 = $n_1 + $n - 1; 

 

 

    //计算平均值 

    for ($i = 0; $i

 

 

        //数据前n项和 

        $m_1 += $datas[$i]; 

 

 

        if ($i > $n_1) { 

            //开始计算一次平均值 

            $m[1][$i] = $m_1 / $n; 

            //去除最前一项 

            $m_1 -= $datas[$i - $n + 1]; 

 

 

            //一次平均值前n项和 

            $m_2 += $m[1][$i]; 

            if ($i > $n_2) { 

                //计算二次平均值 

                $m[2][$i] = $m_2 / $n; 

                $m_2 -= $m[1][$i - $n + 1]; 

            } 

        } 

    } 

 

 

    //计算基本值和趋势系数 

    $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]); 

 

 

    //计算趋势 

    $result = array($at); 

    $i = 0; 

    while (++$i

        $result[$i] = $result[$i - 1] + $bt; 

    } 

 

 

    return $result; 

}



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution: Your organization requires you to change your PIN Solution: Your organization requires you to change your PIN Oct 04, 2023 pm 05:45 PM

The message "Your organization has asked you to change your PIN" will appear on the login screen. This happens when the PIN expiration limit is reached on a computer using organization-based account settings, where they have control over personal devices. However, if you set up Windows using a personal account, the error message should ideally not appear. Although this is not always the case. Most users who encounter errors report using their personal accounts. Why does my organization ask me to change my PIN on Windows 11? It's possible that your account is associated with an organization, and your primary approach should be to verify this. Contacting your domain administrator can help! Additionally, misconfigured local policy settings or incorrect registry keys can cause errors. Right now

How to adjust window border settings on Windows 11: Change color and size How to adjust window border settings on Windows 11: Change color and size Sep 22, 2023 am 11:37 AM

Windows 11 brings fresh and elegant design to the forefront; the modern interface allows you to personalize and change the finest details, such as window borders. In this guide, we'll discuss step-by-step instructions to help you create an environment that reflects your style in the Windows operating system. How to change window border settings? Press + to open the Settings app. WindowsI go to Personalization and click Color Settings. Color Change Window Borders Settings Window 11" Width="643" Height="500" > Find the Show accent color on title bar and window borders option, and toggle the switch next to it. To display accent colors on the Start menu and taskbar To display the theme color on the Start menu and taskbar, turn on Show theme on the Start menu and taskbar

How to change title bar color on Windows 11? How to change title bar color on Windows 11? Sep 14, 2023 pm 03:33 PM

By default, the title bar color on Windows 11 depends on the dark/light theme you choose. However, you can change it to any color you want. In this guide, we'll discuss step-by-step instructions for three ways to change it and personalize your desktop experience to make it visually appealing. Is it possible to change the title bar color of active and inactive windows? Yes, you can change the title bar color of active windows using the Settings app, or you can change the title bar color of inactive windows using Registry Editor. To learn these steps, go to the next section. How to change title bar color in Windows 11? 1. Using the Settings app press + to open the settings window. WindowsI go to "Personalization" and then

OOBELANGUAGE Error Problems in Windows 11/10 Repair OOBELANGUAGE Error Problems in Windows 11/10 Repair Jul 16, 2023 pm 03:29 PM

Do you see "A problem occurred" along with the "OOBELANGUAGE" statement on the Windows Installer page? The installation of Windows sometimes stops due to such errors. OOBE means out-of-the-box experience. As the error message indicates, this is an issue related to OOBE language selection. There is nothing to worry about, you can solve this problem with nifty registry editing from the OOBE screen itself. Quick Fix – 1. Click the “Retry” button at the bottom of the OOBE app. This will continue the process without further hiccups. 2. Use the power button to force shut down the system. After the system restarts, OOBE should continue. 3. Disconnect the system from the Internet. Complete all aspects of OOBE in offline mode

How to enable or disable taskbar thumbnail previews on Windows 11 How to enable or disable taskbar thumbnail previews on Windows 11 Sep 15, 2023 pm 03:57 PM

Taskbar thumbnails can be fun, but they can also be distracting or annoying. Considering how often you hover over this area, you may have inadvertently closed important windows a few times. Another disadvantage is that it uses more system resources, so if you've been looking for a way to be more resource efficient, we'll show you how to disable it. However, if your hardware specs can handle it and you like the preview, you can enable it. How to enable taskbar thumbnail preview in Windows 11? 1. Using the Settings app tap the key and click Settings. Windows click System and select About. Click Advanced system settings. Navigate to the Advanced tab and select Settings under Performance. Select "Visual Effects"

Display scaling guide on Windows 11 Display scaling guide on Windows 11 Sep 19, 2023 pm 06:45 PM

We all have different preferences when it comes to display scaling on Windows 11. Some people like big icons, some like small icons. However, we all agree that having the right scaling is important. Poor font scaling or over-scaling of images can be a real productivity killer when working, so you need to know how to customize it to get the most out of your system's capabilities. Advantages of Custom Zoom: This is a useful feature for people who have difficulty reading text on the screen. It helps you see more on the screen at one time. You can create custom extension profiles that apply only to certain monitors and applications. Can help improve the performance of low-end hardware. It gives you more control over what's on your screen. How to use Windows 11

10 Ways to Adjust Brightness on Windows 11 10 Ways to Adjust Brightness on Windows 11 Dec 18, 2023 pm 02:21 PM

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

How to Fix Activation Error Code 0xc004f069 in Windows Server How to Fix Activation Error Code 0xc004f069 in Windows Server Jul 22, 2023 am 09:49 AM

The activation process on Windows sometimes takes a sudden turn to display an error message containing this error code 0xc004f069. Although the activation process is online, some older systems running Windows Server may experience this issue. Go through these initial checks, and if they don't help you activate your system, jump to the main solution to resolve the issue. Workaround – close the error message and activation window. Then restart the computer. Retry the Windows activation process from scratch again. Fix 1 – Activate from Terminal Activate Windows Server Edition system from cmd terminal. Stage – 1 Check Windows Server Version You have to check which type of W you are using

See all articles