Question: Using R Programming Based on quarterly closing prices and adjusted closing prices on Exxon-Mobile (ticker XOM) from 1980Q1 to 2017Q4, a. Plot these two prices
Using R Programming
Based on quarterly closing prices and adjusted closing prices on Exxon-Mobile (ticker XOM) from 1980Q1 to 2017Q4,
a. Plot these two prices together on a single diagram.
b. Calculate the quarterly simple returns with and without dividends. Annualize the quarterly simple returns simply by a factor of 4. What are the average annualized quarterly returns for XOM with and without dividends? Are they different?
c. For an investor holding XOM, how many quarters there are positive returns without taking dividends into consideration? What is the answer if we take dividends into consideration?
R extra
To get quarterly prices, the simplest way is to get the daily prices from 1980-1-1 to 2017-12-31 by using
get.hist.quote(instrument=XOM,start=1980-1-1,end=2017-12-31, quote=c(Close,Adjusted))
and then use aggregate(y,as.yearqtr,tail,1) to convert to quarterly prices.
To plot two series on the same diagram, use plot to plot the first series, use lines to add the second series.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
