This document provides an introduction to time series analysis using R. It discusses key concepts like stationarity, unit roots, and integrated processes. It demonstrates how to check for stationarity in the SPY ETF price series and returns. Non-stationary price data can be made stationary by taking the first difference (returns). Unit root tests like the Augmented Dickey-Fuller test are used to formally test for a unit root. The document also shows how to access real-time market data using the IBrokers package in R.
This document discusses important issues in machine learning for data mining, including the bias-variance dilemma. It explains that the difference between the optimal regression and a learned model can be measured by looking at bias and variance. Bias measures the error between the expected output of the learned model and the optimal regression, while variance measures the error between the learned model's output and its expected output. There is a tradeoff between bias and variance - increasing one decreases the other. This is known as the bias-variance dilemma. Cross-validation and confusion matrices are also introduced as evaluation techniques.
This document describes an uncertain volatility model for pricing equity option trading strategies when the volatilities are uncertain. It uses the Black-Scholes Barenblatt equation developed by Avellaneda et al. to derive price bounds. The model is implemented in C++ using recombining trinomial trees to discretize the asset prices over time and space. The code computes the upper and lower price bounds by solving the Black-Scholes Barenblatt PDE using numerical techniques, with the volatility set based on the sign of the option gamma.
The document discusses pricing interest rate derivatives using the one factor Hull-White short rate model. It begins with an introduction to short rate models and the Hull-White model specifically. It describes how the Hull-White model can be calibrated to market prices by relating its parameter θ to the market term structure. The document then discusses implementing the Hull-White model using trinomial trees and pricing constant maturity swaps.
Pricing Exotics using Change of NumeraireSwati Mital
The intention of this essay is to show how change of numeraire technique is used in pricing derivatives with complex payoffs. In the first instance, we apply the technique to pricing European Call Options and then use the same method to price an exotic Power Option.
1. Recurrent neural networks (RNNs) allow information to persist from previous time steps through hidden states and can process input sequences of variable lengths. Common RNN architectures include LSTMs and GRUs which address the vanishing gradient problem of traditional RNNs.
2. RNNs are commonly used for natural language processing tasks like machine translation, sentiment classification, and named entity recognition. They learn distributed word representations through techniques like word2vec, GloVe, and negative sampling.
3. Machine translation models use an encoder-decoder architecture with an RNN encoder and decoder. Beam search is commonly used to find high-probability translation sequences. Performance is evaluated using metrics like BLEU score.
In this lecture, you will learn two of the most popular methods for classifying data points into a finite set of categories. Both methods are based on representing a classifier via its decision boundary which is a hyperplane. The parameters of the hyperplane are learned from training data by minimizing a particular loss function.
- The document analyzes forecasting volatility for the MSCI Emerging Markets Index using a Stochastic Volatility model solved with Kalman Filtering. It derives the Stochastic Differential Equations for the model and puts them into State Space form solved with a Kalman Filter.
- Descriptive statistics on the daily returns of the MSCI Emerging Markets Index ETF from 2011-2016 show a mean close to 0, standard deviation of 0.01428, negative skewness, and kurtosis close to a normal distribution. The model will be evaluated against a GARCH model.
This document discusses important issues in machine learning for data mining, including the bias-variance dilemma. It explains that the difference between the optimal regression and a learned model can be measured by looking at bias and variance. Bias measures the error between the expected output of the learned model and the optimal regression, while variance measures the error between the learned model's output and its expected output. There is a tradeoff between bias and variance - increasing one decreases the other. This is known as the bias-variance dilemma. Cross-validation and confusion matrices are also introduced as evaluation techniques.
This document describes an uncertain volatility model for pricing equity option trading strategies when the volatilities are uncertain. It uses the Black-Scholes Barenblatt equation developed by Avellaneda et al. to derive price bounds. The model is implemented in C++ using recombining trinomial trees to discretize the asset prices over time and space. The code computes the upper and lower price bounds by solving the Black-Scholes Barenblatt PDE using numerical techniques, with the volatility set based on the sign of the option gamma.
The document discusses pricing interest rate derivatives using the one factor Hull-White short rate model. It begins with an introduction to short rate models and the Hull-White model specifically. It describes how the Hull-White model can be calibrated to market prices by relating its parameter θ to the market term structure. The document then discusses implementing the Hull-White model using trinomial trees and pricing constant maturity swaps.
Pricing Exotics using Change of NumeraireSwati Mital
The intention of this essay is to show how change of numeraire technique is used in pricing derivatives with complex payoffs. In the first instance, we apply the technique to pricing European Call Options and then use the same method to price an exotic Power Option.
1. Recurrent neural networks (RNNs) allow information to persist from previous time steps through hidden states and can process input sequences of variable lengths. Common RNN architectures include LSTMs and GRUs which address the vanishing gradient problem of traditional RNNs.
2. RNNs are commonly used for natural language processing tasks like machine translation, sentiment classification, and named entity recognition. They learn distributed word representations through techniques like word2vec, GloVe, and negative sampling.
3. Machine translation models use an encoder-decoder architecture with an RNN encoder and decoder. Beam search is commonly used to find high-probability translation sequences. Performance is evaluated using metrics like BLEU score.
In this lecture, you will learn two of the most popular methods for classifying data points into a finite set of categories. Both methods are based on representing a classifier via its decision boundary which is a hyperplane. The parameters of the hyperplane are learned from training data by minimizing a particular loss function.
- The document analyzes forecasting volatility for the MSCI Emerging Markets Index using a Stochastic Volatility model solved with Kalman Filtering. It derives the Stochastic Differential Equations for the model and puts them into State Space form solved with a Kalman Filter.
- Descriptive statistics on the daily returns of the MSCI Emerging Markets Index ETF from 2011-2016 show a mean close to 0, standard deviation of 0.01428, negative skewness, and kurtosis close to a normal distribution. The model will be evaluated against a GARCH model.
Here a Review of the Combination of Machine Learning models from Bayesian Averaging, Committees to Boosting... Specifically An statistical analysis of Boosting is done
This document provides tips and tricks for deep learning including data augmentation techniques, batch normalization, training procedures like epochs and mini-batch gradient descent, loss functions like cross-entropy loss, and parameter tuning methods such as transfer learning, adaptive learning rates, dropout, and early stopping. It also discusses good practices like overfitting small batches and gradient checking.
A gentle introduction to 2 classification techniques, as presented by Kriti Puniyani to the NYC Predictive Analytics group (April 14, 2011). To download the file please go here: http://www.meetup.com/NYC-Predictive-Analytics/files/
Affine Term Structure Model with Stochastic Market Price of RiskSwati Mital
- The document proposes a new affine term structure model that combines principal components analysis with a stochastic market price of risk.
- Principal components provide useful information about yield curves and only three components explain over 95% of yield variation.
- Previous models linked risk premium deterministically to return-predicting factors like slope, but this could result in unrealistic risk premium levels.
- The new model introduces an additional state variable to capture the stochastic market price of risk and break the deterministic link between risk premium and return-predicting factors.
This document introduces deep learning approaches for predicting spatio-temporal flows. It discusses how deep learning uses hierarchical layers to model complex nonlinear relationships in spatial and temporal data without assuming a data generation process. Examples are given of applying deep learning to predict traffic flows using loop detector data and to forecast stock price movements using limit order book imbalances. The document outlines the configuration of deep learning models for these tasks and evaluates their performance versus traditional statistical approaches.
The document appears to be lecture notes for a calculus class that covers several topics:
- Defining the derivative and discussing rates of change, tangent lines, velocity, population growth, and marginal costs.
- Worked examples are provided for finding the slope of a tangent line, instantaneous velocity, instantaneous population growth rate, and marginal cost of production.
- Numerical approximations are used to estimate some values when exact solutions are difficult to obtain analytically.
The comparative study of finite difference method and monte carlo method for ...Alexander Decker
This document compares the finite difference method and Monte Carlo method for pricing European options. The finite difference method solves the Black-Scholes partial differential equation by approximating it on a grid, while the Monte Carlo method simulates asset price paths and averages discounted payoffs. The study finds that while both methods agree with the Black-Scholes price, the finite difference method converges faster and is more accurate for standard European options, whereas Monte Carlo is better suited for exotic options due to its flexibility.
This document provides an overview of machine learning concepts for assessing model performance including metrics, model selection, and diagnostics. It discusses classification and regression metrics like accuracy, precision, recall, ROC curves, and coefficients of determination. Model selection techniques covered are training/validation/test sets, cross-validation, and regularization. Diagnostics examines bias/variance tradeoffs and remedies for underfitting and overfitting.
The document provides an introduction to TreeNet, a machine learning algorithm developed by Jerome Friedman. TreeNet builds regression and classification models in a stagewise fashion, using small regression trees at each stage to model residuals from the previous stage. It employs techniques like learning small trees, subsampling data, and using a small learning rate to minimize overfitting. TreeNet models can be very accurate while remaining resistant to overfitting.
Dynamic Programming design technique is one of the fundamental algorithm design techniques, and possibly one of the ones that are hardest to master for those who did not study it formally. In these slides (which are continuation of part 1 slides), we cover two problems: maximum value contiguous subarray, and maximum increasing subsequence.
This document provides an overview of key concepts in machine learning including neural networks, convolutional neural networks, recurrent neural networks, reinforcement learning, and control. It defines common neural network components like layers, activation functions, loss functions, and backpropagation. It also explains concepts in convolutional neural networks like convolutional layers and batch normalization. Recurrent neural networks components discussed include different gate types. Reinforcement learning concepts covered are Markov decision processes, policies, value functions, Bellman equations, value iteration algorithm, and Q-learning.
Divide and Conquer Algorithms - D&C forms a distinct algorithm design technique in computer science, wherein a problem is solved by repeatedly invoking the algorithm on smaller occurrences of the same problem. Binary search, merge sort, Euclid's algorithm can all be formulated as examples of divide and conquer algorithms. Strassen's algorithm and Nearest Neighbor algorithm are two other examples.
This document provides an overview of VAE-type deep generative models, especially RNNs combined with VAEs. It begins with notations and abbreviations used. The agenda then covers the mathematical formulation of generative models, the Variational Autoencoder (VAE), variants of VAE that combine it with RNNs (VRAE, VRNN, DRAW), a Chainer implementation of Convolutional DRAW, other related models (Inverse DRAW, VAE+GAN), and concludes with challenges of VAE-like generative models.
This document provides an overview of convolutional neural networks (CNNs) and their applications. It discusses the common layers in a CNN like convolutional layers, pooling layers, and fully connected layers. It also covers hyperparameters for convolutional layers like filter size and stride. Additional topics summarized include object detection algorithms like YOLO and R-CNN, face recognition models, neural style transfer, and computational network architectures like ResNet and Inception.
Chap 8. Optimization for training deep modelsYoung-Geun Choi
연구실 내부 세미나 자료. Goodfellow et al. (2016), Deep Learning, MIT Press의 Chapter 8을 요약/발췌하였습니다. 깊은 신경망(deep neural network) 모형 훈련시 목적함수 최적화 방법으로 흔히 사용되는 방법들을 소개합니다.
Dynamic Programming is an algorithmic paradigm that solves a given complex problem by breaking it into subproblems and stores the results of subproblems to avoid computing the same results again.
This document discusses algorithms for finding minimum and maximum elements in an array, including simultaneous minimum and maximum algorithms. It introduces dynamic programming as a technique for improving inefficient divide-and-conquer algorithms by storing results of subproblems to avoid recomputing them. Examples of dynamic programming include calculating the Fibonacci sequence and solving an assembly line scheduling problem to minimize total time.
This document provides an overview of the CS303 Computer Algorithms course taught by Dr. Yanxia Jia. It discusses the importance of algorithms, provides examples of classic algorithm problems like sorting and searching, and summarizes common algorithm design techniques and data structures used, including arrays, linked lists, stacks, queues, heaps, graphs and trees.
dynamic programming complete by Mumtaz Ali (03154103173)Mumtaz Ali
The document discusses dynamic programming, including its meaning, definition, uses, techniques, and examples. Dynamic programming refers to breaking large problems down into smaller subproblems, solving each subproblem only once, and storing the results for future use. This avoids recomputing the same subproblems repeatedly. Examples covered include matrix chain multiplication, the Fibonacci sequence, and optimal substructure. The document provides details on formulating and solving dynamic programming problems through recursive definitions and storing results in tables.
This document presents a new multivariate fuzzy time series forecasting method to predict car road accidents. The method uses four secondary factors (number killed, mortally wounded, died 30 days after accident, severely wounded, and lightly casualties) along with the main factor of total annual car accidents in Belgium from 1974 to 2004. The new method establishes fuzzy logical relationships between the factors to generate forecasts. Experimental results show the proposed method performs better than existing fuzzy time series forecasting approaches at predicting car accidents. Actuaries can use this kind of multivariate fuzzy time series analysis to help define insurance premiums and underwriting.
This document summarizes a master's thesis that implemented a continuous sequential importance resampling (CSIR) algorithm to estimate predictive densities in stochastic volatility (SV) models. The thesis began with an introduction to relevant econometrics concepts. It then explained SV models and particle filtering approaches. The thesis described implementing and testing functions to develop an R package for CSIR estimation in SV models. Diagnostics and parameter estimates from simulated and real stock return data were reported. The thesis concluded by discussing the package's applications and potential for future development.
Here a Review of the Combination of Machine Learning models from Bayesian Averaging, Committees to Boosting... Specifically An statistical analysis of Boosting is done
This document provides tips and tricks for deep learning including data augmentation techniques, batch normalization, training procedures like epochs and mini-batch gradient descent, loss functions like cross-entropy loss, and parameter tuning methods such as transfer learning, adaptive learning rates, dropout, and early stopping. It also discusses good practices like overfitting small batches and gradient checking.
A gentle introduction to 2 classification techniques, as presented by Kriti Puniyani to the NYC Predictive Analytics group (April 14, 2011). To download the file please go here: http://www.meetup.com/NYC-Predictive-Analytics/files/
Affine Term Structure Model with Stochastic Market Price of RiskSwati Mital
- The document proposes a new affine term structure model that combines principal components analysis with a stochastic market price of risk.
- Principal components provide useful information about yield curves and only three components explain over 95% of yield variation.
- Previous models linked risk premium deterministically to return-predicting factors like slope, but this could result in unrealistic risk premium levels.
- The new model introduces an additional state variable to capture the stochastic market price of risk and break the deterministic link between risk premium and return-predicting factors.
This document introduces deep learning approaches for predicting spatio-temporal flows. It discusses how deep learning uses hierarchical layers to model complex nonlinear relationships in spatial and temporal data without assuming a data generation process. Examples are given of applying deep learning to predict traffic flows using loop detector data and to forecast stock price movements using limit order book imbalances. The document outlines the configuration of deep learning models for these tasks and evaluates their performance versus traditional statistical approaches.
The document appears to be lecture notes for a calculus class that covers several topics:
- Defining the derivative and discussing rates of change, tangent lines, velocity, population growth, and marginal costs.
- Worked examples are provided for finding the slope of a tangent line, instantaneous velocity, instantaneous population growth rate, and marginal cost of production.
- Numerical approximations are used to estimate some values when exact solutions are difficult to obtain analytically.
The comparative study of finite difference method and monte carlo method for ...Alexander Decker
This document compares the finite difference method and Monte Carlo method for pricing European options. The finite difference method solves the Black-Scholes partial differential equation by approximating it on a grid, while the Monte Carlo method simulates asset price paths and averages discounted payoffs. The study finds that while both methods agree with the Black-Scholes price, the finite difference method converges faster and is more accurate for standard European options, whereas Monte Carlo is better suited for exotic options due to its flexibility.
This document provides an overview of machine learning concepts for assessing model performance including metrics, model selection, and diagnostics. It discusses classification and regression metrics like accuracy, precision, recall, ROC curves, and coefficients of determination. Model selection techniques covered are training/validation/test sets, cross-validation, and regularization. Diagnostics examines bias/variance tradeoffs and remedies for underfitting and overfitting.
The document provides an introduction to TreeNet, a machine learning algorithm developed by Jerome Friedman. TreeNet builds regression and classification models in a stagewise fashion, using small regression trees at each stage to model residuals from the previous stage. It employs techniques like learning small trees, subsampling data, and using a small learning rate to minimize overfitting. TreeNet models can be very accurate while remaining resistant to overfitting.
Dynamic Programming design technique is one of the fundamental algorithm design techniques, and possibly one of the ones that are hardest to master for those who did not study it formally. In these slides (which are continuation of part 1 slides), we cover two problems: maximum value contiguous subarray, and maximum increasing subsequence.
This document provides an overview of key concepts in machine learning including neural networks, convolutional neural networks, recurrent neural networks, reinforcement learning, and control. It defines common neural network components like layers, activation functions, loss functions, and backpropagation. It also explains concepts in convolutional neural networks like convolutional layers and batch normalization. Recurrent neural networks components discussed include different gate types. Reinforcement learning concepts covered are Markov decision processes, policies, value functions, Bellman equations, value iteration algorithm, and Q-learning.
Divide and Conquer Algorithms - D&C forms a distinct algorithm design technique in computer science, wherein a problem is solved by repeatedly invoking the algorithm on smaller occurrences of the same problem. Binary search, merge sort, Euclid's algorithm can all be formulated as examples of divide and conquer algorithms. Strassen's algorithm and Nearest Neighbor algorithm are two other examples.
This document provides an overview of VAE-type deep generative models, especially RNNs combined with VAEs. It begins with notations and abbreviations used. The agenda then covers the mathematical formulation of generative models, the Variational Autoencoder (VAE), variants of VAE that combine it with RNNs (VRAE, VRNN, DRAW), a Chainer implementation of Convolutional DRAW, other related models (Inverse DRAW, VAE+GAN), and concludes with challenges of VAE-like generative models.
This document provides an overview of convolutional neural networks (CNNs) and their applications. It discusses the common layers in a CNN like convolutional layers, pooling layers, and fully connected layers. It also covers hyperparameters for convolutional layers like filter size and stride. Additional topics summarized include object detection algorithms like YOLO and R-CNN, face recognition models, neural style transfer, and computational network architectures like ResNet and Inception.
Chap 8. Optimization for training deep modelsYoung-Geun Choi
연구실 내부 세미나 자료. Goodfellow et al. (2016), Deep Learning, MIT Press의 Chapter 8을 요약/발췌하였습니다. 깊은 신경망(deep neural network) 모형 훈련시 목적함수 최적화 방법으로 흔히 사용되는 방법들을 소개합니다.
Dynamic Programming is an algorithmic paradigm that solves a given complex problem by breaking it into subproblems and stores the results of subproblems to avoid computing the same results again.
This document discusses algorithms for finding minimum and maximum elements in an array, including simultaneous minimum and maximum algorithms. It introduces dynamic programming as a technique for improving inefficient divide-and-conquer algorithms by storing results of subproblems to avoid recomputing them. Examples of dynamic programming include calculating the Fibonacci sequence and solving an assembly line scheduling problem to minimize total time.
This document provides an overview of the CS303 Computer Algorithms course taught by Dr. Yanxia Jia. It discusses the importance of algorithms, provides examples of classic algorithm problems like sorting and searching, and summarizes common algorithm design techniques and data structures used, including arrays, linked lists, stacks, queues, heaps, graphs and trees.
dynamic programming complete by Mumtaz Ali (03154103173)Mumtaz Ali
The document discusses dynamic programming, including its meaning, definition, uses, techniques, and examples. Dynamic programming refers to breaking large problems down into smaller subproblems, solving each subproblem only once, and storing the results for future use. This avoids recomputing the same subproblems repeatedly. Examples covered include matrix chain multiplication, the Fibonacci sequence, and optimal substructure. The document provides details on formulating and solving dynamic programming problems through recursive definitions and storing results in tables.
This document presents a new multivariate fuzzy time series forecasting method to predict car road accidents. The method uses four secondary factors (number killed, mortally wounded, died 30 days after accident, severely wounded, and lightly casualties) along with the main factor of total annual car accidents in Belgium from 1974 to 2004. The new method establishes fuzzy logical relationships between the factors to generate forecasts. Experimental results show the proposed method performs better than existing fuzzy time series forecasting approaches at predicting car accidents. Actuaries can use this kind of multivariate fuzzy time series analysis to help define insurance premiums and underwriting.
This document summarizes a master's thesis that implemented a continuous sequential importance resampling (CSIR) algorithm to estimate predictive densities in stochastic volatility (SV) models. The thesis began with an introduction to relevant econometrics concepts. It then explained SV models and particle filtering approaches. The thesis described implementing and testing functions to develop an R package for CSIR estimation in SV models. Diagnostics and parameter estimates from simulated and real stock return data were reported. The thesis concluded by discussing the package's applications and potential for future development.
Instrumentation Engineering : Signals & systems, THE GATE ACADEMYklirantga
THE GATE ACADEMY's GATE Correspondence Materials consist of complete GATE syllabus in the form of booklets with theory, solved examples, model tests, formulae and questions in various levels of difficulty in all the topics of the syllabus. The material is designed in such a way that it has proven to be an ideal material in-terms of an accurate and efficient preparation for GATE.
Quick Refresher Guide : is especially developed for the students, for their quick revision of concepts preparing for GATE examination. Also get 1 All India Mock Tests with results including Rank,Percentile,detailed performance analysis and with video solutions
GATE QUESTION BANK : is a topic-wise and subject wise collection of previous year GATE questions ( 2001 – 2013). Also get 1 All India Mock Tests with results including Rank,Percentile,detailed performance analysis and with video solutions
Bangalore Head Office:
THE GATE ACADEMY
# 74, Keshava Krupa(Third floor), 30th Cross,
10th Main, Jayanagar 4th block, Bangalore- 560011
E-Mail: info@thegateacademy.com
Ph: 080-61766222
1) The document discusses Bayesian forecasting of financial time series using stop-loss orders. It proposes two models - one without stop-loss orders that yields positive returns but some negative local yields, and one with stop-loss orders that reduces negative yields for a better overall return.
2) The models use high-frequency "tick-by-tick" data and functional clustering to make trend and stopping time predictions. Dynamic state space representations and particle/Kalman filters are used for generalization and forecasting.
3) Experiments on IBM stock data from 1995-1999 show the model with stop-loss orders achieves better cumulative returns by curbing negative local yields, though with greater computational complexity.
Is the Macroeconomy Locally Unstable and Why Should We Care?ADEMU_Project
The document discusses evidence that macroeconomic dynamics may exhibit locally unstable behavior like limit cycles rather than stable convergence to a steady state. It presents a reduced-form model allowing for nonlinearities, estimated on total hours and other labor market variables. The estimates provide intriguing evidence of limit cycle dynamics, with simulations showing attracting cycles. This suggests macroeconomic fluctuations could be endogenous rather than just responses to shocks, with implications for stabilization policy.
This lecture is about TIME SERIES ANALYSIS in which quantmod and PerformanceAnalytics packages in R have been used to generate results relating time series datasets. Also, ploted the returns and observed one of the main features of financial return: volatility that changes with time.
- Time series analysis involves modeling data that is recorded over time. Examples include stock prices, rainfall amounts, etc.
- In R, time series data is stored in a time series object created using the ts() function, which takes the data, start and end times, and frequency as arguments.
- Common time series models include autoregressive (AR) models, which model a variable as lagged values of itself plus noise, and moving average (MA) models, which model a variable as the mean of previous noise values plus current noise. ARIMA combines both AR and MA components.
This document outlines an invitation to functional programming presented by Sonat Suer of Picus Security. It begins with a shameless promotion of Picus Security looking to hire talent. It then provides definitions of functional programming, using Haskell as an example language. It walks through examples of working with lists in Haskell, including defining concatenation and a naive reverse function. It analyzes the complexity of the naive reverse function and proposes using homomorphisms to change the algebraic structure to improve efficiency.
Ryan White presented work on analyzing stochastic strategic networks. He developed models where networks experience attacks over time that remove nodes and weight. The models consider observing the network process only at renewal times, and finding functionals of interest like the distribution of the first observed threshold crossing. For a special case, he derived tractable results for the functional and compared to simulations. He discussed extensions like additional auxiliary thresholds.
A Strategic Model For Dynamic Traffic AssignmentKelly Taylor
This document proposes a strategic model for dynamic traffic assignment. The key elements are:
1) Users follow strategies that assign preference orders to outgoing arcs from each node based on arrival time and congestion.
2) A time-space network is constructed to model flow variations over time on the original road network.
3) An equilibrium is achieved when expected delays are minimal for each origin-destination pair given the strategies and capacities.
This document provides an overview of using Stata software to perform time series analysis. It describes opening a dataset containing economic variables over time, declaring the data as a time series, using commands like lag and lead to generate past and future values, exploring autocorrelation and cross-correlation between variables, and testing for a unit root in the data. Learning outcomes include autocorrelation analysis, cross-correlation analysis, unit root testing, and using basic time series commands in Stata.
Perishable Inventory Model Having Weibull Lifetime and Time Dependent DemandIOSR Journals
This document presents an inventory model for perishable items with Weibull deterioration rate and time-dependent demand. The model considers a finite replenishment rate and zero lead time. Differential equations are derived to determine the inventory level over time. Total cost is obtained considering ordering, holding, and purchasing costs. The optimal ordering quantity and policies are determined by maximizing profit rate. Numerical examples illustrate the sensitivity of the model to parameter changes.
The document discusses time complexity analysis of loops. It defines key terminology used in loop time complexity analysis such as loop variable, loop repetitions, time complexity per iteration (TC1iter), and change of variable. It explains that the time complexity per iteration may depend on the loop variable, requiring the use of summations. It also discusses handling loops where the variable does not take consecutive values through a change of variable technique to map it to a new variable that does take consecutive values.
In this paper, we make use of the fractional differential operator method to find the modified Riemann-Liouville (R-L) fractional derivatives of some fractional functions include fractional polynomial function, fractional exponential function, fractional sine and cosine functions. The Mittag-Leffler function plays an important role in our article, and the fractional differential operator method can be applied to find the particular solutions of non-homogeneous linear fractional differential equations (FDE) with constant coefficients in a unified way and it is a generalization of the method of finding particular solutions of classical ordinary differential equations. On the other hand, several examples are illustrative for demonstrating the advantage of our approach and we compare our results with the traditional differential calculus cases.
Stochastic optimization from mirror descent to recent algorithmsSeonho Park
The document discusses stochastic optimization algorithms. It begins with an introduction to stochastic optimization and online optimization settings. Then it covers Mirror Descent and its extension Composite Objective Mirror Descent (COMID). Recent algorithms for deep learning like Momentum, ADADELTA, and ADAM are also discussed. The document provides convergence analysis and empirical studies of these algorithms.
This document summarizes a research paper that proposes using motif discovery in time series data to make predictions. It begins by defining key concepts in time series analysis like motifs, distances, and ARIMA models. It then describes the specific approach taken - using the Chouakria index with CID similarity measure to identify motifs, which are then used to build prediction models. The results of this approach on several time series are compared to ARIMA models, finding the motif-based models provide better performance according to error metrics.
The study on mining temporal patterns and related applications in dynamic soc...Thanh Hieu
The document provides a curriculum vitae for Yi-Cheng Chen that includes basic information, education history, and research interests. It notes that Chen received a B.S. from Yuan Ze University in 2000, an M.S. from National Taiwan University of Science and Technology in 2002, and a Ph.D. from National Chiao Tung University in 2012 under the advisement of Professors Suh-Yin Lee and Wen-Chih Peng. Chen's Ph.D. dissertation focused on time interval-based sequential pattern mining. The CV outlines Chen's current research interests as temporal pattern mining, social network analysis, smart home applications, and cloud computing.
This document presents a new forecasting model that combines fuzzy time series and automatic clustering techniques to forecast gasoline prices in Vietnam. The model first uses an automatic clustering algorithm to divide historical gasoline price data into clusters with varying interval lengths. It then fuzzifies the data based on the new intervals to determine fuzzy logical relationships and forecasted values. The model is applied to a dataset of gasoline prices in Vietnam. Results show the proposed model achieves higher forecasting accuracy than a first-order fuzzy time series model.
This document presents a paper on theoretical and practical bounds for the initial value of a skew-compensated clock used in clock skew compensation algorithms. It begins with background on clock skew compensation based on an extended Bresenham's algorithm. It then derives optimal error bounds for floating-point operations and uses these to extend the main theorem to provide tighter theoretical bounds on the initial clock value. It also loosens these bounds for practical implementation with limited precision. Numerical examples are provided to compare the derived bounds with results from single and double precision arithmetic. The paper aims to make clock skew compensation algorithms more robust to floating-point precision loss.
This document contains the syllabus for the course "Digital Signal Processing" taught by Professor V. Rajendra Chary at SNIST. The syllabus covers 3 units: 1) Introduction to digital signals and systems, 2) Discrete Fourier Transform, and 3) Fast Fourier Transforms. Unit 1 introduces discrete-time signals and linear systems. Unit 2 covers the Discrete Fourier Transform and its properties as well as applications like spectral analysis. Unit 3 discusses fast Fourier transform algorithms like Decimation-In-Time and Decimation-In-Frequency and their applications in reducing computation complexity compared to the direct DFT. The document provides examples and practice problems for each unit to help students understand the concepts covered.
Similar to Financial Time Series Analysis Using R (20)
5 Tips for Creating Standard Financial ReportsEasyReports
Well-crafted financial reports serve as vital tools for decision-making and transparency within an organization. By following the undermentioned tips, you can create standardized financial reports that effectively communicate your company's financial health and performance to stakeholders.
"Does Foreign Direct Investment Negatively Affect Preservation of Culture in the Global South? Case Studies in Thailand and Cambodia."
Do elements of globalization, such as Foreign Direct Investment (FDI), negatively affect the ability of countries in the Global South to preserve their culture? This research aims to answer this question by employing a cross-sectional comparative case study analysis utilizing methods of difference. Thailand and Cambodia are compared as they are in the same region and have a similar culture. The metric of difference between Thailand and Cambodia is their ability to preserve their culture. This ability is operationalized by their respective attitudes towards FDI; Thailand imposes stringent regulations and limitations on FDI while Cambodia does not hesitate to accept most FDI and imposes fewer limitations. The evidence from this study suggests that FDI from globally influential countries with high gross domestic products (GDPs) (e.g. China, U.S.) challenges the ability of countries with lower GDPs (e.g. Cambodia) to protect their culture. Furthermore, the ability, or lack thereof, of the receiving countries to protect their culture is amplified by the existence and implementation of restrictive FDI policies imposed by their governments.
My study abroad in Bali, Indonesia, inspired this research topic as I noticed how globalization is changing the culture of its people. I learned their language and way of life which helped me understand the beauty and importance of cultural preservation. I believe we could all benefit from learning new perspectives as they could help us ideate solutions to contemporary issues and empathize with others.
Independent Study - College of Wooster Research (2023-2024) FDI, Culture, Glo...AntoniaOwensDetwiler
"Does Foreign Direct Investment Negatively Affect Preservation of Culture in the Global South? Case Studies in Thailand and Cambodia."
Do elements of globalization, such as Foreign Direct Investment (FDI), negatively affect the ability of countries in the Global South to preserve their culture? This research aims to answer this question by employing a cross-sectional comparative case study analysis utilizing methods of difference. Thailand and Cambodia are compared as they are in the same region and have a similar culture. The metric of difference between Thailand and Cambodia is their ability to preserve their culture. This ability is operationalized by their respective attitudes towards FDI; Thailand imposes stringent regulations and limitations on FDI while Cambodia does not hesitate to accept most FDI and imposes fewer limitations. The evidence from this study suggests that FDI from globally influential countries with high gross domestic products (GDPs) (e.g. China, U.S.) challenges the ability of countries with lower GDPs (e.g. Cambodia) to protect their culture. Furthermore, the ability, or lack thereof, of the receiving countries to protect their culture is amplified by the existence and implementation of restrictive FDI policies imposed by their governments.
My study abroad in Bali, Indonesia, inspired this research topic as I noticed how globalization is changing the culture of its people. I learned their language and way of life which helped me understand the beauty and importance of cultural preservation. I believe we could all benefit from learning new perspectives as they could help us ideate solutions to contemporary issues and empathize with others.
Understanding how timely GST payments influence a lender's decision to approve loans, this topic explores the correlation between GST compliance and creditworthiness. It highlights how consistent GST payments can enhance a business's financial credibility, potentially leading to higher chances of loan approval.
Fabular Frames and the Four Ratio ProblemMajid Iqbal
Digital, interactive art showing the struggle of a society in providing for its present population while also saving planetary resources for future generations. Spread across several frames, the art is actually the rendering of real and speculative data. The stereographic projections change shape in response to prompts and provocations. Visitors interact with the model through speculative statements about how to increase savings across communities, regions, ecosystems and environments. Their fabulations combined with random noise, i.e. factors beyond control, have a dramatic effect on the societal transition. Things get better. Things get worse. The aim is to give visitors a new grasp and feel of the ongoing struggles in democracies around the world.
Stunning art in the small multiples format brings out the spatiotemporal nature of societal transitions, against backdrop issues such as energy, housing, waste, farmland and forest. In each frame we see hopeful and frightful interplays between spending and saving. Problems emerge when one of the two parts of the existential anaglyph rapidly shrinks like Arctic ice, as factors cross thresholds. Ecological wealth and intergenerational equity areFour at stake. Not enough spending could mean economic stress, social unrest and political conflict. Not enough saving and there will be climate breakdown and ‘bankruptcy’. So where does speculative design start and the gambling and betting end? Behind each fabular frame is a four ratio problem. Each ratio reflects the level of sacrifice and self-restraint a society is willing to accept, against promises of prosperity and freedom. Some values seem to stabilise a frame while others cause collapse. Get the ratios right and we can have it all. Get them wrong and things get more desperate.
South Dakota State University degree offer diploma Transcriptynfqplhm
办理美国SDSU毕业证书制作南达科他州立大学假文凭定制Q微168899991做SDSU留信网教留服认证海牙认证改SDSU成绩单GPA做SDSU假学位证假文凭高仿毕业证GRE代考如何申请南达科他州立大学South Dakota State University degree offer diploma Transcript
Optimizing Net Interest Margin (NIM) in the Financial Sector (With Examples).pdfshruti1menon2
NIM is calculated as the difference between interest income earned and interest expenses paid, divided by interest-earning assets.
Importance: NIM serves as a critical measure of a financial institution's profitability and operational efficiency. It reflects how effectively the institution is utilizing its interest-earning assets to generate income while managing interest costs.
A toxic combination of 15 years of low growth, and four decades of high inequality, has left Britain poorer and falling behind its peers. Productivity growth is weak and public investment is low, while wages today are no higher than they were before the financial crisis. Britain needs a new economic strategy to lift itself out of stagnation.
Scotland is in many ways a microcosm of this challenge. It has become a hub for creative industries, is home to several world-class universities and a thriving community of businesses – strengths that need to be harness and leveraged. But it also has high levels of deprivation, with homelessness reaching a record high and nearly half a million people living in very deep poverty last year. Scotland won’t be truly thriving unless it finds ways to ensure that all its inhabitants benefit from growth and investment. This is the central challenge facing policy makers both in Holyrood and Westminster.
What should a new national economic strategy for Scotland include? What would the pursuit of stronger economic growth mean for local, national and UK-wide policy makers? How will economic change affect the jobs we do, the places we live and the businesses we work for? And what are the prospects for cities like Glasgow, and nations like Scotland, in rising to these challenges?
STREETONOMICS: Exploring the Uncharted Territories of Informal Markets throug...sameer shah
Delve into the world of STREETONOMICS, where a team of 7 enthusiasts embarks on a journey to understand unorganized markets. By engaging with a coffee street vendor and crafting questionnaires, this project uncovers valuable insights into consumer behavior and market dynamics in informal settings."
STREETONOMICS: Exploring the Uncharted Territories of Informal Markets throug...
Financial Time Series Analysis Using R
1. 1/39
Introduction Stationarity ARIMA Models Forecasting Summary
Financial Time Series Analysis using R
Interactive Brokers Webinar Series
Presented by Majeed Simaan 1
1Lally School of Management at RPI
June 15, 2017
2. 2/39
Introduction Stationarity ARIMA Models Forecasting Summary
About Me
PhD Finance Candidate at RPI
Research Interests:
Banking and Risk Management
Financial Networks and Interconnectedness
Portfolio and Asset Pricing Theory
Computational and Statistical Learning
Contact:
1 simaam@rpi.edu
2 Linkedin
3 Homepage
3. 3/39
Introduction Stationarity ARIMA Models Forecasting Summary
Acknowledgment
Interactive Brokers - special thanks to
Violeta Petrova
Cynthia Tomain
Special thanks to Prof. Tom Shohfi
Faculty advisor to the RPI James Student Managed Investment
Fund
Click here for more info
Finally, special thanks to the Lally School of Management and
Technology for hosting this presentation
4. 4/39
Introduction Stationarity ARIMA Models Forecasting Summary
Agenda
Intro to R and Financial Time Series
Stationarity
ARIMA Models
Forecasting
5. 5/39
Introduction Stationarity ARIMA Models Forecasting Summary
Suggested Readings and Resources
The classic textbook on time series analysis
Hamilton, 1994
Time series using R:
1 Econometrics in R, Farnsworth, 2008
2 An introduction to analysis of financial data with R, Tsay, 2014
3 Manipulating time series in R, J. Ryan, 2017
Advanced time series using R
1 Analysis of integrated and cointegrated time series with R, Pfaff,
2008
2 Multivariate time series analysis, Tsay, 2013
7. 7/39
Introduction Stationarity ARIMA Models Forecasting Summary
Getting Started
R
The R base system - https://cran.r-project.org/
RStudio - https://www.rstudio.com/products/rstudio/
Interactive Brokers - https://www.interactivebrokers.com
Trader Workstation (TWS)
or IB Gateway
8. 8/39
Introduction Stationarity ARIMA Models Forecasting Summary
Time Series in R
The xts package, (J. A. Ryan & Ulrich, 2014), provides efficient
ways to manipulate time series1
> library(xts)
> library(lubridate)
> n <- 100
> set.seed(13)
> x <- rnorm(n)
> names(x) <- as.character(date(today()) - 0:(n-1))
> x <- as.xts(x)
> x[today(),]
[,1]
2017-06-08 0.5543269
1
lubridate package, (Grolemund & Wickham, 2011), makes date format handling much easier
9. 8/39
Introduction Stationarity ARIMA Models Forecasting Summary
Time Series in R
The xts package, (J. A. Ryan & Ulrich, 2014), provides efficient
ways to manipulate time series1
> library(xts)
> library(lubridate)
> n <- 100
> set.seed(13)
> x <- rnorm(n)
> names(x) <- as.character(date(today()) - 0:(n-1))
> x <- as.xts(x)
> x[today(),]
[,1]
2017-06-08 0.5543269
# it is easy to plot an xts object
> plot(x)
Feb 27
2017
Mar 20
2017
Apr 10
2017
May 01
2017
May 22
2017
Jun 06
2017
−2−1012
x
1
lubridate package, (Grolemund & Wickham, 2011), makes date format handling much easier
10. 9/39
Introduction Stationarity ARIMA Models Forecasting Summary
Time Series in R II
We can also look at x as a data frame instead
> x <- data.frame(Date = date(x), x = x[,1])
> rownames(x) <- NULL
> summary(x)
Date x
Min. :2017-03-01 Min. :-2.02704
1st Qu.:2017-03-25 1st Qu.:-0.75623
Median :2017-04-19 Median :-0.07927
Mean :2017-04-19 Mean :-0.06183
3rd Qu.:2017-05-14 3rd Qu.: 0.55737
Max. :2017-06-08 Max. : 1.83616
> # add year and month variables
> x$Y <- year(x$Date); x$M <- month(x$Date);
11. 9/39
Introduction Stationarity ARIMA Models Forecasting Summary
Time Series in R II
We can also look at x as a data frame instead
> x <- data.frame(Date = date(x), x = x[,1])
> rownames(x) <- NULL
> summary(x)
Date x
Min. :2017-03-01 Min. :-2.02704
1st Qu.:2017-03-25 1st Qu.:-0.75623
Median :2017-04-19 Median :-0.07927
Mean :2017-04-19 Mean :-0.06183
3rd Qu.:2017-05-14 3rd Qu.: 0.55737
Max. :2017-06-08 Max. : 1.83616
> # add year and month variables
> x$Y <- year(x$Date); x$M <- month(x$Date);
The package plyr, (Wickham, 2011), provides efficient data split
summary
> library(plyr)
> max_month_x <- ddply(x,c("Y","M"),function(z) max(z[,"x"]))
> max_month_x # max value over month
Y M V1
1 2017 3 1.745427
2 2017 4 1.614479
3 2017 5 1.836163
4 2017 6 1.775163
12. 10/39
Introduction Stationarity ARIMA Models Forecasting Summary
IB API
The IBrokers package, J. A. Ryan, 2014, provides access to IB Trader
Workstation (TWS) API
The package also allows users to automate trades and receive real-
time data2
2
See the recent Webinar presentation by Anil Yadav here.
13. 10/39
Introduction Stationarity ARIMA Models Forecasting Summary
IB API
The IBrokers package, J. A. Ryan, 2014, provides access to IB Trader
Workstation (TWS) API
The package also allows users to automate trades and receive real-
time data2
> library(IBrokers)
> tws <- twsConnect()
> isConnected(tws) # should be true
> ac <- reqAccountUpdates(tws) # requests account details
> security <- twsSTK("SPY") # choose security of interest
> is.twsContract(security) # make sure it is identified
> P <- reqHistoricalData(tws,security, barSize = '5 mins',duration = "1 Y")
TWS Message: 2 -1 2100 API client has been unsubscribed from account data.
waiting for TWS reply on SPY .... done.
2
See the recent Webinar presentation by Anil Yadav here.
14. 10/39
Introduction Stationarity ARIMA Models Forecasting Summary
IB API
The IBrokers package, J. A. Ryan, 2014, provides access to IB Trader
Workstation (TWS) API
The package also allows users to automate trades and receive real-
time data2
> library(IBrokers)
> tws <- twsConnect()
> isConnected(tws) # should be true
> ac <- reqAccountUpdates(tws) # requests account details
> security <- twsSTK("SPY") # choose security of interest
> is.twsContract(security) # make sure it is identified
> P <- reqHistoricalData(tws,security, barSize = '5 mins',duration = "1 Y")
TWS Message: 2 -1 2100 API client has been unsubscribed from account data.
waiting for TWS reply on SPY .... done.
> P[c(1,nrow(P))] # look at first and last data points
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.WAP
2016-06-09 09:30:00 211.51 211.62 211.37 211.41 26766 211.501
2017-06-08 15:55:00 243.77 243.86 243.68 243.76 30984 243.772
SPY.hasGaps SPY.Count
2016-06-09 09:30:00 0 8378
2017-06-08 15:55:00 0 8952
2
See the recent Webinar presentation by Anil Yadav here.
16. 12/39
Introduction Stationarity ARIMA Models Forecasting Summary
Basic Concepts
Let yt denote a time series observed over t = 1, .., T periods
yt is called weakly stationary, if
E[yt] = µ and V[yt] = σ2
, ∀t (1)
i.e. expectation and variance of y are time invariant
3
See for instance Tsay, 2005
17. 12/39
Introduction Stationarity ARIMA Models Forecasting Summary
Basic Concepts
Let yt denote a time series observed over t = 1, .., T periods
yt is called weakly stationary, if
E[yt] = µ and V[yt] = σ2
, ∀t (1)
i.e. expectation and variance of y are time invariant
Also, yt is called strictly stationary, if
f (yt1 , ..., ytm ) = f (yt1+j , ..., ytm+j ) (2)
where m, j, and (t1, ..., tm) are arbitrary positive integers3
3
See for instance Tsay, 2005
18. 13/39
Introduction Stationarity ARIMA Models Forecasting Summary
Linearity
In this presentation, we focus on linear time series
Let us consider an AR(1) process in the form of
yt = c + φyt−1 + t, (3)
where t ∼ D(0, σ2) is iid
Intuitively, φ denotes the serial correlation of yt
φ = cor(yt, yt−1) (4)
The larger the magnitude of | φ |→ 1, the more persistent the
process is
19. 14/39
Introduction Stationarity ARIMA Models Forecasting Summary
Unit Root
Weak stationarity holds true if E[yt] = µ < ∞ for all t, such
that
µ = c + φµ ⇒ µ =
c
1 − φ
(5)
The same applies to V[yt] = σ2 < ∞, ∀t:
σ2
= φ2
σ2
+ σ2
⇒ σ2
=
σ2
1 − φ2
(6)
A necessary condition for weak stationarity implies | φ |< 1
Unit Root
If φ = 1, the process yt is a unit root
20. 15/39
Introduction Stationarity ARIMA Models Forecasting Summary
Problems with Non-Stationarity
Non-stationary data cannot be modeled or forecasted
Results based on non-stationarity can be spurious
e.g. false serial correlation in stock prices
21. 15/39
Introduction Stationarity ARIMA Models Forecasting Summary
Problems with Non-Stationarity
Non-stationary data cannot be modeled or forecasted
Results based on non-stationarity can be spurious
e.g. false serial correlation in stock prices
If yt has a unit root (non-stationary), i.e. φ = 1, with c = 0,
then
yt = yt−1 + t (7)
yt−1 = yt−2 + t−1 (8)
⇒yt =
t
s=0
s (9)
where y0 = 0
The process in (7) is unstable in nature,
the initial shock, 0, does not dissipate over time
22. 16/39
Introduction Stationarity ARIMA Models Forecasting Summary
Transformation and Integrated Process
In linear time series, transformation takes the form of a first
difference
∆yt = yt − yt−1 (10)
Taking the first difference of (7), we have
∆yt = t (11)
The process in (11) is stationary and does not depend on pre-
vious shocks
23. 16/39
Introduction Stationarity ARIMA Models Forecasting Summary
Transformation and Integrated Process
In linear time series, transformation takes the form of a first
difference
∆yt = yt − yt−1 (10)
Taking the first difference of (7), we have
∆yt = t (11)
The process in (11) is stationary and does not depend on pre-
vious shocks
Integrated Process
If yt has a unit root (non-stationary), while ∆yt = yt − yt−1 is
stationary, then yt is called integrated of first order, I(1).
24. 17/39
Introduction Stationarity ARIMA Models Forecasting Summary
Example I: SPY ETF Stationarity
Figure: SPY ETF - Violation of Weak Stationarity
Jul Sep Nov Jan Mar May
200210220230240
µ1 = 215.02
µ2 = 233.88
25. 18/39
Introduction Stationarity ARIMA Models Forecasting Summary
Figure: SPY ETF - Violation of Strict Stationarity
0.00
0.03
0.06
0.09
0.12
200 210 220 230 240
density
Period
Period 1
Period 2
26. 19/39
Introduction Stationarity ARIMA Models Forecasting Summary
Let Pt denote the price of the SPY ETF at time t and
pt = log(Pt) (12)
If pt is I(1), then ∆pt should be stationary, where
∆pt = pt − pt−1 = log
Pt
Pt−1
≈ rt (13)
denotes the return on the asset between t − 1 and t
27. 20/39
Introduction Stationarity ARIMA Models Forecasting Summary
Figure: SPY ETF Returns - Weak Stationarity
Jul Sep Nov Jan Mar May
−0.03−0.02−0.010.000.010.02
Date
µ1 = 0.0005614 µ2 = 0.00065175
28. 21/39
Introduction Stationarity ARIMA Models Forecasting Summary
Figure: SPY ETF Returns - Strict Stationarity
0
30
60
90
−0.02 0.00 0.02
density
Period
Period 1
Period 2
29. 22/39
Introduction Stationarity ARIMA Models Forecasting Summary
Let’s take a look at the serial correlation of the prices
We will focus on the closing price
> find.close <- grep("Close",names(P))
> P_daily <- apply.daily(P[,find.close],function(x) x[nrow(x),])
> dim(P_daily)
[1] 252 1
> cor(P_daily[-1],lag(P_daily)[-1])
SPY.Close
SPY.Close 0.99238
30. 22/39
Introduction Stationarity ARIMA Models Forecasting Summary
Let’s take a look at the serial correlation of the prices
We will focus on the closing price
> find.close <- grep("Close",names(P))
> P_daily <- apply.daily(P[,find.close],function(x) x[nrow(x),])
> dim(P_daily)
[1] 252 1
> cor(P_daily[-1],lag(P_daily)[-1])
SPY.Close
SPY.Close 0.99238
On the other hand, the corresponding statistic for returns is
> R_daily <- P_daily[-1]/lag(P_daily)[-1] - 1
> cor(R_daily[-1],lag(R_daily)[-1])
SPY.Close
SPY.Close -0.06828564
31. 23/39
Introduction Stationarity ARIMA Models Forecasting Summary
Test for Unit Root
It is important to plot the time series before running any tests
of unit root
It is recommended to use reasoning where the non-stationarity
might come from
In the case of stock prices, time is one major factor
Assuming that a time series has a unit root when it does not
can bias inference
32. 23/39
Introduction Stationarity ARIMA Models Forecasting Summary
Test for Unit Root
It is important to plot the time series before running any tests
of unit root
It is recommended to use reasoning where the non-stationarity
might come from
In the case of stock prices, time is one major factor
Assuming that a time series has a unit root when it does not
can bias inference
Augmented Dickey-Fuller Test
A common test for unit root is the Augmented Dickey-Fuller
(ADF) test
It tests the null hypothesis whether a unit root is present in the
time series
The more negative the statistic is the more likely to reject the
null
33. 24/39
Introduction Stationarity ARIMA Models Forecasting Summary
ADF Test in R
To test for unit root, we can use the adf.test function from the
’tseries’ package, (Trapletti & Hornik, 2017)
We look again at the daily prices and returns from Example I
> library(tseries)
> adf.test(P_daily);adf.test(R_daily)
Augmented Dickey-Fuller Test
data: P_daily
Dickey-Fuller = -2.3667, Lag order = 6, p-value = 0.4214
alternative hypothesis: stationary
Augmented Dickey-Fuller Test
data: R_daily
Dickey-Fuller = -6.3752, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary
35. 26/39
Introduction Stationarity ARIMA Models Forecasting Summary
ARIMA Models
Let yt follow an ARIMA(p, d, q) model, where
1 p is the order of autoregressive (AR) model
2 d is the order of differencing to yield a I(0) process
3 q is the order of the moving average (MA) model
36. 26/39
Introduction Stationarity ARIMA Models Forecasting Summary
ARIMA Models
Let yt follow an ARIMA(p, d, q) model, where
1 p is the order of autoregressive (AR) model
2 d is the order of differencing to yield a I(0) process
3 q is the order of the moving average (MA) model
For instance,
AR(p) = ARIMA(p, 0, 0) (14)
MA(q) = ARIMA(0, 0, q) (15)
37. 26/39
Introduction Stationarity ARIMA Models Forecasting Summary
ARIMA Models
Let yt follow an ARIMA(p, d, q) model, where
1 p is the order of autoregressive (AR) model
2 d is the order of differencing to yield a I(0) process
3 q is the order of the moving average (MA) model
For instance,
AR(p) = ARIMA(p, 0, 0) (14)
MA(q) = ARIMA(0, 0, q) (15)
Special Case
If yt has a unit root, i.e. I(1) , then first difference, ∆yt, yields
a stationary process
Also, if ∆yt follows an AR(1) process, then we conclude that
yt has an ARIMA(1, 1, 0) process
38. 27/39
Introduction Stationarity ARIMA Models Forecasting Summary
ARIMA Identification
Identification of ARIMA can be facilitated as follows
1 Find the order of integration I(d) of the time series
e.g. most stock prices are integrated of order 1, d = 1
2 Look at indicators in the data for AR and MA orders
A common approach is to refer to the PACF and ACF, respec-
tively4
3 Consider an information criteria, e.g. AIC (Sakamoto, Ishiguro,
& Kitagawa, 1986)
4 Finally, test whether the residuals of the identified model follow
a white noise process
4
See this discussion for further reading.
39. 27/39
Introduction Stationarity ARIMA Models Forecasting Summary
ARIMA Identification
Identification of ARIMA can be facilitated as follows
1 Find the order of integration I(d) of the time series
e.g. most stock prices are integrated of order 1, d = 1
2 Look at indicators in the data for AR and MA orders
A common approach is to refer to the PACF and ACF, respec-
tively4
3 Consider an information criteria, e.g. AIC (Sakamoto et al.,
1986)
4 Finally, test whether the residuals of the identified model follow
a white noise process
Ljung-Box Statistic
This statistic is useful to test whether residuals are serially cor-
related
A value around zero (large p.value) implies a good fit
4
See this discussion for further reading.
40. 28/39
Introduction Stationarity ARIMA Models Forecasting Summary
Example II: Identifying ARIMA Models
We consider a simulated time series from a given ARIMA model
Specifically, we consider an ARIMA(3,1,2) process
> N <- 10^3
> set.seed(13)
> y <- arima.sim(N,model = list(order = c(3,1,2), ar = c(0.8, -0.5,0.4),
+ ma = c(0.5,-0.3))) + 200
# Note that y is a ts object rather than xts
Step 1: Plot and Test for Unit Root
> plot(y);
> ADF <- adf.test(y); ADF$p.value
[1] 0.4148301
# lag on ts object should be assigned as -1
> delta_y <- na.omit(y - lag(y,-1) )
> plot(delta_y);
> ADF2 <- adf.test(delta_y); ADF2$p.value
[1] 0.01
41. 29/39
Introduction Stationarity ARIMA Models Forecasting Summary
Step 1 tells us that d = 1, i.e. yt follows an ARIMA(p, 1, q)
We need to identify p and q
Step 2: Identify p and q using the AIC information criterion
> p.seq <- 0:4
> q.seq <- 0:4
> pq.seq <- expand.grid(p.seq,q.seq)
> AIC.list <- lapply(1:nrow(pq.seq),function(i)
+ AIC(arima(y,c(pq.seq[i,1],1,pq.seq[i,2]))))
> AIC.matrix <- matrix(unlist(AIC.list),length(p.seq))
> rownames(AIC.matrix) <- p.seq
> colnames(AIC.matrix) <- q.seq
AIC.matrix
p q 0 1 2 3 4
0 3973.32 3075.67 2923.06 2914.88 2916.86
1 3542.07 2983.22 2916.50 2916.88 2883.02
2 3407.54 2949.70 2912.02 2907.37 2866.26
3 3053.10 2851.96 2844.42 2846.41 2848.31
4 2987.36 2845.46 2846.41 2847.81 2850.41
42. 30/39
Introduction Stationarity ARIMA Models Forecasting Summary
It follows from Step 2 that the optimal combination is (p = 3, q = 2)
Alternatively, we can use the auto.arima function
> identify.arima <- auto.arima(y)
> identify.arima
Series: y
ARIMA(3,1,2)
Coefficients:
ar1 ar2 ar3 ma1 ma2
0.7758 -0.4821 0.3875 0.5376 -0.2752
s.e. 0.0785 0.0448 0.0315 0.0836 0.0796
sigma^2 estimated as 0.9965: log likelihood=-1416.21
AIC=2844.42 AICc=2844.5 BIC=2873.87
In either case, we get consistent results indicating that the model is
ARIMA(3,1,2)
43. 31/39
Introduction Stationarity ARIMA Models Forecasting Summary
Finally, we look at the residuals of the fitted model
Step 3: check residuals
> Box.test(residuals(identify.arima),type = "Ljung-Box")
Box-Ljung test
data: residuals(identify.arima)
X-squared = 0.00087004, df = 1, p-value = 0.9765
> library(forecast)
> Acf(residuals(identify.arima),main = "")
−0.10−0.050.000.050.10
Lag
ACF
0 5 10 15 20 25 30
45. 33/39
Introduction Stationarity ARIMA Models Forecasting Summary
Forecasting
So far, we learned how to identify a time series model
For application, we are interested in forecasting future values
of the time series
Such decision will be based on a history of T periods
T periods to fit the model
and a number of lags to serve as forecast inputs
Hence, our decision will be based on the quality of
1 the data
2 the fitted model
46. 34/39
Introduction Stationarity ARIMA Models Forecasting Summary
Rolling Window
We will use a rolling window approach to perform and evaluate
forecasts
Set t = 150 and perform the following steps
1 Standing at the end of day t
2 Use T = 150 historic days of data (including day t) to fit an
ARIMA model
3 Make a forecast for next period, i.e. t + 1
4 Set t → t + 1 and go back to Step 1
The above steps are repeated until t + 1 becomes the last ob-
servation in the time series
47. 35/39
Introduction Stationarity ARIMA Models Forecasting Summary
Example III: Forecast the SPY ETF
In total we have 252 days of closing prices for the SPY ETF
To avoid price non-stationary, we focus on returns alone
This leaves us with 101 days to test our forecasts5
We consider three models for forecast
1 Dynamically fitted ARIMA(p,0,q) model
2 Dynamically fitted AR(1) model
3 Plain moving average (momentum)
> library(forecast)
> T. <- 150
> arma.list <- numeric()
> ar1.list <- numeric()
> ma.list <- numeric()
> for(i in T.:(length(R_daily)-1) ) {
+ arma.list[i] <- list(auto.arima(R_daily[(i-T.+1):i])) # ARIMA(p,0,q)
+ ar1.list[i] <- list(arima(R_daily[(i-T.+1):i],c(1,0,0))) # AR(1)
+ ma.list[i] <- list(mean(R_daily[(i-T.+1):i])) # momentum
+ }
5
The experiment relies on the forecast package, Hyndman, 2017
48. 36/39
Introduction Stationarity ARIMA Models Forecasting Summary
> y_hat <- sapply(arma.list[T.:length(arma.list)],
+ function(x) forecast(x,1)[[4]] )
> y_hat2 <- sapply(ar1.list[T.:length(ar1.list)],
+ function(x) forecast(x,1)[[4]] )
> y_hat3 <- sign(unlist(ma.list))
> forecast_accuracy <- cbind(mean(sign(y_hat) == sign(y)),
+ mean(sign(y_hat2) == sign(y)),
+ mean(sign(y_hat3) == sign(y)))
Finally, summarize the forecast accuracy in a table
ARIMA AR(1) Momentum
Accuracy 55.45% 53.47% 52.48%
Among the three, ARIMA performs the best
Could be attributed to more flexibility in fitting the model over time
49. 37/39
Introduction Stationarity ARIMA Models Forecasting Summary
While AR(1) is a constrained ARIMA model, note that the autore-
gressive coefficient still changes dramatically over time
Red line denotes the SPY ETF daily return
Black line denotes the estimated AR(1) coefficient over time, i.e. φ
Jan 13
2017
Feb 06
2017
Feb 27
2017
Mar 20
2017
Apr 10
2017
May 01
2017
May 22
2017
−0.15−0.10−0.050.00
φ
rt
50. 38/39
Introduction Stationarity ARIMA Models Forecasting Summary
Summary
Importance of stationarity
Non-stationary models could imply spurious results
Plots are always insightful
Use tests carefully
Consider multiple time series to form forecasts
Hence the idea of multivariate time series analysis
52. 40/39
References
References I
[]Farnsworth, G. V. 2008. Econometrics in r. Technical
report, October 2008. Available at http://cran. rproject.
org/doc/contrib/Farnsworth-EconometricsInR. pdf.
[]Grolemund, G., & Wickham, H. 2011. Dates and times made easy
with lubridate. Journal of Statistical Software, 40(3), 1–25.
Retrieved from http://www.jstatsoft.org/v40/i03/
[]Hamilton, J. D. 1994. Time series analysis (Vol. 2). Princeton
university press Princeton.
[]Hyndman, R. J. 2017. forecast: Forecasting functions for time
series and linear models [Computer software manual]. Re-
trieved from http://github.com/robjhyndman/forecast
(R package version 8.0)
[]Pfaff, B. 2008. Analysis of integrated and cointegrated time series
with r. Springer Science & Business Media.
53. 41/39
References
References II
[]Ryan, J. 2017. Manipulating time series data in r with xts & zoo.
Data Camp.
[]Ryan, J. A. 2014. Ibrokers: R api to interactive brokers trader
workstation [Computer software manual]. Retrieved from
https://CRAN.R-project.org/package=IBrokers (R
package version 0.9-12)
[]Ryan, J. A., & Ulrich, J. M. 2014. xts: extensible time series
[Computer software manual]. Retrieved from https://CRAN
.R-project.org/package=xts (R package version 0.9-7)
[]Sakamoto, Y., Ishiguro, M., & Kitagawa, G. 1986. Akaike infor-
mation criterion statistics. Dordrecht, The Netherlands: D.
Reidel.
[]Trapletti, A., & Hornik, K. 2017. tseries: Time series analy-
sis and computational finance [Computer software manual].
Retrieved from https://CRAN.R-project.org/package=
tseries (R package version 0.10-41.)
54. 42/39
References
References III
[]Tsay, R. S. 2005. Analysis of financial time series (Vol. 543). John
Wiley & Sons.
[]Tsay, R. S. 2013. Multivariate time series analysis: with r and
financial applications. John Wiley & Sons.
[]Tsay, R. S. 2014. An introduction to analysis of financial data
with r. John Wiley & Sons.
[]Wickham, H. 2011. The split-apply-combine strategy for data anal-
ysis. Journal of Statistical Software, 40(1), 1–29. Retrieved
from http://www.jstatsoft.org/v40/i01/