Mathematics, Science, statistics, economics, finance, econometrics, Business Mathematics, statistical analysis, R language, Computer Science, Stock Analysis, APPLE Stock Analysis, Amazon stock Analysis, GARCH model, Arch model,q-q plot,ols, regression, Time Series, t-test, cofactor, variance, standard deviation,Matlab,Nifty 50 Analysis,BMW stock analysis,

Email Subscribers

Enter your email address:

Delivered by FeedBurner

Wednesday, 30 January 2019

Equity Return Calculation

Equity Return Calculation
SieDates <- as.character(format(as.POSIXct(attr(siemens,"times")),"%Y-%m-%d"))
SieRet <- timeSeries(siemens * 100,charvec = SieDates)
colnames(SieRet) <- "SieRet"
## Stylised Facts 1
par(mfrow = c(2,2))
seriesPlot(SieRet,title = FALSE,main = "Daily Returns of Siemens",col = "blue")
boxPlot(SieRet, title = FALSE, main = "Box plot of Returns",col = "red",cex =0.5,pch = 19)
acf(SieRet,main ="ACF of Returns",lag.max = 20, ylab = "", xlab ="",col = "blue",ci.col = "red")
pacf(SieRet,main ="PACF of Returns",lag.max = 20,ylab ="",xlab= "",col="blue",ci.col="red")

## Stylised Facts II
SieRetAbs <- abs(SieRet)
SieRet100 <- tail(sort(abs(series(SieRet))), 100)[1]
idx <- which(series(SieRetAbs) > SieRet100,arr.ind =TRUE)
SieRetAbs100 <- timeSeries(rep(0,length(SieRet)),charvec = time(SieRet))
SieRetAbs100[idx , 1] <- SieRetAbs[idx]
acf(SieRetAbs,main="ACF of Absolute Returns",lag.max = 20,ylab="",xlab="",col ="blue",ci.col="red")
pacf(SieRetAbs,main="PACF of Absolute Returns",lag.max = 20, ylab="", xlab="",col="blue",ci.col="red")
qqnormPlot(SieRet,main="QQ-Plot of Returns",title = FALSE,col = "blue",cex = 0.5,pch= 19)
plot(SieRetAbs100,type="h",main="Volatility Clustering",ylab="",xlab="",col="blue")

No comments:

Post a Comment

Linear filtering to a univariate 'timeSeries'

Applies linear filtering to a univariate 'timeSeries' > x <- MSFT[1:12, ] > x GMT               Open    High     ...