Source of monthly stock price : http://finance.yahoo.com/q/hp?s=U11.SI&a=00&b=3&c=2000&d=04&e=14&f=2016&g=m
I took the price from year 2000 to year 2016.
## 'data.frame': 197 obs. of 2 variables:
## $ Date : chr "1/3/2000" "2/1/2000" "3/1/2000" "4/3/2000" ...
## $ Adj.Close: num 8.37 7.3 7.03 7.97 6.29 7.57 8.3 9.04 8.37 8.71 ...
## Adj.Close
## 1/3/2000 8.37
## 2/1/2000 7.30
## 3/1/2000 7.03
## 4/3/2000 7.97
## 5/1/2000 6.29
## 6/1/2000 7.57
Calculate simple returns
## [1] "numeric"
## 2/1/2000 3/1/2000 4/3/2000 5/1/2000 6/1/2000 7/3/2000
## -0.12783751 -0.03698630 0.13371266 -0.21079046 0.20349762 0.09643329
Compare simple and continuously compounded returns
## 2/1/2000 3/1/2000 4/3/2000 5/1/2000 6/1/2000 7/3/2000
## -0.13677954 -0.03768764 0.12549779 -0.23672342 0.18523200 0.09206245
## sbux_ret sbux_ccret
## 2/1/2000 -0.12783751 -0.13677954
## 3/1/2000 -0.03698630 -0.03768764
## 4/3/2000 0.13371266 0.12549779
## 5/1/2000 -0.21079046 -0.23672342
## 6/1/2000 0.20349762 0.18523200
## 7/3/2000 0.09643329 0.09206245
Graphically compare the simple and continuously compounded returns
# Plot the returns on the same graph
plot(sbux_ret, type="l", col="blue", lwd=2, ylab="Return", main="Monthly Returns")
# Add horizontal line at zero
abline(h=0)
# Add a legend
legend(x="bottomright", legend=c("Simple", "CC"), lty=1, lwd=2, col=c("blue","red"))
# Add the continuously compounded returns
lines(sbux_ccret, col="red", lwd=2)