The document discusses analyzing multivariate time series of five energy futures (crude oil, ethanol, gasoline, heating oil, natural gas) using vector autoregressive (VAR) and vector error correction (VEC) models. It finds the futures are cointegrated using Johansen and Engle-Granger tests, indicating they share a common stochastic trend. A VAR(1) model is estimated and found stable. The VEC model captures the error correction behavior as futures return to their long-run equilibrium. Forecasts are generated and limitations of the Engle-Granger approach discussed.
The generalized additive model is an excellent tool for analyzing non -linear functions. This document provides information on the strategy to adopt for this analysis.
Definition of Co-integration .
Different Approaches of Co-integration.
Johansen and Juselius (J.J) Co-integration.
Error Correction Model (ECM).
Interpretation of ECM term.
Long – Run Co-integration Equation.
The generalized additive model is an excellent tool for analyzing non -linear functions. This document provides information on the strategy to adopt for this analysis.
Definition of Co-integration .
Different Approaches of Co-integration.
Johansen and Juselius (J.J) Co-integration.
Error Correction Model (ECM).
Interpretation of ECM term.
Long – Run Co-integration Equation.
Frustration-Reduced Spark: DataFrames and the Spark Time-Series LibraryIlya Ganelin
In this talk I talk about my recent experience working with Spark Data Frames and the Spark TimeSeries library. For data frames, the focus will be on usability. Specifically, a lot of the documentation does not cover common use cases like intricacies of creating data frames, adding or manipulating individual columns, and doing quick and dirty analytics. For the time series library, I dive into the kind of use cases it supports and why it’s actually super useful.
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...NUI Galway
Professor Dimitris Kugiumtzis, Aristotle University of Thessaloniki, Greece, presented this workshop on time series analysis as part of the Summer School on Modern Statistical Analysis and Computational Methods hosted by the Social Sciences Computing Hub at the Whitaker Institute, NUI Galway on 17th-19th June 2013.
Time Series Processing with Apache SparkQAware GmbH
Apache Big Data Conference 2016, Vancouver BC: Talk by Josef Adersberger (@adersberger, CTO at QAware).
Abstract: A lot of data is best represented as time series: Operational data, financial data and even in general-purpose DWHs the dominant dimension is time. The area of time series databases is growing rapidly, but the support in Spark to process and analyze time series data is still in the early stages. We present Chronix Spark which provides a mature TimeSeriesRDD implementation for fast retrieval and complex analysis of time series data. Chronix Spark is open source software and battle-proved at a big German car manufacturer and a German telco company. We show how we have used Chronix Spark in a real-life project and provide some benchmarks how it has outperformed common time series databases like OpenTSDB, KairosDB and InfluxDB. We lift the curtain and deep-dive into the internals how we have achieved this.
1. WHO SHOULD ATTEND
This program is for you if you are engineer, statistician, scientist and researcher, post-graduate student in commercial or government institutions who is looking for a powerful and flexible tool for your time series data analysis. Managers and decision maker who is considering to deploy a cost effective software into your organization as alternative to SAS, SPSS, Minitab, Statistica, Stata, JMP, S-plus and other commercial statistical software.
Our previous participants who has directly benefit from the R series workshop are from the field of agriculture, biology, education, ecology, economy, engineering, environmental, food technology, financial, manufacturing, medical, natural resources and semiconductor who has the need for time series data analysis but with minimum statistics, computer skills and no prior knowledge in R.
2. WORKSHOP OBJECTIVES
This workshop is a customized program that provides researchers practical approach and hands-on experience on using the time series analysis in the R environment. The theory and mathematic of time series will be minimum to allow more participants to follow this program. Upon completion, the participant will have a clear understand on how to prepare the data for time series analysis in R, decompose the data into trend and seasonal cycle, and predict the possible outcome based on the historical time series data.
Participant to this workshop only require basic statistical understanding, basic computing skills and no prior knowledge in R and Time Series Analysis.
Shallow introduction for Deep Learning Retinal Image AnalysisPetteriTeikariPhD
Overview of retinal imaging techniques such as fundus photography, optical coherence tomography (OCT) along with future upgrades such as multispectral imaging, OCT angiography, adaptive optics imaging and polarization-sensitive OCT. This is followed by an overview of deep learning image analysis methods suitable to be used with retinal imaging techniques.
Alternative download link: https://www.dropbox.com/s/n01w02cjaf68vbo/retina_deepLearning_pipeline.pdf?dl=0
Analyzing Time Series Data with Apache Spark and CassandraPatrick McFadin
You have collected a lot of time series data so now what? It's not going to be useful unless you can analyze what you have. Apache Spark has become the heir apparent to Map Reduce but did you know you don't need Hadoop? Apache Cassandra is a great data source for Spark jobs! Let me show you how it works, how to get useful information and the best part, storing analyzed data back into Cassandra. That's right. Kiss your ETL jobs goodbye and let's get to analyzing. This is going to be an action packed hour of theory, code and examples so caffeine up and let's go.
1) To understand the underlying structure of Time Series represented by sequence of observations by breaking it down to its components.
2) To fit a mathematical model and proceed to forecast the future.
Here are 3 tips on photography which I've learned recently.
They are simple, yet powerful, and are most suitable for a novice like me!
I hope for those of you who are also picking up photography find these tips useful.
Incorporating photos and videos into your PowerPoint decks can greatly enhance a presentation. Learn how illustrating concepts with meaningful imagery can make your presentation great.
Learn more: http://www.lynda.com/Photography-training-tutorials/70-0.html
Photography 101 - a introduction to photography and the basics of exposure. Learn techniques for shutter speed, aperture and ISO and how they relate to one another.
50 Ways to Become More Professionally ExcellentLeslie Bradshaw
This presentation will give you practical, next-level tips to help you become the best version of your professional self.
After powering through it, you will be armed with the tactics you need to grow and nurture your network, deliver world class work product, earn trust and respect, successfully collaborate, and generally take your game up a notch so you advance your career (and have plenty of fun along the way).
Insights will come from successful professionals, pop culture, and Bradshaw's own learnings as a sought-after employee, effective leader, and industry-recognized pioneer.
This presentation was originally delivered as a part of the University of Chicago Alumni Career Program on May 19, 2015.
Stuck with your Regression Assignment? Get 24/7 help from tutors with Phd in the subject. Email us at support@helpwithassignment.com
Reach us at http://www.HelpWithAssignment.com
Predicting US house prices using Multiple Linear Regression in RSotiris Baratsas
In this study, we attempted to formulate a Multiple Linear Regression model, to predict US house prices.
Steps involved:
Perform descriptive analysis and visualisation for each variable to get an initial insight of what the data looks like.
Conduct pairwise comparisons between the variables in the dataset to investigate if there are any associations implied by the dataset.
Construct a model for the expected selling prices according to the remaining features. Check whether this linear model fits well to the data.
Find the best model for predicting the selling prices and select the appropriate features using stepwise methods (used Forward, Backward and Stepwise procedures according to AIC or BIC to choose which variables appear to be more significant for predicting selling prices).
Get the summary of our final model, interpret the coefficients. Comment on the significance of each coefficient and write down the mathematical formulation of the model. Consider whether the intercept should be excluded from our model.
Check the assumptions of your final model. Are the assumptions satisfied? If not, what is the impact of the violation of the assumption not satisfied in terms of inference? What could someone do about it?
Conduct LASSO as a variable selection technique and compare the variables that we end up having using LASSO to the variables that you ended up having using stepwise methods.
Week 4 Lecture 12 Significance Earlier we discussed co.docxcockekeshia
Week 4 Lecture 12
Significance
Earlier we discussed correlations without going into how we can identify statistically
significant values. Our approach to this uses the t-test. Unfortunately, Excel does not
automatically produce this form of the t-test, but setting it up within an Excel cell is fairly easy.
And, with some slight algebra, we can determine the minimum value that is statistically
significant for any table of correlations all of which have the same number of pairs (for example,
a Correlation table for our data set would use 50 pairs of values, since we have 50 members in
our sample).
The t-test formula for a correlation (r) is t = r * sqrt(n-2)/sqrt(1-r2); the associated degrees
of freedom are n-2 (number of pairs – 2) (Lind, Marchel, & Wathen, 2008). For some this might
look a bit off-putting, but remember that we can translate this into Excel cells and functions and
have Excel do the arithmetic for us.
Excel Example
If we go back to our correlation table for salary, midpoint, Age, Perf Rat, Service, and
Raise, we have:
Using Excel to create the formula and cell numbers for our key values allows us to
quickly create a result. The T.dist.2t gives us a p-value easily.
The formula to use in finding the minimum correlation value that is statistically
significant is r = sqrt(t^2/(t^2 + n-2)). We would find the appropriate t value by using the
t.inv.2T(alpha, df) with alpha = 0.05 and df = n-2 or 48. Plugging these values into the gives us
a t-value of 2.0106 or 2.011(rounded).
Putting 2.011 and 48 (n-2) into our formula gives us a r value of 0.278; therefore, in a
correlation table based on 50 pairs, any correlation greater or equal to 0.278 would be
statistically significant.
Technical Point. If you are interested in how we obtained the formula for determining
the minimum r value, the approach is shown below. If you are not interested in the math, you
can safely skip this paragraph.
t = r* sqrt(n-2)/sqrt(1-r2)
Multiplying gives us t *sqrt (1- r2) = r2* (n-2)
Squaring gives us: t2 * (1- r2) = r2* (n-2)
Multiplying out gives us: t2– t2* r2 = n r2-2* r2
Adding gives us: t2= n* r2-2*r2+ t2 *r2
Factoring gives us t2= r2 *(n -2+ t2)
Dividing gives us t2 / (n -2+ t2) = r2
Taking the square root gives us r = sqrt (t2 / (n -2+ t2)
Effect Size Measures
As we have discussed, there is a difference between statistical and practical
significance. Virtually any statistic can become statistically significant if the sample is large
enough. In practical terms, a correlation of .30 and below is generally considered too weak to be
of any practical significance. Additionally, the effect size measure for Pearson’s correlation is
simply the absolute value of the correlation; the outcome has the same general interpretation as
Cohen’s D for the t-test (0.8 is strong, and 0.2 is quite weak, for example) (Tanner & Youssef-
Morgan, 2013).
Spearman’s Rank Correlation
Another typ.
Distribution of EstimatesLinear Regression ModelAssume (yt,.docxmadlynplamondon
Distribution of Estimates
Linear Regression Model
Assume (yt, xt) are independent and identically distributed and E(xtet) = 0
Estimation Consistency
The estimates approach the true values as the sample size increases.
Estimation variance decreases as the sample size increases.
Illustration of Consistency
Take a random sample of U.S. men
Estimate a linear regression of log(wages) on education
Total sample = 9089
Start with 100 observations, and sequentially increase sample size until in the final regression use the whole 9089.
Sequence of Slope Coefficients
Asymptotic Normality
4
Illustration of Asymptotic Normality
Time Series
Do these results apply to time-series data?
Consistency
Asymptotic Normality
Variance Formula
Time-series models
AR models, i.e., xt = yt-1
Trend and seasonal models
One-step and multi-step forecasting
Derivation of Variance Formula
For simplicity
Assume the variables have zero mean
The regression has no intercept
Model with no intercept:
Model with no intercept
OLS minimizes the sum of squares
The first-order condition is
Solution
Now substitute
We have
The denominator is the sample variance (when x has mean zero), so
10
Then
Where
Since
Then
From the covariance formula
When the observations are independent, the covariances are zero.
And since
We obtain
We have found
As stated at the beginning.
Extension to Time-Series
The only place in this argument where we used the assumption of the independence of observations was to show that vt = xtet has zero covariance with vj = xjej.
This is saying that vt is not autocorrelated.
Unforecastable one-step errors
In one-step-ahead forecasting, if the regression error is unforecastable, then vt is not autocorrelated.
In this case, the variance formula for the least-squares estimate is
Why is this true?
The error is unforecastable if
For simplicity, suppose that xt = 1.
Then for
Summary
In one-step-ahead time-series models, if the error is unforecastable, then least-squares estimates satisfy the asymptotic (approximate) distribution
As the sample size T is in the denominator, the variance decreases as the sample size increases.
This means that least-squares is consistent.
Variance Formula
The variance formula for the least-squares estimate takes the form
This formula is valid in time-series regression when the error is unforecastable.
Classical Variance Formula
If we make the simplifying assumption
Then
Homoskedasticity
The variance simplification is valid under “conditional homoskedasticity”
This is a simplifying assumption made to make calculations easier, and is a conventional assumption in introductory econometrics courses.
It is not used in serious econometrics.
Variance Formula: AR(1) Model
Take the AR(1) model with unforecastable homoscedastic errors
Then the variance of the OLS estimate is
Since in this model
AR(1) Asymptotic Variance
We know that
So
The asymp ...
A simple PCA model was used to find the direction of most variability for the CEF puzzle.
Evidence that the MOM factor as detailed by Carhart (1997) explains this puzzle was
found. Data sets used are available for independent verification of results.
how to sell pi coins in South Korea profitably.DOT TECH
Yes. You can sell your pi network coins in South Korea or any other country, by finding a verified pi merchant
What is a verified pi merchant?
Since pi network is not launched yet on any exchange, the only way you can sell pi coins is by selling to a verified pi merchant, and this is because pi network is not launched yet on any exchange and no pre-sale or ico offerings Is done on pi.
Since there is no pre-sale, the only way exchanges can get pi is by buying from miners. So a pi merchant facilitates these transactions by acting as a bridge for both transactions.
How can i find a pi vendor/merchant?
Well for those who haven't traded with a pi merchant or who don't already have one. I will leave the telegram id of my personal pi merchant who i trade pi with.
Tele gram: @Pi_vendor_247
#pi #sell #nigeria #pinetwork #picoins #sellpi #Nigerian #tradepi #pinetworkcoins #sellmypi
how to sell pi coins on Bitmart crypto exchangeDOT TECH
Yes. Pi network coins can be exchanged but not on bitmart exchange. Because pi network is still in the enclosed mainnet. The only way pioneers are able to trade pi coins is by reselling the pi coins to pi verified merchants.
A verified merchant is someone who buys pi network coins and resell it to exchanges looking forward to hold till mainnet launch.
I will leave the telegram contact of my personal pi merchant to trade with.
@Pi_vendor_247
If you are looking for a pi coin investor. Then look no further because I have the right one he is a pi vendor (he buy and resell to whales in China). I met him on a crypto conference and ever since I and my friends have sold more than 10k pi coins to him And he bought all and still want more. I will drop his telegram handle below just send him a message.
@Pi_vendor_247
how to sell pi coins in all Africa Countries.DOT TECH
Yes. You can sell your pi network for other cryptocurrencies like Bitcoin, usdt , Ethereum and other currencies And this is done easily with the help from a pi merchant.
What is a pi merchant ?
Since pi is not launched yet in any exchange. The only way you can sell right now is through merchants.
A verified Pi merchant is someone who buys pi network coins from miners and resell them to investors looking forward to hold massive quantities of pi coins before mainnet launch in 2026.
I will leave the telegram contact of my personal pi merchant to trade with.
@Pi_vendor_247
BYD SWOT Analysis and In-Depth Insights 2024.pptxmikemetalprod
Indepth analysis of the BYD 2024
BYD (Build Your Dreams) is a Chinese automaker and battery manufacturer that has snowballed over the past two decades to become a significant player in electric vehicles and global clean energy technology.
This SWOT analysis examines BYD's strengths, weaknesses, opportunities, and threats as it competes in the fast-changing automotive and energy storage industries.
Founded in 1995 and headquartered in Shenzhen, BYD started as a battery company before expanding into automobiles in the early 2000s.
Initially manufacturing gasoline-powered vehicles, BYD focused on plug-in hybrid and fully electric vehicles, leveraging its expertise in battery technology.
Today, BYD is the world’s largest electric vehicle manufacturer, delivering over 1.2 million electric cars globally. The company also produces electric buses, trucks, forklifts, and rail transit.
On the energy side, BYD is a major supplier of rechargeable batteries for cell phones, laptops, electric vehicles, and energy storage systems.
what is the future of Pi Network currency.DOT TECH
The future of the Pi cryptocurrency is uncertain, and its success will depend on several factors. Pi is a relatively new cryptocurrency that aims to be user-friendly and accessible to a wide audience. Here are a few key considerations for its future:
Message: @Pi_vendor_247 on telegram if u want to sell PI COINS.
1. Mainnet Launch: As of my last knowledge update in January 2022, Pi was still in the testnet phase. Its success will depend on a successful transition to a mainnet, where actual transactions can take place.
2. User Adoption: Pi's success will be closely tied to user adoption. The more users who join the network and actively participate, the stronger the ecosystem can become.
3. Utility and Use Cases: For a cryptocurrency to thrive, it must offer utility and practical use cases. The Pi team has talked about various applications, including peer-to-peer transactions, smart contracts, and more. The development and implementation of these features will be essential.
4. Regulatory Environment: The regulatory environment for cryptocurrencies is evolving globally. How Pi navigates and complies with regulations in various jurisdictions will significantly impact its future.
5. Technology Development: The Pi network must continue to develop and improve its technology, security, and scalability to compete with established cryptocurrencies.
6. Community Engagement: The Pi community plays a critical role in its future. Engaged users can help build trust and grow the network.
7. Monetization and Sustainability: The Pi team's monetization strategy, such as fees, partnerships, or other revenue sources, will affect its long-term sustainability.
It's essential to approach Pi or any new cryptocurrency with caution and conduct due diligence. Cryptocurrency investments involve risks, and potential rewards can be uncertain. The success and future of Pi will depend on the collective efforts of its team, community, and the broader cryptocurrency market dynamics. It's advisable to stay updated on Pi's development and follow any updates from the official Pi Network website or announcements from the team.
Seminar: Gender Board Diversity through Ownership NetworksGRAPE
Seminar on gender diversity spillovers through ownership networks at FAME|GRAPE. Presenting novel research. Studies in economics and management using econometrics methods.
how to sell pi coins effectively (from 50 - 100k pi)DOT TECH
Anywhere in the world, including Africa, America, and Europe, you can sell Pi Network Coins online and receive cash through online payment options.
Pi has not yet been launched on any exchange because we are currently using the confined Mainnet. The planned launch date for Pi is June 28, 2026.
Reselling to investors who want to hold until the mainnet launch in 2026 is currently the sole way to sell.
Consequently, right now. All you need to do is select the right pi network provider.
Who is a pi merchant?
An individual who buys coins from miners on the pi network and resells them to investors hoping to hang onto them until the mainnet is launched is known as a pi merchant.
debuts.
I'll provide you the Telegram username
@Pi_vendor_247
how to sell pi coins at high rate quickly.DOT TECH
Where can I sell my pi coins at a high rate.
Pi is not launched yet on any exchange. But one can easily sell his or her pi coins to investors who want to hold pi till mainnet launch.
This means crypto whales want to hold pi. And you can get a good rate for selling pi to them. I will leave the telegram contact of my personal pi vendor below.
A vendor is someone who buys from a miner and resell it to a holder or crypto whale.
Here is the telegram contact of my vendor:
@Pi_vendor_247
What website can I sell pi coins securely.DOT TECH
Currently there are no website or exchange that allow buying or selling of pi coins..
But you can still easily sell pi coins, by reselling it to exchanges/crypto whales interested in holding thousands of pi coins before the mainnet launch.
Who is a pi merchant?
A pi merchant is someone who buys pi coins from miners and resell to these crypto whales and holders of pi..
This is because pi network is not doing any pre-sale. The only way exchanges can get pi is by buying from miners and pi merchants stands in between the miners and the exchanges.
How can I sell my pi coins?
Selling pi coins is really easy, but first you need to migrate to mainnet wallet before you can do that. I will leave the telegram contact of my personal pi merchant to trade with.
Tele-gram.
@Pi_vendor_247
how can I sell pi coins after successfully completing KYCDOT TECH
Pi coins is not launched yet in any exchange 💱 this means it's not swappable, the current pi displaying on coin market cap is the iou version of pi. And you can learn all about that on my previous post.
RIGHT NOW THE ONLY WAY you can sell pi coins is through verified pi merchants. A pi merchant is someone who buys pi coins and resell them to exchanges and crypto whales. Looking forward to hold massive quantities of pi coins before the mainnet launch.
This is because pi network is not doing any pre-sale or ico offerings, the only way to get my coins is from buying from miners. So a merchant facilitates the transactions between the miners and these exchanges holding pi.
I and my friends has sold more than 6000 pi coins successfully with this method. I will be happy to share the contact of my personal pi merchant. The one i trade with, if you have your own merchant you can trade with them. For those who are new.
Message: @Pi_vendor_247 on telegram.
I wouldn't advise you selling all percentage of the pi coins. Leave at least a before so its a win win during open mainnet. Have a nice day pioneers ♥️
#kyc #mainnet #picoins #pi #sellpi #piwallet
#pinetwork
where can I find a legit pi merchant onlineDOT TECH
Yes. This is very easy what you need is a recommendation from someone who has successfully traded pi coins before with a merchant.
Who is a pi merchant?
A pi merchant is someone who buys pi network coins and resell them to Investors looking forward to hold thousands of pi coins before the open mainnet.
I will leave the telegram contact of my personal pi merchant to trade with
@Pi_vendor_247
1. Certificate in
Quantitative Finance
Module 6 Assessed Assignment
2012
Luigi Piva
Multi-Variate Time Series Analysis
A multivariate time series consists of several series. Therefore, the concepts of vector and matrix are important in multivariate time series analysis
Many of the models and methods used in the univariate analysis can be generalized directly to the multivariate case, but there are situations in which the generalization requires some attention. In some situations,we need new models and methods to manage the complex relationships between different series.
I decided to use five important energy futures, importing closing data into a spreadsheets.
The time series, cover the period from 31/05/2007 to 16/07/2012:
Crude Oil
Ethanol
Gasoline
Heating Oil
Natural Gas
In the graph below we see the series . Obviously the value of each series is different from the others, to be able to easily view all the series together, all the time series start from the same point, one, and move proportionally
2. To plot this chart , all series start at one. In the subsequent period, the value is equal to one plus the variation, calculated as follows:
Value = (today'close-yesterday close) / yesterday close
The series then continues by adding the following variation to the accumulated value up to that moment.
In an initial visual inspection, the series appear to be trending. In the markets of Gasoline and Ethanol there is a positive trend, while for what concerns Crude Oil and Heating Oil,the evolution is more an oscillatory movement . There is a negative trend for the Natural Gas. Does not appear that futures have a mean-reverting behavior, meaning that they tend to move around a mean value. Again visually, it seems that Crude Oil and Heating Oil are related, as well as Ethanol and Gasoline.
-1
-0,5
0
0,5
1
1,5
2
2,5
3
1
45
89
133
177
221
265
309
353
397
441
485
529
573
617
661
705
749
793
837
881
925
969
1013
1057
1101
1145
1189
1233
1277
CL
HO
NG
GS
ET
3. If we plot daily returns, we get the following chart : from the top to the bottom, Crude Oil, Ethanol, Gasoline, Heating Oil and Natural Gas:
The behaviour is completely different. The values are moving around zero. some series (Crude Oil, Ethanol, Heating Oil) show larger daily variations if compared to other series (Gasoline, Natural Gas).
4. Flow Diagram
In the flow chart below we see the major steps we will follow in this project.
5. Augmented Dickey-Fuller Test
We may be interested, in the individual time series first . Univariate time series are integrated if can be brought to stationarity through differencing.
Using the Augmented Dickey Fuller test we can test the individual time series and see if they are stationary
The following table summarizes the results:
H0
PValue
Stat
Crude Oil
0
0.4513
-0.5477
Ethanol
0
0.8781
0.7621
Gasoline
0
0.7175
0.1787
Heating Oil
0
0.5804
-0.1955
Natural Gas
0
0.4215
-0.5561
For all time series ,the null hypothesis of unit root is not rejected, the price series are not stationary, they are probably integrated. To make the series stationary we could take the differences. The number of differences that we have to take to make the series stationary is the order of integration
For all five series the order of integration is equal to one, can be compared to variables AR1
We repeat the ADF test for the daily returns series:
H0
PValue
Stat
Crude Oil
1
<Min
-37.55
Ethanol
1
<Min
-36.28
Gasoline
1
<Min
-36.76
Heating Oil
1
<Min
-36.45
Natural Gas
1
<Min
-40.53
6. The result is obviously completely different, in all the cases the null hypothesis is rejected and the series are stationary and non-integrated.
The AR models are normally used to study stationary time series, when we speak of multi- variate time series models we refer to VAR (Vector Auto-Regression) models.
We will now use VAR models to analyze the returns of the five energy futures.
Vector Autoregressive Models
VAR is a simple and useful model for modeling our vectors of returns . We will think in terms of a model like the following:
Yt is a vector [n:1] e A is a [n:n] matrix of the coefficients of the lagged variable Yp . In this case the lag of the model is equal to 1.
Determining an appropriate number of lags
Among the various methods to derive the most appropriate number of lags, we will use Akaike Information Criterion, which requires various values : the likelihood and the number of active parameters in the model.
In practice, we can quickly obtain these data modeling our VAR for different lag (1,2,3,4 ...), keeping in mind that the first values are the most likely. To obtain the likelihood in Matlab, simply type LLF after the estimate of the model parameters. To derive the number of active parameters:
[NumParam,NumActive]=vgxcount( Model name )
To calculate Akaike Information Criterion
AIC = aicbic([LLF1, ...LLFn],[Np1,...Npn])
where LLF indicates the likelihood and Npn indicates the nth number of active parameters.
7. The lowest values of the AIC indicates the best lag.
VAR(p)
Likelihood
NumParam
AIC
1
1.5890e+004
5
-31770
2
1.5936e+004
5
-31862
3
1.6109e+004
5
-32208
4
1.6188e+004
5
-32366
Obviously, we will choose a VAR (1), model, ie with lag equal to one.
VAR(1) Parameters Estimation
In order to estimate the model using Matlab we will follow the following steps:
1. import stationary time series, collected in a matrix in excel with a series of returns in each of the columns and a number of rows equal to the observations.
2. Create the VAR model
We want to build a VAR model with one lag , a constant and five series:
Model = vgxset('n',5,'nAR',1,'Constant',true)
3. Fit the model to the data
We also want to find the values of the constants, parameters and of the covariances of the innovations:
[EstSpec,EstStdErrors,LLF,W] = vgxvarx(Model, DataMatrix);
and obviously we want to see the results
vgxdisp(EstSpec,EstStdErrors)
Then we obtain the estimates of the parameters:
8. and the covariance matrix of the residuals
Stability Check
Once fitted the model, we can control the stability of the model, given that we have no MA elements, having only AR model, the model is invertible by definition.
[isStable, isInvertible] = vgxqual(Model);
The answer is a logical operator (0.1) which represent the rejection and acceptance of the hypothesis of stability and reversibility.
9. In our case the answer (ans) is: (1.1). The model is stable and invertible.
Forecasts using a VAR model
We can use the estimated VAR model to make predictions about future values of the series studied.
[ypred,ycov] = vgxpred(Model, [],5,[],[])
Is an iterative instruction that uses the model we built and estimated to make 5 predictions about future changes in the futures prices.
11. We could check , later in this project, whether these changes are consistent with the forecasts of our VEC models on closing prices .
Closing Prices Time Series
We have already seen, with the ADF tests, that time series of prices are not stationary. We want a confirmation from the KPSS test, which evaluates the null hypothesis that a univariate time series y is trend stationary against the alternative that it is a unit root . We want this series to be integrated.
[h0,pVal0] = kpsstest(TimeSeries,'trend',false)
KPSS Test
H0
PValue
Crude Oil
1
>0.01
Ethanol
1
>0.01
Gasoline
1
>0.01
Heating Oil
1
>0.01
Natural Gas
1
>0.01
The results show that we accept the hypothesis that the processes are integrated in all the time series of derivative prices. We may calculate the order of integration of each series obtaining the number of differences required to make the series stationary.
Returning to the flowchart, rejecting the hypothesis of stationarity and having an indication of integrated processes, we continue in the right part of the scheme and apply a first test of cointegration.
12. Engle-Granger Test for Cointegration
To get information about the presence of a cointegration relationship, we will run the Engle- Granger test and T-test, this time over the entire Matrix of our futures prices.
The test has the form:
Y(:,1)=Y(:2:end)*b+X+a+e
On the left side we have the regressand , the first series, while on the right-side ofthe equation , from 2 to five in our case, we have the regressors. The key factor here are the residuals, to be more precise, the estimates of residuals. If the residuals series is stationary, the linear combination of variables is stationary
[hEG,pValEG]=egtest(DataMatrix,'test',{'t1})
we obtain the following results:
H0
PValue
t
Engle-Granger
1
0.0615
---
t.statistic
1
----
0.1
Both tests indicate the presence of cointegration in the matrix of the values of the derivatives. At this point, we want to identify the cointegration relationship.
We extract the vector of parameter b and the intercept c0 obtained running the function egcitest and form a linear combination of regression:
c0=reg.coeff(1);
b=reg.coeff(2:5);
plot(Y*[1;-b]-c0,'LineWidth',2)
13. We have a new variable that is the linear combination of the five futures.
We can see how the series is relatively stationary, moving around zero, with different clusters of volatility. That's another indication that there is a cointegration relationship.
The models that are used for the cointegrated systems are the Vector Error Correction Models (or cointegrated VAR ).
14. Vector Error Correction Models
Once a cointegration relationship has been determined, the remaining coefficients of the VEC model can be estimated using Ordinary Least Squares. Cointegrated variables tend to restore common stochastic trend, expressed in terms of error correction. The expression for a VEC (q) model ,where q is the number of lag, is the following:
Estimating a VEC Model
We said that after finding the cointegration relationship, we can determine the coefficients of the model. The term with the summation in the VEC model is similar to the VAR model.
The term that is really different is AB'yt-1. A represents the speed of adjustment to the imbalances of the model. Dx represents an exogenous variables, (not present in our case).
The matrix product AB represents our error correction coefficients
16. Simulations and Forecasts
Once the model coefficients are estimated, the underlying data generation process can be simulated. For example, the code in the script generates a single path of Monte Carlo
forecast:
17.
18.
19. In these days we can test the effectiveness of the forecast compared to the evolution of the markets, but it is clear that the predictions of such models lose value when it exceeds one or two periods , especially with daily data and without seasonal or exogenous element.
Limits of Engle-Granger Regression
The Engle-Granger method has several limitations. First, it identifies only a single cointegration relationship. This requires one of the variables to be identified as "first" among all the variables. This choice, which is usually arbitrary, will affect both test results and model estimation.
We try to go a bit further, permuting the five series and estimating the cointegration relationship for any choice of a variable as regressant
The table shows the results of the t statistic:
20. H0
PVal
1
0.0010
1
0.0010
1
0.0063
1
0.0010
1
0.0010
In our case, there is not much difference in choosing any of the five series as regressant and the other four as regressors.
Here we can see the five cointegration relationships detected by the permutation, the scale penalizes the different values but all relationships are stationary and mean-reverting.
21. Another limitation of the Engle-Granger method is that it is a two-steps procedure, with a first regression that estimates the residual series, and another regression to verify the unit root. Errors in the initial estimate are necessarily brought in the second evaluation.
Furthermore, the Engle-Granger method for the estimation of the cointegration relationships play a role in the VEC model definition. As a result, the VEC model estimates also becomes a two-step procedure
Johansen Test for Cointegration
The Johansen test for cointegration addresses many of the limitations of the Engle-Granger method. It avoids the two-step estimators and provides comprehensive tests in the presence of multiple cointegrating relationships.
His approach incorporates the maximum-likelihood test procedure in the process of estimating the model, avoiding conditional estimates. Furthermore, the test provides a framework for testing restrictions on cointegrating relationships.
The key point in the Johansen method is the ratio between the degree of the impact matrix
C = AB' and the size of its eigenvalues. The eigenvalues depend on the shape of the VEC model, and in particular on the composition of its deterministic terms. The method relies on the rank of cointegration by testing the number of eigenvalues that are statistically different from 0.
We will now run the test for the cointegration rank using the H1 default model,the form of the H1 model is:
A(B'yt-1+C0)+C1
[~,~,~,~,mles] = jcitest(Y,'model','H1','lags',2,'display','params');
The term mLes refers to the fact that the test procedure is based on the Maximum Likelihood method.
22. The results of the Johansen test for Cointegration give us more information than the Engle- Granger test. We will not take in account the case of rank equal to zero (VAR) and the case of rank equal to 5 (the data are stationary in value).
************************
Results Summary (Test 1)
Data: Y
Effective sample size: 1294
Model: H1
Lags: 1
Statistic: trace
Significance level: 0.05
r h stat cValue pValue eigVal
========================================
0 1 198.0842 95.7541 0.0010 0.0988
1 0 63.4945 69.8187 0.1443 0.0247
2 0 31.1656 47.8564 0.6613 0.0134
3 0 13.7345 29.7976 0.8550 0.0080
4 0 3.3247 15.4948 0.9503 0.0026
5 0 0.0048 3.8415 0.9445 0.0000
As expected, the null hypothesis is rejected for Rank equal to zero, while the null hypotheses are not rejected for the ranks from 2 to 4.
All the statistics (stat, cValue, pValue, eigenvalues) indicate the rank = 4 model as the most appropriate.
Parameters Estimation
In addition to the test for cointegration relationships, the test produces maximum likelihood estimates of the coefficients of the VEC model. We estimate the parameters for a VEC model with lag = 1 and rank = 4,
23. Comparing the Cointegration Analysis Strategies
Comparisons of Engle-Granger and Johansen approaches may be difficult for several reasons. First of all, the two methods are essentially different, and may disagree on inferences from the data itself
24. The Engle-Granger two-step method for the estimation of the model-VEC first estimates the cointegration relationship and then the coefficients of the model. It's very different from Johansen method of Maximum Likelihood.
However, the two approaches should provide results that are generally comparable, if both begin with the same data , searching for the same underlying relationships. Normalized cointegrating relationships discovered by one of the two methods should reflect the mechanisms of the process in the data and VEC models constructed from the reports should have comparable predictive power.
25. In our case the cointegration relationship obtained with the Engle-Granger and Johansen tests are very similar. when the results converge we get an important confirmation, given that we are using different methodologies.
Conclusions
Having said that the forecasting power of the econometric models is questionable, there are possible practical uses of these models possible.
In particular, even the VEC models obtained by the Johansen, procedures can be used to make predictions and seem to be more accurate.
We could, for example, to study the effect of these five series on the price of energy and we could study it at different timeframe (daily, hourly, high frequency). In doing so, we could insert exogenous variables, such as the dollar index or meteorological factors.
To improve the effectiveness of these models could be very useful to the use of genetic algorithms (included in Matlab and other software).