Using R, I want to run a linear regression to estimate the abnormal return on days with positive, negative and neutral news (CLASS). I'm a beginner in R, as well as in using regression models! First of all the data structure is as follows. CONTROLVAR just represents all the columns I use as control variables.
DATE <- c("1","2","3","4","5","6","7","1","2","3","4","5","6","7")
COMP <- c("A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B")
RET <- c(-2.0,1.1,3,1.4,-0.2, 0.6, 0.1, -0.21, -1.2, 0.9, 0.3, -0.1,0.3,-0.12)
CLASS <- c("positive", "negative", "aneutral", "positive", "positive", "negative", "aneutral", "positive", "negative", "negative", "positive", "aneutral", "aneutral", "aneutral")
SUBJECT.1 <- c("LITIGATION","LAYOFF","POLLUTION","CHEMICAL DISASTER","PRESS RELEASE","PEOPLE","EMISSIONS","ENERGY","WASTE MANAGEMENT","EMPLOYEES","SUBJECT11","SUBJECT12","SUBJECT13","SUBJECT14")
SUBJECT.2 <- c("POLLUTION","EMPLOYEES","NUCLEAR","FUELS","STOCK OPTION PLAN","EXECUTIVES","CO2","SOLAR","POLLUTION","EXECUTIVES","SUBJECT21","SUBJECT22","SUBJECT23","SUBJECT24")
SUBJECT.3 <- c("ENVIRONMENT","JOB REDUCTIONS","POWER PLANTS","POLLUTION","EMPLOYEES","FRAUD","CLIMATE CHANGE","SUSTAINABILITY","HAZARDOUS WASTE","BONUS PAY","SUBJECT31","SUBJECT32","SUBJECT33","SUBJECT34")
CONTROLVAR <- c("11","13","13","14","13","14","12","11","13","13","14","13","14","12")
df <- data.frame(DATE, COMP, RET, CLASS, SUBJECT.1, SUBJECT.2, SUBJECT.3, CONTROLVAR, stringsAsFactors=F)
df
# DATE COMP RET CLASS SUBJECT.1 SUBJECT.2 SUBJECT.3 CONTROLVAR
# 1 1 A -2.00 positive LITIGATION POLLUTION ENVIRONMENT 11
# 2 2 A 1.10 negative LAYOFF EMPLOYEES JOB REDUCTIONS 13
# 3 3 A 3.00 aneutral POLLUTION NUCLEAR POWER PLANTS 13
# 4 4 A 1.40 positive CHEMICAL DISASTER FUELS POLLUTION 14
# 5 5 A -0.20 positive PRESS RELEASE STOCK OPTION PLAN EMPLOYEES 13
# 6 6 A 0.60 negative PEOPLE EXECUTIVES FRAUD 14
# 7 7 A 0.10 aneutral EMISSIONS CO2 CLIMATE CHANGE 12
# 8 1 B -0.21 positive ENERGY SOLAR SUSTAINABILITY 11
# 9 2 B -1.20 negative WASTE MANAGEMENT POLLUTION HAZARDOUS WASTE 13
# 10 3 B 0.90 negative EMPLOYEES EXECUTIVES BONUS PAY 13
# 11 4 B 0.30 positive SUBJECT11 SUBJECT21 SUBJECT31 14
# 12 5 B -0.10 aneutral SUBJECT12 SUBJECT22 SUBJECT32 13
# 13 6 B 0.30 aneutral SUBJECT13 SUBJECT23 SUBJECT33 14
# 14 7 B -0.12 aneutral SUBJECT14 SUBJECT24 SUBJECT34 12
This regression model would look like this:
mymodel1 <- lm(RET ~ CLASS + CONTROLVAR, data=df)
aneutral (neutral) will be the reference category. I would also like to see the effect of certain subjects of the article on the abnormal return. How can I do that? Let's say I want to include the subjects LITIGATION, POLLUTION and LAYOFF. I'd like to see how the effect of positive, negative and neutral news change, if the article is about POLLUTION for example. If I make "dummy columns" for the three subjects of interest, my data.frame looks like this:
DATE <- c("1","2","3","4","5","6","7","1","2","3","4","5","6","7")
COMP <- c("A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B")
RET <- c(-2.0,1.1,3,1.4,-0.2, 0.6, 0.1, -0.21, -1.2, 0.9, 0.3, -0.1,0.3,-0.12)
CLASS <- c("positive", "negative", "aneutral", "positive", "positive", "negative", "aneutral", "positive", "negative", "negative", "positive", "aneutral", "aneutral", "aneutral")
SUBJECT.1 <- c("LITIGATION","LAYOFF","POLLUTION","CHEMICAL DISASTER","PRESS RELEASE","PEOPLE","EMISSIONS","ENERGY","WASTE MANAGEMENT","EMPLOYEES","SUBJECT11","SUBJECT12","SUBJECT13","SUBJECT14")
SUBJECT.2 <- c("POLLUTION","EMPLOYEES","NUCLEAR","FUELS","STOCK OPTION PLAN","EXECUTIVES","CO2","SOLAR","POLLUTION","EXECUTIVES","SUBJECT21","SUBJECT22","SUBJECT23","SUBJECT24")
SUBJECT.3 <- c("ENVIRONMENT","JOB REDUCTIONS","POWER PLANTS","POLLUTION","EMPLOYEES","FRAUD","CLIMATE CHANGE","SUSTAINABILITY","HAZARDOUS WASTE","BONUS PAY","SUBJECT31","SUBJECT32","SUBJECT33","SUBJECT34")
LITIGATION <- c(1,0,0,0,0,0,0,0,0,0,0,0,0,0)
POLLUTION <- c(1,0,1,1,0,0,0,0,1,0,0,0,0,0)
LAYOFF <- c(0,1,0,0,0,0,0,0,0,0,0,0,0,0)
CONTROLVAR <- c("11","13","13","14","13","14","12","11","13","13","14","13","14","12")
df2 <- data.frame(DATE, COMP, RET, CLASS, SUBJECT.1, SUBJECT.2, SUBJECT.3, LITIGATION, POLLUTION, LAYOFF, CONTROLVAR, stringsAsFactors=F)
df2
# DATE COMP RET CLASS SUBJECT.1 SUBJECT.2 SUBJECT.3 LITIGATION POLLUTION LAYOFF CONTROLVAR
# 1 1 A -2.00 positive LITIGATION POLLUTION ENVIRONMENT 1 1 0 11
# 2 2 A 1.10 negative LAYOFF EMPLOYEES JOB REDUCTIONS 0 0 1 13
# 3 3 A 3.00 aneutral POLLUTION NUCLEAR POWER PLANTS 0 1 0 13
# 4 4 A 1.40 positive CHEMICAL DISASTER FUELS POLLUTION 0 1 0 14
# 5 5 A -0.20 positive PRESS RELEASE STOCK OPTION PLAN EMPLOYEES 0 0 0 13
# 6 6 A 0.60 negative PEOPLE EXECUTIVES FRAUD 0 0 0 14
# 7 7 A 0.10 aneutral EMISSIONS CO2 CLIMATE CHANGE 0 0 0 12
# 8 1 B -0.21 positive ENERGY SOLAR SUSTAINABILITY 0 0 0 11
# 9 2 B -1.20 negative WASTE MANAGEMENT POLLUTION HAZARDOUS WASTE 0 1 0 13
# 10 3 B 0.90 negative EMPLOYEES EXECUTIVES BONUS PAY 0 0 0 13
# 11 4 B 0.30 positive SUBJECT11 SUBJECT21 SUBJECT31 0 0 0 14
# 12 5 B -0.10 aneutral SUBJECT12 SUBJECT22 SUBJECT32 0 0 0 13
# 13 6 B 0.30 aneutral SUBJECT13 SUBJECT23 SUBJECT33 0 0 0 14
# 14 7 B -0.12 aneutral SUBJECT14 SUBJECT24 SUBJECT34 0 0 0 12
The first problem is, that the dummy variables partially overlap. My model would look something like this.
mymodel2 <- lm(RET ~ CLASS + LITIGATION + POLLUTION + LAYOFF
+ LITIGATION * CLASS + POLLUTION * CLASS + LAYOFF * CLASS # Interaction Variables
+ CONTROLVAR, # Control Variables
data=df2)
I'm quite sure this model is wrong, but I don't know exactly what is wrong and how to implement a model that works for this task. Can anyone help me with this problem? Thank You!