Least Squares Criterion on Philippine Stocks Exchange
-
Upload
paul-samuel-lacap -
Category
Documents
-
view
214 -
download
0
Transcript of Least Squares Criterion on Philippine Stocks Exchange
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
1/20
Using Least Squares Criterion to Forecast the Profit of an
Investor using Dollar/Pesos Cost Averaging
Paul Samuel S. Lacap
Institute of Mathematical Sciences and Physics, University of the Philippines-Los Banos
Journal Info
Journal history:
Made: 28 September 2013
Submitted: 4 October 2013
Keywords:
Stock Market
Shares
Profits
Curve-Fit
Errors
Least Squares Criterion
Least Square Fit
Power Fit
ABSTRACT
In the financial world, stock market has been a
bridge that connects famous companies and the
ordinary citizen to help each other in business. A
company can get the funds it needs by selling
shares, and the investors also profits from it
waiting for the right time to sell the shares that
he/she bought from the company. However,
investing in the stock market comes with a risk.
Instead of gaining money, the investor might
lose money because of miscalculations. Due to
this reason, various strategies have been
implemented if not to remove, but minimize the
probability of losing money in the stock market.
An example of such method is called Dollar
Cost Averaging, (called Pesos Cost Averaging in
the Philippines, the name depends on the
currency of the country) with this method, the
probability of losing in the stock market islowered, due to some factors like inflation rate,
and its property that it makes an investor invest
less when the prices of shares are high and
invest more when the prices of shares are low.
Note: The Dollar in Dollar Cost Averaging is not really a part of the name of the investment strategy.
It just specifies what currency is being used when the investment strategy is applied; it is because in this
paper the words Dollar Cost Averaging and Pesos Cost Averaging are frequently interchanged. There is
only a change in the currency but it is still the same strategy.
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
2/20
Acknowledgements
I would like to thank Ptr. Adonis Reyes for giving me the idea on Pesos Cost Averaging and stock
market, without him, it would have been impossible for me to think of this paper. I would also like to
thank my parents for always encouraging me to do my best regardless of the result. I would like to thank
my friends for always cheering me up no matter how stressful my life is, I would like to thank Sir
Jonathan Mamplata for extending the deadline thus making this paper possible to be finished completely,
and lastly to an everloving God that guides me and supports me in every way.
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
3/20
1. Introduction
Dollar/Pesos Cost Averaging is a technique used
by investors in the stock market to lower the risk
of losing money. By using this strategy, the
investor will refrain from investing a large
portion of his money in a single investment but
rather will invest partial amounts of money in a
fixed interval through a long period of time
regardless of the share price. It is assumed that
by using this method, it will result in the
investor in buying fewer shares when the prices
are high and buying more shares when the prices
are low as time goes by. Because of this, the
investor will profit in the long run regardless of
how volatile the changes of prices in the stock
market. Based on the properties of Dollar/PesosCost Averaging, this study will aim to
approximate the future profit of an investor if
he/she wants to apply Dollar/Pesos Cost
averaging to buy stocks of a certain company.
By forecasting the profit, the investor will have
an idea on how much he/she will earn at the end
of his/her investment plan and make decisions
based on the forecast. He/She can also compare
his/her approximated future profit of a certain
company to the approximated future profit of
other companies suppose he/she invest their
instead.
2. Review of Related Literature
Curve fitting has been widely used in
forecasting the cost of the goods and
commodities that have volatile price changes.
An example is the paper of Stephen Alberth
entitled, Forecasting Technology costs via the
Learning Curve Myth or Magic?, wherein
he did an in depth analysis on the use of learning
curve, weighted least squares with exponentially
increasing weights, and Ordinary Least Square
to forecast technology cost. It can be seen in his
research that it is possible to forecast prices
using curve fitting.
Meanwhile, In the University of
Melbourne, Carlton 3010, Australia, a research
was done by Md. Rafiul Hassan, a computer
science, and Baikunth Nat, a software engineer,
that forecast the stock prices for interrelated
markets by using the Hidden Markov Model.This is the graph they obtained when Hidden
Markov Model was used:
Graph 1: Actual Prices vs Related Prices
As it can be seen, although there are errors, it is
acceptable just by looking at the graph and the
predicted price has a similar trend to the trend ofthe actual price.
Aside from the two researches, stock market has
been a center of research on prediction because
of its ability to give the investor profits. By
forecasting, the investor will have a guide on
investing and not invest randomly on different
companies. As it can be seen, although the
prices of the stock markets are volatile in nature,
it is possible to make a model to forecast the
shares of the prices in the future. Using thisobtained knowledge and alteration of some data
values: Instead of forecasting price, the profits
are the one forecasted. It is possible to make a
simple least squares model with acceptable
errors that can forecast an investors profit in the
long run.
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
4/20
3. Theoretical Framework
To further illustrate and to make it easier to explain mathematically what dollar/pesos cost averaging is,
an example is given below:
An example taken from: http://pesonijuan.blogspot.com/2013/01/peso-cost-averaging-in-stocks-
investing.html (No copyright infringement intended for educational use only)
BPI Common Stock Example: Stock Code: BPI
Definition Variable where each corresponding value is stored
Duration: 2 years T
Board lot* (minimum number of shares one canpurchase): 10
B
Number of times invested in an interval R
Time equivalent of an interval (normally onemonth)
I
Amount of I it takes to make 1 year C
The last period of investment i Fixed Amount Money that is Planned to beinvested per period
W (This is a constant to be given, at this example itis 5000)
Money Planned to be invested for each interval:P5000.00 initially
Share Price Dates: January 2011 to December 2012 *Board lot means that a person can only buy shares in multiple of the value of the board lot
If on January 2011, the price per share is P51.50, the P5,000 pesos in an investorscash position can buy
only 90 shares based on the board lot. With the price per share of P51.50, the total cost of 90 shares is
only P4,635.00. The remainder of P365 from the P5,000.00 ( which is just equal to P5,000 P4,635) will
stay in his/her trading account and will be added to his/her next deposit of P5,000 to be used to buy sharesagain next month. So generally the following Equations are made (equations are own interpretation, it is
not included in the website):
wherein this must be a multiple of B
( )
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
5/20
Thus, using those mathematical equations, a table is obtained below
Investment data at the end of December 2012, will be:
Total Shares Purchased: 1,860 shares Total Amount Invested: P119,341.00
Amount Left in Cash Position: P659.00 Average Price per Share: P66.07 per share
At the end of December 2012, the total present worth of investment will be:
Present worth of Investment = 1,860 shares x P95.00 per share
Total Profits at Present time = P176,700P119,341.00
Profits at Present time = P57,359.00
The Returns on Investment within two (2) years of building the investment thru PCA will be:
http://1.bp.blogspot.com/-w1piY5rqNQc/UPq5l8lJU3I/AAAAAAAAAVo/00NhY9UhEhU/s1600/BPI+Peso+Cost+Averaging+Table.PNG -
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
6/20
, note PCA means Pesos Cost Averaging
% ROI after 2 years = P57,359.00 / P119,341.00 x 100%
% ROI after 2 years = 48.06% (Percentage of how much you profit)
As it can be seen, even though the prices of the shares keeps going up and down, the investor still
manages to profit a large amount of money at the end of the investment period when Dollar/Pesos Cost
averaging is applied. Technically, this paper will focus on approximating the Overall Profits
(Profits+Money Left) by using curve fitting. The same process will be used for obtaining the needed
values to create satisfactory model for prediction.
About Curve Fitting and Regression Analysis
Curve fitting or Regression Analysis is a
widely used tool when it comes to forecasting if
given a set of data. One of the most common
Regression Analysis techniques is Linear
Regression, and this study will use one of the
popular forms of linear regression called Least-
Squares fitting.
Least Squares Fitting
One of the reasons that Least-Squares fit
is popular is because its mathematically
constructed in a way that it minimizes the
squared summation of errors.
In Equation form: ( ()) Using the criterion above, equations
have been formed to produce many models that
can be used to curve fit and forecast. The two
models that this journal will use (which will be
explained why only those two are chosen later)
is the linear-least squares line and Power fit ofdegree 2.
Linear-Least Squares Line
This technique uses the equation
() wherein:
to find the best-fitting line to a given set of
points with the property of minimizing thesquared summation of errors.
Power Fit of Degree 2
In Power Fit, the model is no longer
limited to a line, but different degrees of
polynomials can now be used to find the best
fitting line given a set of data points. The
technique uses the equation () , whereM is a known constant. Just like the previous
technique the equation of the Power fit mustsatisfy an equation (given below) to obtain the
value for:
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
7/20
4. Discussion
Without losing realism, assumptions are made to
Dollar/Pesos cost averaging to create such
conditions that using curve fitting will only
requires approximately at most a 2nd degree
polynomial. The assumptions are as of follows:
Assumption 1: An investor will invest in a well-
known successful company like PLDT, SM,
Nike etc.
Assumption 2: The investor will invest two
times a month, he will invest at the 15th day and
at the 30th day (the normal days when salary is
given). When no data of the stock market is to
be obtained on a specific month, the nearest date
after the supposed to be date recorded will be
used, for example: No records on Stock Market
on July 30 is to be found, data on August 1 will
be used instead.
Assumption 3: Extreme Deflation will not occur
(occurs very rarely in real life and almost all
countries as much as possible avoid this event)
Effects of the Assumptions
Via Assumption 1, we are sure to some extentthat the company to be invested in will not go
bankrupt and leave the stock market.
Assumption 2 will be the investment plan for
pesos cost averaging, and through Assumption
3, we can assume an increasing relationship for
the real data values to be collected, thus making
it possible to create a polynomial/model using
least squares criterion. By using the
assumptions, it is now easy to create a model by
using curve fitting.
Application
Least squares criterion will now be used in the
records of data obtained from Sun Life TSE
(Toronto Stocks Exchange)
Investor will invest in: Sun Life TSE
Currency: Dollars
Fixed Investment Amount: $100
Investment Period: January 3, 2012 to December
31, 2013
How many times to invest in an interval: Once
in every interval
Interval of Investment: Every 15th and 30th day
of the month
Condition of the Price of the share: Average:
(Max Price of the day+ Min Price of the day)/2
Assumed Board lot*: Multiple of 2
*Failed to find the data for the board lot of Sun
Life
Using the Mathematical Equations formed
earlier in the previous example, the following
table is formed below
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
8/20
Table 2.1 Records of Investments
i Date Price of a share
Money
()Shares Bought
Amount Invested
Money left
3 1/3/2012 19.36 100 4 77.44 22.56
16 1/16/2012 20.15 122.56 6 120.9 1.66
30 1/30/2012 19.9 101.66 4 79.6 22.06
46 2/15/2012 19.9 122.06 6 119.4 2.66
61 3/1/2012 22.04 102.66 4 88.16 14.5
75 3/15/2012 22.7 114.5 4 90.8 23.7
90 3/30/2012 22.04 123.7 4 88.16 35.54
107 4/16/2012 22.7 135.54 4 90.8 44.74
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
320 11/15/2012 25.34 118.92 4 101.36 17.56
335 11/30/2012 27.09 117.56 4 108.36 9.2
352 12/17/2012 27.11 109.2 4 108.44 0.76
366 12/31/2012 26.34 100.76 2 52.68 48.08
381 1/15/2013 27.61 148.08 4 110.44 37.64
396 1/30/2013 29.5 137.64 4 118 19.64
412 2/15/2013 29.05 119.64 4 116.2 3.44
426 3/1/2013 28.5 103.44 2 57 46.44
440 3/15/2013 28.68 146.44 4 114.72 31.72
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.534 6/17/2013 30.35 117.34 2 60.7 56.64
549 7/2/2013 31.21 156.64 4 124.84 31.8
562 7/15/2013 33.12 131.8 2 66.24 65.56
577 7/30/2013 33.26 165.56 4 133.04 32.52
593 8/15/2013 33.39 132.52 2 66.78 65.74
608 8/30/2013 32.13 165.74 4 128.52 37.22
625 9/16/2013 33.65 137.22 4 134.6 2.62
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
9/20
Table 2.2 Records of Profits
i Date Total shares Share
Value
Amount Invested
Profits
Profits+Money
Left
3 1/3/2012 4 77.44 77.44 0 22.56
16 1/16/2012 10 201.5 198.34 3.16 4.8230 1/30/2012 14 278.6 277.94 0.66 22.72
46 2/15/2012 20 398 397.34 0.66 3.32
61 3/1/2012 24 528.96 485.5 43.46 57.96
75 3/15/2012 28 635.6 576.3 59.3 83
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
320 11/15/2012 98 2483.32 2182.44 300.88 318.44
335 11/30/2012 102 2763.18 2290.8 472.38 481.58
352 12/17/2012 106 2873.66 2399.24 474.42 475.18
366 12/31/2012 108 2844.72 2451.92 392.8 440.88
381 1/15/2013 112 3092.32 2562.36 529.96 567.6
396 1/30/2013 116 3422 2680.36 741.64 761.28
412 2/15/2013 120 3486 2796.56 689.44 692.88
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
534 6/17/2013 146 4431.1 3543.36 887.74 944.38
549 7/2/2013 150 4681.5 3668.2 1013.3 1045.1
562 7/15/2013 152 5034.24 3734.44 1299.8 1365.36
577 7/30/2013 156 5188.56 3867.48 1321.08 1353.6
593 8/15/2013 158 5275.62 3934.26 1341.36 1407.1
608 8/30/2013 162 5205.06 4062.78 1142.28 1179.5
625 9/16/2013 166 5585.9 4197.38 1388.52 1391.14
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
10/20
Analysis of the Table
Although the overall profits are volatile,
it increases in the long run. Starting from an
overall profit of $22.56, it goes up and down and
finally increases to the value of $1391.14 on the
last given data 9/16/2013. This relationship will
be used to obtain a least-square model that will
approximate the overall profit in the long run
(future).
Least Squares Model
Initial Conditions
1. There is no limit on how much the profit will
increase.
2. There is no limit on how long the investor
wants to invest; he can keep investing as long as
he wants.
Due to the given conditions, it is not advisable to
use a polynomial of degree greater than or equal
to three, because a graph of a cubic polynomial
normally shows a limit on how much the y
values will increase (it has an asymptote and an
upper bound). Furthermore, a high degree
polynomial will tend to extremely wiggle, butthe assumption of dollar/pesos cost averaging is
that the values may be volatile, but it increases
in the long run (it only creates very small
wiggles with an increasing value of y in the
long run). Thus, the recommended degree of the
least-squares polynomial is of degree less than
or equal to 2.
Modelling
With the use of SciLab andimplementation of a Statistical Regression
Model the following Models were obtained:
Table 3.1 Key Values for Least Squares
Criterion
Method: Linear Least Squares
Value of A Value of B
Model - 236.01841+2.2029371x
Method: Power Fit of Degree 2
Value of A Value of B n/a
Model
Table 3.2 Value of the Overall Profits
based on the two models
Linear Least Squares
Time/Day Y-Value
1 -233.8154729
2 -231.6125358
.
...
304 433.6744684
305 435.8774055
.
...
720 1350.096302
Power Fit of Degree 2
Time/Day Y-Value
1 0.0035088
2 0.0140352
.
...
304 324.2692608
305 326.40612..
.
.
720 1818.96192
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
11/20
Procedures of Graphing
x-axis-values- will be the time/day counter
wherein 1 January 2012 is day 1, 2 January 2012
is day 2 31 December 2013 is day 720
y-axis-values- will be the profit obtained when
an investor sold all of his shares on a specific
date and add it with the money left/unspent and
subtracts it from the total amount of money he
invested from the beginning up to that specific
date.
In formula: y= present worth of investment +
money left - total amount of money invested
starting from moment he started to use pesos
cost averaging.
Graph of Data Values (SciLab)
Thus using SciLab to plot the values of Table
2.2, the following graph is obtained:
Graph 1: Graph of the Exact data Values
Graph of Models with Data Values (SciLab)
Then by using the models/polynomials obtained
using least squares criterion, the following graph
is obtained:
Graph 2: Graph of the Exact Data Values
with models
Black Line: Least-Squares Line
Red Line: Power Fit of Degree 2
Blue Dots: Exact Data Values
Since the unique property of the least squares
criterion is that it minimizes the squared
summation of errors, the model that will be
chosen between the two approximations will be
the one with the least squared summation of
errors.
Squared Summation of Errors:
Linear Least Squares: 1,296,068.873
Power Fit of Degree 2: 545,400.5557
Therefore, the Power Fit of Degree 2 will be
used to forecast the profit at any given time. (In
this journal, forecasts the investors profit at the
end of the investment period: 31 December
2013). Thus, to obtain the future profit in 31December 2013, the number of days is
calculated from 1 January 2012 to 31 December
2013 which is 720 days. Then the x value to be
substituted to Power Fit is 720 as shown in the
next page.
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
12/20
()Thus, the investors expected profit in 31
December 2013, assuming that he/she did notstop Dollar/Pesos Cost averaging is
approximately $1818.96192
5. Conclusion
Least-Squares Criterion is a curve fitting
method that minimizes the squared summation
of errors. However, it is not recommended when
the approximation requires a polynomial of
degree greater than 6. Fortunately Dollar/Pesos
Averaging exhibits such nature that the investors
profit will increase in the long run. It can be
clearly seen in Graph 1 that although the data
points are going up and down, the profits are
increasing in the long run starting from an
overall profit of $22.56 it increases to a value
greater than $1000 at the year 2013. Thus, such
nature enables the use of a low degree
polynomial for least squares criterion which
shows, as seen on Graph 2, acceptable results.
To answer the original problem of this study and
to meet the objective, the obtained model will be used to forecast since itsatisfies the assumptions made and is much
more accurate than linear-least squares. By using
the model, it is now possible to forecast the
investors profit at any date starting from 1
January 2013. Thus, by using the obtained
model, the approximate profit of the investor
when using Dollar/Pesos Cost Averaging at the
end of the planned investment period namely 31
December 2013 is $1818.96
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
13/20
Appendix
History of the Prices of the Shares Obtained from the Official Sun Life Webpage at
http://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CA
Appendix Table 1: Records of the Share Prices Used in this Journal
i Date Price of a share
3 1/3/2012 19.36
16 1/16/2012 20.15
30 1/30/2012 19.9
46 2/15/2012 19.9
61 3/1/2012 22.04
75 3/15/2012 22.7
90 3/30/2012 22.04
107 4/16/2012 22.7121 4/30/2012 24.18
136 5/15/2012 22.62
151 5/30/2012 20.83
167 6/15/2012 22.03
185 7/3/2012 22.56
198 7/16/2012 21.75
212 7/30/2012 21.53
228 8/15/2012 22.66
243 8/30/2012 22.95
261 9/17/2012 24.59275 10/1/2012 23.03
290 10/15/2012 23.8
304 10/30/2012 24.86
320 11/15/2012 25.34
335 11/30/2012 27.09
352 12/17/2012 27.11
366 12/31/2012 26.34
381 1/15/2013 27.61
396 1/30/2013 29.5
412 2/15/2013 29.05
426 3/1/2013 28.5
440 3/15/2013 28.68457 4/1/2013 27.59
471 4/15/2013 27.27
486 4/30/2013 28.03
501 5/15/2013 29.59
516 5/30/2013 30.91
534 6/17/2013 30.35
549 7/2/2013 31.21
562 7/15/2013 33.12
577 7/30/2013 33.26
593 8/15/2013 33.39608 8/30/2013 32.13
625 9/16/2013 33.65
http://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CAhttp://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CAhttp://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CA -
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
14/20
Appendix Table 2: Records of Values of X and Y of the Model
Linear Least Squares
Time Y-Value
1 -233.8154729
2 -231.61253583 -229.4095987
4 -227.2066616
5 -225.0037245
6 -222.8007874
7 -220.5978503
8 -218.3949132
9 -216.1919761
10 -213.989039
.
.
.
.
.
.
499 863.2472029
500 865.45014
501 867.6530771
502 869.8560142
503 872.0589513
504 874.2618884
505 876.4648255
506 878.6677626
507 880.8706997
508 883.0736368
509 885.2765739
510 887.479511
.
.
.
713 1334.675742
714 1336.878679
715 1339.081617
716 1341.284554
717 1343.487491
718 1345.690428
719 1347.893365
720 1350.096302
Power Fit of Degree 2
Time Y-Value
1 0.0035088
2 0.01403523 0.0315792
4 0.0561408
5 0.08772
6 0.1263168
7 0.1719312
8 0.2245632
9 0.2842128
10 0.35088
.
.
.
.
.
.
499 873.6947088
500 877.2
501 880.7123088
502 884.2316352
503 887.7579792
504 891.2913408
505 894.83172
506 898.3791168
507 901.9335312
508 905.4949632
509 909.0634128
510 912.63888
.
.
.
.
.
.
713 1783.765147
714 1788.772205
715 1793.78628
716 1798.807373
717 1803.835483
718 1808.870611
719 1813.912757
720 1818.96192
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
15/20
Appendix Table 3: Table of Errors
Error Measurement: Linear Least Squares
Time Y-Value Real Values Errors
3 -229.4095987 22.56 63488.67867
16 -200.7714164 4.82 42267.830530 -169.930297 22.72 37114.13693
46 -134.6833034 3.32 19044.91175
61 -101.6392469 57.96 25471.91961
75 -70.7981275 83 23653.86402
90 -37.754071 76.36 13022.0212
107 -0.3041403 106.68 11445.60628
121 30.5369791 163.24 17610.09176
136 63.5810356 65.12 2.368411424
151 96.6250921 -0.54 9441.055123
167 131.8720857 71.34 3664.133399
185 171.5249535 64.6 11432.94568
198 200.1631358 29 29296.81906
212 231.0042552 28.8 40886.56082
228 266.2512488 115 22876.94026
243 299.2953053 98.18 40447.36603
261 338.9481731 227.74 12367.25776
275 369.7892925 107.7 68690.79724
290 402.833349 178.72 50226.7932
304 433.6744684 274.68 25279.24098
320 468.921462 318.44 22644.67041
335 501.9655185 481.58 415.5693645
352 539.4154492 475.18 4126.192934
366 570.2565686 440.88 16738.2965
381 603.3006251 567.6 1274.534633
396 636.3446816 761.28 15608.83378
412 671.5916752 692.88 453.1927728
426 702.4327946 669.88 1059.684436
440 733.273914 677.12 3153.262058457 770.7238447 529.42 58227.54547
471 801.5649641 478.74 104215.9574
486 834.6090206 568.46 70835.30117
501 867.6530771 824.56 1857.013294
516 900.6971336 985.72 7228.887811
534 940.3500014 944.38 16.24088872
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
16/20
549 973.3940579 1045.1 5141.742132
562 1002.03224 1365.36 132007.061
577 1035.076297 1353.6 101457.3496
593 1070.32329 1407.1 113418.5522
608 1103.367347 1179.5 5796.180883
625 1140.817278 1391.14 62661.4654
Summation of Errors 1296068.873
Error Measurement: Power Fit of Degree 2
Time Y-Value Real Values Errors
3 0.0315792 22.56 507.5297437
16 0.8982528 4.82 15.3801011
30 3.15792 22.72 382.6749739
46 7.4246208 3.32 16.84791191
61 13.0562448 57.96 2016.347231
75 19.737 83 4002.207169
90 28.42128 76.36 2298.120875
107 40.1722512 106.68 4423.28065
121 51.3723408 163.24 12514.37317
136 64.8987648 65.12 0.048945014
151 80.0041488 -0.54 6487.359906
167 97.8569232 71.34 703.147216
185 120.08868 64.6 3078.993608
198 137.5589952 29 11785.05544
212 157.6995072 28.8 16615.08296
228 182.4014592 115 4542.956702
243 207.1911312 98.18 11883.42673
261 239.0229648 227.74 127.3052947
275 265.353 107.7 24854.46841
290 295.09008 178.72 13541.99552
304 324.2692608 274.68 2459.094787
320 359.30112 318.44 1669.631128
335 393.77508 481.58 7709.703976352 434.7543552 475.18 1634.232757
366 470.0248128 440.88 849.4201131
381 509.3409168 567.6 3394.120775
396 550.2359808 761.28 44539.57804
412 595.5977472 692.88 9463.83671
426 636.7629888 669.88 1096.736431
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
17/20
440 679.30368 677.12 4.768458342
457 732.8093712 529.42 41367.23632
471 778.3957008 478.74 89793.53902
486 828.7645248 568.46 67758.44563
501 880.7123088 824.56 3153.081784
516 934.2390528 985.72 2650.287925
534 1000.555373 944.38 3155.672509
549 1057.555829 1045.1 155.1476711
562 1108.233427 1365.36 66114.07444
577 1168.181275 1353.6 34380.10351
593 1233.866011 1407.1 30010.01488
608 1297.077043 1179.5 13824.36109
625 1370.625 1391.14 420.865225
Summation of Errors 545400.5557
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
18/20
Appendix: Program Algorithm: Least-Squares Modelling
cleardisp("Least Squares Line")
N=42
//value for x(i)Xi(1)=3Xi(2)=16Xi(3)=30Xi(4)=46Xi(5)=61Xi(6)=75Xi(7)=90Xi(8)=107Xi(9)=121Xi(10)=136Xi(11)=151Xi(12)=167
Xi(13)=185Xi(14)=198Xi(15)=212Xi(16)=228Xi(17)=243Xi(18)=261Xi(19)=275Xi(20)=290Xi(21)=304Xi(22)=320Xi(23)=335Xi(24)=352Xi(25)=366Xi(26)=381Xi(27)=396Xi(28)=412Xi(29)=426Xi(30)=440Xi(31)=457Xi(32)=471Xi(33)=486Xi(34)=501Xi(35)=516Xi(36)=534Xi(37)=549
Xi(38)=562Xi(39)=577Xi(40)=593Xi(41)=608Xi(42)=625
disp("thank you")disp("----------")
//Value for y(i)Yi(1)=22.56Yi(2)=4.82Yi(3)=22.72
Yi(4)=3.32Yi(5)=57.96Yi(6)=83Yi(7)=76.36Yi(8)=106.68Yi(9)=163.24Yi(10)=65.12Yi(11)=-0.54Yi(12)=71.34Yi(13)=64.6Yi(14)=29Yi(15)=28.8Yi(16)=115
Yi(17)=98.18Yi(18)=227.74Yi(19)=107.7Yi(20)=178.72Yi(21)=274.68Yi(22)=318.44Yi(23)=481.58Yi(24)=475.18Yi(25)=440.88Yi(26)=567.6Yi(27)=761.28Yi(28)=692.88Yi(29)=669.88Yi(30)=677.12Yi(31)=529.42Yi(32)=478.74Yi(33)=568.46Yi(34)=824.56Yi(35)=985.72Yi(36)=944.38Yi(37)=1045.1Yi(38)=1365.36Yi(39)=1353.6Yi(40)=1407.1Yi(41)=1179.5
Yi(42)=1391.14
//Get summation XkSXi=sum(Xi)
//Get summation of X^2kX2i=Xi^2SX2i=sum(X2i)
//summation of X(i)Y(i)fori=1:NXY(i)=(Xi(i)*Yi(i))
end
SXY=sum(XY)
//summation of YkSYi=sum(Yi)
//Get AAL=(N*SXY-SXi*SYi)*1/(N*SX2i-SXi^2)
//Get BBL=(SX2i*SYi-
SXi*SXY)*1/(N*SX2i-SXi^2)
//Polynomialsx=poly(0,"x")y=poly(0,"y")
y=AL*x+BL
//Power fitM=input("Please inputexponent variable M: ")fori=1:NPXMi(i)=Xi(i)^M*Yi(i)PX2Mi(i)=Xi(i)^(2*M)endSPXMi=sum(PXMi)SPX2Mi=sum(PX2Mi)
AP=SPXMi/SPX2Mi
xp=poly(0,'xp')yp=poly(0,'yp')
yp=AP*xp^M
HX=[1:0.1:720]HY=horner(y,HX)
plot(HX,HY)
HYP=horner(yp,HX)plot(HX,HYP)
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
19/20
Appendix Program: Plotting of Data Values
cleardisp("Least Squares Line")
//value for x(i)
Xi(1)=3Xi(2)=16Xi(3)=30Xi(4)=46Xi(5)=61Xi(6)=75Xi(7)=90Xi(8)=107Xi(9)=121Xi(10)=136Xi(11)=151Xi(12)=167Xi(13)=185
Xi(14)=198Xi(15)=212Xi(16)=228Xi(17)=243Xi(18)=261Xi(19)=275Xi(20)=290Xi(21)=304Xi(22)=320Xi(23)=335Xi(24)=352Xi(25)=366
Xi(26)=381Xi(27)=396Xi(28)=412
Xi(29)=426Xi(30)=440Xi(31)=457Xi(32)=471
Xi(33)=486Xi(34)=501Xi(35)=516Xi(36)=534Xi(37)=549Xi(38)=562Xi(39)=577Xi(40)=593Xi(41)=608Xi(42)=625
disp("thank you")
disp("----------")//Value for y(i)Yi(1)=22.56Yi(2)=4.82Yi(3)=22.72Yi(4)=3.32Yi(5)=57.96Yi(6)=83Yi(7)=76.36Yi(8)=106.68Yi(9)=163.24Yi(10)=65.12
Yi(11)=-0.54Yi(12)=71.34Yi(13)=64.6
Yi(14)=29Yi(15)=28.8Yi(16)=115Yi(17)=98.18
Yi(18)=227.74Yi(19)=107.7Yi(20)=178.72Yi(21)=274.68Yi(22)=318.44Yi(23)=481.58Yi(24)=475.18Yi(25)=440.88Yi(26)=567.6Yi(27)=761.28Yi(28)=692.88Yi(29)=669.88Yi(30)=677.12
Yi(31)=529.42Yi(32)=478.74Yi(33)=568.46Yi(34)=824.56Yi(35)=985.72Yi(36)=944.38Yi(37)=1045.1Yi(38)=1365.36Yi(39)=1353.6Yi(40)=1407.1Yi(41)=1179.5Yi(42)=1391.14
plot(Xi,Yi,".")
-
8/13/2019 Least Squares Criterion on Philippine Stocks Exchange
20/20
References
Stock Forecast Methods: Stock Trading and Investing. Retrieved from
http://stockforecast.wordpress.com/
Uminga, Russel Gabriel (2013),Invest in Stocks using Peso Cost Averaging Strategy. Retrieved from:
http://pesonijuan.blogspot.com/2013/01/peso-cost-averaging-in-stocks-investing.html
Matthews, John H. and Fink, Kurtis D. (1999) Numerical Methods Using MATLAB Third Edition
Ryabenkii, Victor S and Tsynkov, Semyon V. (2007) A THEORETICAL INTRODUCTION TO
NUMERICAL ANALYSIS. United States of America. Taylor & Francis Group
Return on Investment ROI retrieved from:http://www.investopedia.com/terms/r/returnoninvestment.asp 4
October 2013
Weisstein, Eric W. "Least Squares Fitting." From MathWorld--A Wolfram Web Resource.
http://mathworld.wolfram.com/LeastSquaresFitting.html
Sun Life Financial. Share History. Retrieved from
http://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CA
Hassan, Md. Rafiul and Nath Baikunth (2005). Stock Market Using Hidden Markov Model: A New
Approach. The University of Melbourne, Carlton 3010, Australia
Stephen, Albert. Forecasting Technology costs via Learning Curve-Myth or Magic?. Judge Business
School, University of Cambridge
More info: On Pesos Cost Averaging
http://www.youtube.com/watch?v=XYU4F1Gn5tY
Headings Format: (Taken from Purdue Owl)
Formatted, unnumbered:
Level 1 Heading: bold, flush left
Level 2 Heading: italics, flush left
Level 3 Heading: centered, bold
Level 4 Heading: centered, italics
Level 5 Heading: underlined, flush left
The Purdue OWL. Purdue U Writing Lab, 2010. Web. September 28, 2013
http://www.investopedia.com/terms/r/returnoninvestment.asp%204%20October%202013http://www.investopedia.com/terms/r/returnoninvestment.asp%204%20October%202013http://www.investopedia.com/terms/r/returnoninvestment.asp%204%20October%202013http://www.investopedia.com/terms/r/returnoninvestment.asp%204%20October%202013http://mathworld.wolfram.com/LeastSquaresFitting.htmlhttp://mathworld.wolfram.com/LeastSquaresFitting.htmlhttp://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CAhttp://www.youtube.com/watch?v=XYU4F1Gn5tYhttp://www.youtube.com/watch?v=XYU4F1Gn5tYhttp://www.sunlife.com/Global/Investors/Share+performance/Share+history?vgnLocale=en_CAhttp://mathworld.wolfram.com/LeastSquaresFitting.htmlhttp://www.investopedia.com/terms/r/returnoninvestment.asp%204%20October%202013http://www.investopedia.com/terms/r/returnoninvestment.asp%204%20October%202013