For this problem, use the Yahoo! Finance website (http://finance yahoo.com/) or
ID: 3789824 • Letter: F
Question
For this problem, use the Yahoo! Finance website (http://finance yahoo.com/) or a Bloomberg terminal. Choose an equity and download its daily prices for the whole year of 2016. Read the input file into a variable and print its first lines of data using the command head. Study how the plot command works and make a plot of the daily close prices (if you downloaded data from Yahoo! Finance, use the Adj. Close column). Please include a title and labels for each of the axes in the plot With the close prices once again, compute the corresponding series of log-returns. Make another plot and report the summary statistics using the command summary. Do a box plot of the log-returns and verify if there are any outliers. Do a normal qqplot with the log-returns series and comment your results. Using the log-returns computed in Problem 2, do the following: Compute the mean and standard deviation of the series without using the built-in mean and std functions (of course, you can always use these functions to verify your results). Use your code from (a) to create a function that receives a vector as input and outputs its mean and standard deviation.Explanation / Answer
1)
a) mydata = read.csv("mydata.csv");
head(mydata,1)
b)
plot(mydata$Close,type = "o", col = "red", xlab = "Index", ylab = "Close",
main = "close chart")
c)
close<-mydata$Close;
lc<-sapply(close,function(x) log(x));
logclose<-sapply(lc,function(x) diff(x));
plot(x=logclose,y=x,type = "o", xlim=c(0,10),col = "red", xlab = "close", ylab = "lab",
+ main = "close log chart")
summary(logclose)
d) boxplot(logclose, las = 2,ylim=c(0,10))
e)
qqline(lc)
2)
mean<-sapply(lc,function(x) sum(x)/length(x));
sd<-sd(lc);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.