Sunday, 28 April 2013

Why is it important?

India has a lot to achieve in terms of becoming a developed nation from an economic standpoint. An aspect which, in my opinion, is of utmost importance is the formation of structurally sound and robust financial markets. A prerequisite for that is active participation of educated and informed traders in the market place which would result in better price discovery and in turn better functioning market in general.

Statistical modelling techniques supplemented with some subject understanding could be an informed trading strategy. In the long run it might not be possible to outplay the market using a simple backward looking statistical model, but in the short run intelligent estimates based on model and subject matter expertise could prove to be helpful. In our previous posts with Infosys stock prices, we used basic visualization and simple linear regression techniques to try and predict the future returns from historical returns. Lets step on the pedal and move over to some more sophisticated techniques to do the same. We will start with the same basics of running basic checks on the data and then take a deeper dive in terms of modelling technique to use.

There seems to be a lot of randomness in the series and the adf.test results prove that the series is non-stationary (I(1)). Which means that the series will have to be first differenced to make is stationary. (Refer to this post for more understanding on stationarity).

Auto-regressive moving average (ARMA) model

There is one primary difference between time series and cross sectional datasets and that is the presence of auto-correlation in time series data. The concept of auto-correlation is not applicable to cross sectional regression as there is no dependence in the observations. However, there is explicit dependent of time series' future value on its near past values. We arrive at the estimates in a time series model after solving the Yule Walker equations unlike MLE or simple OLS techniques in the case of cross sectional linear regressions.

The idea of an ARMA model is fairly intuitive to understand, however, the math gets extremely tricky. We will take a crack at explaining what an ARMA model is in laymen language. A typical ARMA(1,1) model can be expressed as :

The (1,1) in the equation stand for the auto-regressive(\( z_{t} \)) and moving average(\( \epsilon_{t} \)) lag orders respectively. The intuitive understanding of the above equation is pretty straightforward. The current value of the time series \( z_t \) will depend on the past value of the series \( z_{t-1} \) and will correct itself to the error made in the last time period \( \epsilon_{t-1} \). Lets try and fit an ARMA model to our INFY returns data and see how the results turn out.

We can see that AR as well as MA coefficients are all significant at 99%, evident from the small p-values. Since our objective here is to forecast future returns lets evaluate the performance of the ARMA model in terms of out-of-sample forecast performance. For this we will divide the data into 2 parts, on one we will train the model and on the other we will test the out-of-sample forecast ability.

Here Wehave used ARIMA function to fit the model as the object type “arima” is easily compatible with forecast() and predict() function. ARIMA is nothing by a normal ARMA model with the order of integration included as an argument to the function. In our case, our series was I(1) but we have first differenced it already so in the ARIMA function we will keep the “I” part = 0.

Above are the results that we obtain with a simple ARMA(2,2) model. The orange and yellow region provide us the 99% and 95% confidence level for the forecasts respectively. An intrinsic shortcoming of ARMA models, which is evident from the plot above, is the assumption of mean reversion of the series. What this means is that after some time in future the forecasts would tend to the mean of the time series \( z_{t} \)'s historical values thus making it a poor model for long term predictions.

Now, there are some intuitive variables that one can introduce in the model based on subjective understanding to improve the model. In cases where one wishes to augment a simple univariate time series regression with some exogenous set of variable, ARIMAX function can be employed. In cases where the additional variables could have a feedback relation with the time series in question (i.e they are endogenous) one can employ Vector auto regressive (VAR) models. Let me try and elaborate a little on them before I start to sound confusing. In our example above in question, lets say that our hypothesis is that day of the week has an effect on the stock prices. To include this in our model all that we need is 4 new dummy variables for 4 days of the week (5th one by default goes to the intercept) and include them in the above ARMA model using ARIMAX function. Here these dummy variables will be completely exogenous to our dependent variable (INFY returns), because no matter how/what the stock price is for INFY, its not going to affect the day of the week! However, lets say we wanted to include NIFTY returns as an additional variable in the analysis, a VAR model would be preferable. The reason being that there could be a feedback relation between INFY returns and NIFTY returns which might be ignored if we use a simple ARIMAX function.

ARIMA model with day of the week variable

We will try and illustrate with an example the former where we will use day of the week as an exogenous variable to augment our ARMA model for INFY returns. The ARIMAX model can be simply written as:

The performance of the ARIMA model with weekdays factor variable seems to be better than a simple ARMA model which is evident from the lower RMSE of the ARIMAX model. This is just one example of variables that could be used to augment a simple ARMA model, there could be many more variants of such variables that might further increase the performance of the model. In the next post we would try to cover vector auto regression and how/when it can be used.

This transformation is the "thumb rule" transformation applied to non-stationary (I(1)) series to make them stationary. Log was simply taken to scale down the price values and the first difference was taken to remove the non-stationarity.

I think that what you did in the second part of the example is a regression with ARMA errors, not an ARMAX model. If you look at the ?arima help file in R, you can see in the details of the function this: "If an xreg term is included, a linear regression (with a constant term if include.mean is true and there is no differencing) is fitted with an ARMA model for the error term.", so if I understand well, you actually fitted a linear regression with an ARMA(2,2) on the errors.

I think the confusion is arising because I have used the term "ARIMAX" loosely. What I have done in the second part of the post is just an ARIMA model with an exogenous variable which, I have wrongly, termed as "ARIMAX" regression in some parts of the post. ARIMAX regression is different ball game altogether.

Seriously, it great way of getting stock returns using ARIMA model. I read post shared by you. You explained very well. I will certainly consider it. Thank you so much for informative post on stock! best online trading platforms

Now that you just acknowledge a number of tips on Forex, you'll be able to either get your feet wet or come back to into the sport armed with new information. Apply what you've got scan throughout this text and you are sure to be making higher trades and exchanges, in no time within the slightest degree. To know more forex signals

Trading of foreign currency or Forex trading as it is known is an easy way to make huge money by investing a small amount. There have been many traders who have, made huge profits by using the expert advice from others who have been on the forex platform for many years. Number of reasons makes Forex market the best place for investors who like their money to grow quickly. The highest daily turnover sure makes the Forex market the best place for any new trader to get accustomed with ups and downs of stock market. To know more about forex signals trading. You visit and join us: forex signals

Beginners of the commerce must be made aware that forex trading is a excessive danger investment. The foreign money market gives a number of alternative to earn big amounts of earnings however at the identical time coupled with loads of risks. Foreign money buying and selling can provide you a fortune in minutes, days and hours. However the sad truth is that it can be misplaced simply on the identical time. To know more visit forex signals

ForexFunction is providing one of the best trading signal service in the world. They have daily analysis section, trading idea, live signals, profitable strategy and much more. They have Trade copier service with free profitable forex signals. Come and join with this website.

1. We provide VPS with market lowest price.2. We provide quality VPS from worldwide server.3. Our server located in USA, Canada, Europe, UK.4. Our VPS specially developed for Forex Trader.5. We provide 24/7 professional support to our clients.6. We can ensure that you will get 100% uptime.

Still thinking? Nothing to worry, we will provide you 30 days money back guarantee.

Forex buying and selling is one some of the top notch methods that to make money in case you're experienced and strategic. It’s one such field where people need to take masses of decisions and therefore the markets will alternate within the matter of a couple of minutes. Consequently, if you're looking to make a fortune out of foreign exchange trading, you wish to utilize forex signals as these alerts can manual you concerning the best methods of building cash from foreign exchange marketplace. At extraordinary foreign exchange signals, you will locate some of the excellent Forex-signals plans with the intention to emerge as handy. UsaForexSignal have a exclusive plans and you may be able to pick those that seem to suit you. There are numerous choices to decide on from that you just will realize those that might suit your need as well as your finances.So, in case you're one in every of people who wish to shape money through finance in forex, you may positively avail the offerings of UsaForexSignal Signals. The performance record that UsaForexSignal've got is spectacular. Usaforexsignal are going to offer you updates and pointers referring to the diverse changes in the forex market and the subsequent pointers will show to be extraordinarily useful. Usaforexsignal have got facilitated lots of individuals gather money in Online Forex signals and you can also enjoy UsaForexSignal help.

Foreign exchange, or foreign exchange, is the simultaneous exchange of 1 us of a's forex for that of another.The manner it really works is an investor who wishes to buy or sell one currency for every other with the hope of creating a income while the value of the currencies change in choose of the investor. This could manifest both from marketplace news, or occasions that manifest throughout the globe. For instance, if to procure foreign money and the rate appreciates in price, then you will earn a profit by using closing your role. When you try this and sell the forex again so that it will lock within the income, you're in reality buying the counter forex in the pair. With the aid of trading foreign money pairs, one forex valued in opposition to any other, a price of really worth has been mounted. The reason is because a rustic's currency has value only relative to the currency of some other us of a.forex signals serviceForex signals