特别公告:请认准官方联系方式

经举报,有人冒用本司名义招摇撞骗!请注意:我们仅有网站在线聊天一种实时通讯工具,我们不会通过Skype、微信、WhatsApp、Discord等任何其他工具联系您,请谨防受骗!

线性回归

2015-01-07 14:32:49


线性回归是指利用最小二乘法计算出所选择的数据距离的一条直线。


最小二乘法的和
最小二乘法为比较哪一条直线与所选数据最接近提供了一个客观的衡量标准。
1. 绘出所给定的数据点。
2. 计算每点到给定的一条直线的距离。
3. 计算出该距离的平方数(为了便于去除负值)。
4. 计算出所有平方数的和。
5. 每一条可能的直线都重复步骤2、3、4
6. 根据第四步计算的平方和挑选出与所选数据最近的一条直线。


示例
下图表格展示了一条直线的最小二乘法计算步骤。
价格 = 20.50 + 0.11 * 天数n

 11.jpg
选定数据与每一条直线的距离的平方和都要分别计算出来。并选取平方和最小的一条直线。


数学计算公式
运用最小二乘法手动的计算每条可能直线的距离平方和将会消耗很多时间。幸运的是,下面是一种较为简便的方法:
目标直线的计算公式为: y = a + bx
• y 表示价格
• x 是日期
• a 是常数
• b 是直线的斜率
目标直线的计算公式为
b = ( nΣxy - ΣxΣy ) / ( nΣx² - (Σx)² )
a = ( Σy - bΣx ) / n


其中,n是所有选定数据的数值。


Linear Regression
Linear regression fits a straight line to the selected data using a method called the Sum Of Least Squares.
Sum Of Least Squares
The Sum Of Least Squares method provides an objective measure for comparing a number of straight lines to find the one that best fits the selected data.
1. Plot each data point in a table
2. Calculate the distance between each data point and the proposed straight line
3. Square the distances (to remove negative values)
4. Calculate the sum of the squares
5. Repeat steps 2 to 4 for each possible line
6. Select the line with the lowest sum of squares (from step 4).
EXAMPLE
The table below demonstrates how the sum of squares is calculated for a line where
Price = 20.50 + 0.11 * day n
The sum of squares is calculated for each possible line and the line with the lowest sum is selected.
Mathematical Formula
Manually calculating the sum of squares for each possible line would be enormously time-consuming. Fortunately there is a quicker way.
The formula for a straight line is
y = a + bx


For our purposes:
• y is the price
• x is the date
• a is the constant (the value when x equals zero)
• b is the slope of the line
The formula for calculating the line of best fit is
b = ( nΣxy - ΣxΣy ) / ( nΣx² - (Σx)² )
a = ( Σy - bΣx ) / n
Where n is the number of data points selected.


本文翻译由兄弟财经提供


文章来源:
http://www.incrediblecharts.com/indicators/linear_regression.php

 承诺与声明

兄弟财经是全球历史最悠久,信誉最好的外汇返佣代理。多年来兄弟财经兢兢业业,稳定发展,获得了全球各地投资者的青睐与信任。历经十余年的积淀,打造了我们在业内良好的品牌信誉。

本文所含内容及观点仅为一般信息,并无任何意图被视为买卖任何货币或差价合约的建议或请求。文中所含内容及观点均可能在不被通知的情况下更改。本文并未考 虑任何特定用户的特定投资目标、财务状况和需求。任何引用历史价格波动或价位水平的信息均基于我们的分析,并不表示或证明此类波动或价位水平有可能在未来 重新发生。本文所载信息之来源虽被认为可靠,但作者不保证它的准确性和完整性,同时作者也不对任何可能因参考本文内容及观点而产生的任何直接或间接的损失承担责任。

外汇和其他产品保证金交易存在高风险,不适合所有投资者。亏损可能超出您的账户注资。增大杠杆意味着增加风险。在决定交易外汇之前,您需仔细考虑您的财务目标、经验水平和风险承受能力。文中所含任何意见、新闻、研究、分析、报价或其他信息等都仅 作与本文所含主题相关的一般类信息.

同时, 兄弟财经不提供任何投资、法律或税务的建议。您需向合适的顾问征询所有关于投资、法律或税务方面的事宜。