#imports the library
#install.packages("fImport") #installs if required
library(fImport)
#stock names
stockNames=c("GOOG")
#adjusted columns indices
adjustedIndex=NULL
for(i in 1:length(stockNames)) adjustedIndex[i]=i*6
#downloads all the stock data
stockData=yahooSeries(
#gets the returns
returnData= returns(stockData)
#plots the stock data for all stocks
plot(stockData,main="Prices")
#plots the returns for all stocks
plot(returnData,main="Returns"
#stores the returns data without time series
returnsArray = array(1:1,dim=c(length(
for(i in 1:length(stockNames)) returnsArray[1:length(
#for plotting the prices data without time series
prices = array(1:1,dim=c(length(
for(i in 1:length(stockNames)) prices[1:length(stockData[,i])
#makes the multiple plots
par(mfrow=c(length(stockNames)
for(i in 1:length(stockNames)) plot(density(returnsArray[,i])
#makes the qqnorm plots
for(i in 1:length(stockNames)) qqnorm(returnsArray[,i],main=
#contains back the plotting window
par(mfrow=c(1,1), pch=1)
No comments:
Post a Comment