Showing posts with label How to use Vector autoregressive models (VAR) in the stock market. Show all posts
Showing posts with label How to use Vector autoregressive models (VAR) in the stock market. Show all posts

Thursday, August 1, 2019

How to use Vector autoregressive models (VAR) in the stock market

How to use Vector autoregressive models (VAR) in the stock market.

We get data MSFT from '2004-01-02', to='2019-07-30'
Draw chartSeries(ClCl(MSFT))
https://3159fhojn2sad855sm1blf1y9c.hop.clickbank.net
forecast,cointegrated var model,dissertation writing uk,dissertation writing tips,statistical analysis,reviews,how to use eviews,eviews software,how to estimate var,var tutorial,help with var,bvar,dissertation help,bayesian var,mcmc,simultaneous equation models,vector auto regressive

 MSFT.ret <- diff(log(Ad(MSFT)))
> MSFT.M <- to.monthly(MSFT.ret)$MSFT.ret.Close
ret <- dailyReturn(Cl(MSFT), type='log')
par(mfrow=c(2,2))
> acf(ret, main="Return ACF");
> pacf(ret, main="Return PACF");
> acf(ret^2, main="Squared return ACF");
> pacf(ret^2, main="Squared return PACF")
> par(mfrow=c(1,1))
> m=mean(ret);s=sd(ret);
> par(mfrow=c(1,2))
hist(ret, nclass=40, freq=FALSE, main='Return histogram');curve(dnorm(x,
+      mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
> plot(density(ret), main='Return empirical distribution');curve(dnorm(x,
+     mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
https://www.r-languagestatistics.co

> par(mfrow=c(1,1))
plot(density(ret), main='Return EDF - upper tail', xlim = c(0.1, 0.2),
+      ylim=c(0,2));
> curve(dnorm(x, mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
> plot(density(ret), xlim=c(-5*s,5*s),log='y', main='Density on log-scale')


Black-Scholes formula-R

 Black-Scholes formula-R > BlackScholes <- function(TypeFlag = c("c", "p"), S, X, Time, r, b, sigma) { TypeFla...