In this homework, we interested in how stocks perform in terms of excess rates of return when they are actually paying a dividend. The data was retrieved from the WRDS dataset library and the selected variables are RET: Holding Period Return RETX: Return without Dividends RCRDDT: Record Date SPRTRN: Return on S&P Composite Index
The targeted company selected are Apple.Inc (AAPL),Tesla,Inc. (TSLA), IBM Inc.(ibm) and Microsoft Inc.(msft). setting the dividend declaration date as “day 0” and setting days before the dividend paying date as negative number (i.e 20 days before would be -20 day) and days after the dividend paying date as (positive numbers).
Setting the time interval as 41 days, take the mean of the dividend paying period and non-dividend paying period, then plotted in line chart.
| Trading Days | Excess return |
|---|---|
| -20 | -0.0004000 |
| -19 | 0.0002934 |
| -18 | 0.0004460 |
| -17 | 0.0029078 |
| -16 | 0.0007078 |
| -15 | -0.0014048 |
| -14 | -0.0011074 |
| -13 | -0.0041604 |
| -12 | -0.0019563 |
| -11 | 0.0016020 |
| -10 | 0.0016640 |
| -9 | 0.0004620 |
| -8 | 0.0006039 |
| -7 | 0.0012819 |
| -6 | 0.0015997 |
| -5 | -0.0003601 |
| -4 | 0.0001758 |
| -3 | 0.0010668 |
| -2 | 0.0004078 |
| -1 | -0.0002196 |
| 0 | 0.0008466 |
| 1 | -0.0007087 |
| 2 | 0.0018925 |
| 3 | -0.0017153 |
| 4 | -0.0003363 |
| 5 | 0.0004798 |
| 6 | 0.0001777 |
| 7 | 0.0025783 |
| 8 | 0.0009316 |
| 9 | 0.0001559 |
| 10 | -0.0003486 |
| 11 | -0.0001962 |
| 12 | -0.0006301 |
| 13 | 0.0000833 |
| 14 | -0.0006611 |
| 15 | -0.0002510 |
| 16 | 0.0011934 |
| 17 | -0.0002962 |
| 18 | -0.0003807 |
| 19 | -0.0009140 |
| 20 | 0.0017709 |
| Trading Days | Excess return |
|---|---|
| -20 | -0.0004000 |
| -19 | 0.0002934 |
| -18 | 0.0004460 |
| -17 | 0.0029078 |
| -16 | 0.0007078 |
| -15 | -0.0014048 |
| -14 | -0.0011074 |
| -13 | -0.0041604 |
| -12 | -0.0019563 |
| -11 | 0.0016020 |
| -10 | 0.0016640 |
| -9 | 0.0004620 |
| -8 | 0.0006039 |
| -7 | 0.0012819 |
| -6 | 0.0015997 |
| -5 | -0.0003601 |
| -4 | 0.0001758 |
| -3 | 0.0010668 |
| -2 | 0.0004078 |
| -1 | -0.0002196 |
| 0 | -0.0051942 |
| 1 | -0.0007087 |
| 2 | 0.0018925 |
| 3 | -0.0017153 |
| 4 | -0.0003363 |
| 5 | 0.0004798 |
| 6 | 0.0001777 |
| 7 | 0.0025783 |
| 8 | 0.0009316 |
| 9 | 0.0001559 |
| 10 | -0.0003486 |
| 11 | -0.0001962 |
| 12 | -0.0006301 |
| 13 | 0.0000833 |
| 14 | -0.0006611 |
| 15 | -0.0002510 |
| 16 | 0.0011934 |
| 17 | -0.0002962 |
| 18 | -0.0003807 |
| 19 | -0.0009140 |
| 20 | 0.0017709 |
By Comparing the two graphs above, we could see that Dividend-paying has a great impact on the stock excess retro on the dividend-paying day specifically. In Figure two, excess return has a huge drop if on ex-dividend date but with dividend, it helps with maintain the excess return on the regular level.
#Computer Code
library(ggplot2)
library(tidyverse)
library(dplyr)
data <- read.csv("data_file.csv")
data$excess.rtn.with.div <- (rtn-sp.rtn)
data$excess.rtn.without.div <- (rtn.no.div-sp.rtn)
data$div.payment.day <- 0
data$div.payment.day <- if(is.na(data$RCRDDT)){
data$div.payment.day <- 0
}else{
data$div.payment.day <- 21
}
data$days <- 0
n= nrow(data)
for (i in 1 : n) {
if (data$div.payment.day[i]==21 && i >= 21 && i <= (n-20) ){
check=data$PERMNO[i]
for (j in 1:41){
if(data$PERMNO[(i-(21-j))]==check){
data$div.payment.day[(i-(21-j))]=j}
}
}
}
#setting calculating period
n <- 41
days<- seq(-20,20,by=1)
#Dividend Paying Graph
div.paying<- as.matrix(cbind(seq(-20,20),c(numeric(n))),ncol=2)
div.paying<-
for (i in 1:n){
div.paying[i,2]<-data %>% select(ex.div.day,excess.rtn.with.div) %>% filter(days<= 41 &days!=0) %>% group_by(days)%>% summarize_each(excess.rtn.with.div)
}
ggplot(div.paying,aes(x=div.paying$days,y=div.paying$excess.rtn.with.div))+
geom_line()+
geom_point(colour=4,pch=20,cex=3) +
geom_vline(xintercept=0, linetype = 2, colour = 2) +
labs(title = "Excess Return with Dividend Paying within -20/+20 days ",x = "Days before and after ex-divident date " , y ="Excess return with Dividends")+
theme_classic()
with.div.table <- as.data.frame(Div)
colnames(with.div.table) <- c("Trading Days","Excess return")
knitr::kable(with.div.table)
# No dividend paying graph
no.div.paying <- as.matrix(cbind(seq(-20,20),c(numeric(n))),ncol=2)
no.div.paying <-
for (i in 1:n){
no.div.paying[i,2]<-data %>% select(ex.div.day,excess.rtn.with.div) %>% filter(days<= 41 &days!=0) %>% group_by(days)%>% summarize_each(excess.rtn.without.div)
}
ggplot(no.div.paying,aes(x=no.div.paying$V1,y=no.div.paying$v2))+
geom_line()+
geom_point(colour=4,pch=20,cex=3) +
geom_vline(xintercept=0, linetype = 2, colour = 2) +
xlab("20 days before and after ex-divident date ") +
ylab("Excess return excluding divident")+
theme_classic()
without.div.table <- as.data.frame(NoDiv)
colnames(without.div.table) <- c("Trading Days","Excess return")
without.div.table