Automating Google Workspace (GWS) & more with Apps Script
Final presentation
1. Kyalo Richard
Supervisors:
Dr. Anthony Waititu, PhD
Dr. Anthony Wanjoya, PhD
Department of Statistics and Actuarial Science Jomo Kenyatta
University of Agriculture and Technology
Modeling Revenue collected
from mobile payments in Kenya
using Artificial Neural
Network
14/2/2014 MSc Applied Statistics
2. Introduction
Background
Justification
Literature review
Methodology
Empirical Results
Conclusion
References
4/2/2014 Kyalo Richard
Overview of the presentation
2
3. Mobile payment is a services operated under financial regulation
and performed from a mobile device using Sms technology instead
of using cash or credit cards.
The combined market for all types of mobile payments is expected
to reach more than $600 Billion globally by 2014 this indicates that
government earns billions of shillings every year through mobile
payment services.
It is therefore important to model mobile payments service revenue
since tax-prediction is the most important content of the tax-
planning for the government every year.
ANN possess some unique characteristics like adaptability,
nonlinearity and arbitrary function mapping ability, which make
them quite suitable and useful for prediction.
4/2/2014 Kyalo Richard
Background and motivation
3
4. Despite the fact that mobile payments generates huge revenue to
the Kenyan government there is no structure for predicting the tax
collected from this services yet it is one of the key source of
government tax in Kenya.
Our study proposes to develop a model to efficiently forecast
revenue collected from all mobile payments services in the
country in future.
4/2/2014 Kyalo Richard
Statement of the problem
4
5. Currently mobile payment service facilitates an average of $320
million per month in person-to-person transfers this is equivalent to
roughly 10 % of Kenya’s GDP on an annualized basis.
Extremely rapid uptake of mobile payment is a strong vote of
confidence by local users in a new technology as well as an
indication of significant suppressed demand for remittance services
and thus increased revenue to the government.
4/2/2014 Kyalo Richard
Justification
5
6. 4/2/2014 Kyalo Richard
Objectives
Main Objective
• The main objective was to model revenue collected from mobile
payments services using artificial neural network.
Specific objectives
• To identify factors that determines the revenue collected from
mobile payments.
• To develop a model for predicting mobile payment revenue
collection in future.
6
7. Monthly mobile payment services data between March 2007 and
June 2013 obtained from the Central Bank of Kenya website was
used in this study.
The logarithmic rates were divided into 70% training set and 30%
testing set. The training set was used to optimize the weights and
the bias of the network, while testing set was used to determine the
generalization ability of the network.
AIC and BIC criterion were used for choosing the best model that
fit the data.
The transformed data was scaled using a linear function to an
interval of 0 and 1. The quasi-newton method known as BFGS
(Broyden, Fletcher, Goldfarb and Shanno) was used to train the
model
4/2/2014 Kyalo Richard
Methodology
7
8. To measure how well a neural network performs, the following
performance measure where used.
Mean Squared Error(MSE)
(𝑦𝑡− 𝑦𝑡)2
𝑁
(1)
Mean Absolute Error(MAE)
|𝑦𝑡− 𝑦𝑡|
𝑁
(2)
Mean Absolute Percentage Error(MAPE)
(𝑦𝑡− 𝑦𝑡)2
𝑁
(3)
Root Mean Squared Error(RMSE)
1
𝑁
|𝑦𝑡− 𝑦𝑡|
𝑦𝑡
× 100 (4)
4/2/2014 Kyalo Richard
Methodology
8
9. With mobile payment services being a new entity in the capital
market neural networks have widely been used in share market
prediction, forex exchange and forecasting of the various share price
predictions, as well as for time series modeling.
Akinwale et.al (2009) used error back propagation algorithm and
regression analysis to analyze and predict untranslated and translated
Nigeria Stock Market Price.Translated NSMP prediction approach
was more accurate than untranslated NSMP using either regression
analysis or error back propagation algorithm.
Fernando and Jayawardena (1994) used various ARIMA models in
forecasting monthly rainfall records. Venama et al. (1996)
investigated climate change in the Senegal River basin via this
approach.
4/2/2014 Kyalo Richard
Literature review
9
10. Refenes et al. compared regression models with a back propagation
network both using the same stock data. The results showed that the
Mean Squared Error (MSE) for the neural network was lower than
the Multiple Linear Regression (MLR) model.
McLeod et al. (1977) applied the ARIMA approach to average
annual stream flows, annual sunspot number series and monthly
airline passenger data and suggested a different ARIMA model for
each data set.
Zhang et al., (1998) studied models of per share earnings forecasting
of neural networks with four kinds of models in 283 firms: This
research shows that the use of neural network methods provides
more accuracy in forecasting than linear forecasting models.
4/2/2014 Kyalo Richard
Literature review
10
11. Objective 1:
Fitting Generalized Least Square on the data shown an attenuating
sine wave pattern that reflected the random periodicity of the data
and possible indication for the need for Non-seasonal and/or
seasonal AR terms in the Model and hence opted for ARIMA model
using Auto ARIMA function.
Based on goodness of fit the Auto ARIMA function fitted
ARIMA(0,1,0)(0,1,1) to the data with Akaike criterion of 266.6817.
Test for normality of residual was normally distributed with the test
statistics chi square(2)=19.3535 and p-value of 6.27264e-005.
4/2/2014 Kyalo Richard
Results
11
12. Table 1: ARIMAmodel summary
4/2/2014 Kyalo Richard
Results
12
Coefficient Std. error Z p-value
Const 0.053309 0.166081 0.3210 0.7482
Theta -0.42630 0.130484 -3.267 0.0011
Rate -0.0.0264 0.077430 -0.342 0.7323
Agents -0.00018 0.000126 -1.463 0.1435
Customers -0.34002 0.504228 -0.674 0.5001
Transaction 2.80757 0.174278 16.11 2.18e-05*
The selected best models were consistent with the independence
assumption for all tests. Table 1 below show a summary ARIMA
model fit to the data
13. 4/2/2014 Kyalo Richard
Results
13
Observation from overall diagnostic
test signifies the following
• The standardized residuals don’t
show cluster of volatility
• The autocorrelation function show
no significant autocorrelation
between residuals
• The p-values for the Ljung-Box
statistics are all large, indicating
that the residuals are pattern less
meaning that the residual are white
noise.
14. 4/2/2014 Kyalo Richard
Results
14
The ACF and PACF values are all
within the 95% zero bound
indicating that there is no
correlation amongst the residuals.
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0 5 10 15 20
lag
Residual ACF
+- 1.96/T^0.5
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0 5 10 15 20
lag
Residual PACF
+- 1.96/T^0.5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
-6 -4 -2 0 2 4 6 8
uhat1
uhat1
N(-0.013338,1.859)
Test statistic for normality:
Chi-square(2) = 19.353 [0.0001]
Plot of Normality test histogram
shows a bell-shaped distribution.
These are good indicators of
Normality within the residuals
15. 4/2/2014 Kyalo Richard
Results
15
Using P-values from Table 1 Exchange rate, number of customers
and number of Agents with (p-values 0.7323, 0.5001 and 0.1435
respectively) >0.05 where not significant at 95% confidence
interval in the model.
The number of transaction with p-value 2.18e-05* was the only
significant variable in the model at 95% CI.
The number of transactions significantly determines the revenue
returns on mobile payment services unlike other predictor
variables.
16. 4/2/2014 Kyalo Richard
Results
16
Objective 2
The ANN model (developed based on the training data) with 1 hidden
node was found to show the least error, when compared with the
testing data, thereby resulting in maximum capture of the actual trend
observed with respect to monthly revenue.
Lags AIC BIC
1,2,3,4,5 -135.7117 -120.733
1,2,3,4 -136.3776 -124.3947
1,2,3 -138.4102 -129.4230
1,3,4 -137.3849 -128.3977
1,2,3,5 -136.8190 -124.8361
1,2,4 -138.2407 -129.2535
1,2* -140.8966 -134.2051
4,5 -125.6273 -119.6359
2,5 -134.0179 -128.0264
2,3,5 -132.3777 -123.3905
1,5 -140.2525 -134.2611
From table the model consisting of
lag 1 and lag 2 respectively was
identified as the optimal model using
AIC selection criterion.
Therefore the final model included
two input nodes, one hidden node and
one output node.
*indicates the ‘best’ ANN model prediction
17. 4/2/2014 Kyalo Richard
Empirical Results
17
Lags MAE MSE RMSE MAPE
1,2,3,4,5 7.0202 77.602 8.8092 5.1459
1,2,3,4 6.7848 76.8481 8.7626 4.9354
1,2,3 3.7673 21.8320 4.6725 2.7171
1,3,4 6.4166 70.3445 8.3872 4.7011
1,2,3,5 6.7199 73.3335 8.5635 4.9209
1,2,4 6.7835 76.4936 8.7460 4.9496
1,2* 3.9977 23.7633 4.8748 2.8881
4,5 6.2191 65.1414 8.0710 4.4573
2,5 7.85672 95.1691 9.7555 5.6828
2,3,5 5.2717 49.5858 7.0417 3.8516
1,5 9.2252 118.7600 10.8977 6.7356
*indicates the best ANN model for out-of-sample prediction
To validate the ANN architecture the in sample forecasting was used
where Mean Squared MSE,MAE,RMSE and MAPE test where used
for forecasting accuracy measures.
The table below shows the output of the performance measure where
the model with lag1 and 2 performed better than any other.
18. 4/2/2014 Kyalo Richard
Results
18
The plot shows Actual monthly
revenue between November 2011
to June 2013 and predicted values
using the trained neural network
model (2-1-1).
we still lack sufficient data to
facilitate satisfactory training but
with time the model may improve
with the growth of the mobile
payment dataset.
ANN being a nonparametric method, choosing the number of input
variables is very vital to avoid over fitting or under-fitting.
19. The policy implication of this study is that ANN can be used to
model revenue from mobile payments services, which is certainly
useful for various financial players such as government and policy
makers of the country.
Further research is recommended using advanced machine learning
algorithms such as Random forest which integrates boosting and
bagging of decision trees to increase predictive capability. In
addition the tree base algorithm lacks sensitivity to noise and not
subject to over fitting something ANN possess.
4/2/2014 Kyalo Richard
Conclusion
19
20. Zhang, G., Patuwo, B. E. and Hu, M. Y. (1997) El-Shazly, M. R. and
El-Shazly, H. E. (1997), ‘Comparing the Forecasting Performance of
Neural Networks and Forward Exchange Rates’, Journal of Multinational
Financial Management, 7, 345-356.
Mwita, P., Franke, J., Odhiambo, R. and Waititu, A. (2005). On
conditional quantiles: Direct Kernel Estimator and its Consistency.
African Journal of Science and Technology, Vol. 6(2), 67-76.
J. Yao, Y. Li and C. L. Tan, “Option price forecasting using neural
networks,” OMEGA: Int. Journal of Management Science, vol. 28, pp
455-466, 2000.
T. Abe, Y. Tokuda, S. Ohde, S. Ishimatsu, and R. B. Birrer, “The
influence of meteorological factors on the occurrence of trauma and motor
vehicle collisions in Tokyo,” Emergency Medicine Journal, vol. 25, no.
11, pp. 769–772, 2008.
Dickey D.A. and Fuller, W.A., “Likelihood Ratio Statistics for
Autoregressive Time Series with a Unit Root”, Econometrica, 49, 1057-
1072, 1981.
4/2/2014 Kyalo Richard
References
20
21. Kunwar Singh Vaisla, Ashutosh Kumar Bhatt, “An Analysis of
the Performance of Artificial Neural Network Technique for Stock
Market Forecasting” on (IJCSE) International Journal on Computer
Science and Engineering Vol. 02, No. 06, 2010, 2104-2109.
Medeiros M, Terasvirta, T, Rech, G. (2006) “Building Neural
Network Models for Time Series: A Statistical Approach.” Journal of
Forecasting. 25(1) pp. 49-75.
McLeod, A.I., “Diagnostic Checking Periodic Autoregression
Models with Application”, The Journal of Time Series Analysis, 15,
221-233, 1995.
4/2/2014 Kyalo Richard
References
21