Created
November 21, 2020 04:46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## TESTING FOR STRUCTURAL CHANGE ---- | |
## There appears to be structural differences in valuation during the 1920's and 1930's and then again in the last 60's | |
## and early 70's. Run a version of the Chow Test with dummy variables to determine if there were structural breaks. | |
## Define dummy variables for 20's & 30's and 60's & 70's separately. We are creating two dummy variables as we don't | |
## know if the nature of the structural change is the same or different for the two time periods. | |
df.3$D1 <- NA | |
df.3$D2 <- NA | |
for(i in 1:length(df.3$Dates)){ | |
if(df.3$Dates[i] < 1940){ | |
df.3$D1[i] <- 1 | |
} else { | |
df.3$D1[i] <- 0 | |
} | |
if(df.3$Dates[i] > 1965 & df.3$Dates[i] < 1975){ | |
df.3$D2[i] <- 1 | |
} else { | |
df.3$D2[i] <- 0 | |
} | |
} | |
## Create Interaction terms between dummy variables and CAPE Ratio. | |
df.3$I1 <- df.3$CAPE*df.3$D1 | |
df.3$I2 <- df.3$CAPE*df.3$D2 | |
## Chow Test Model | |
chow_model <- lm(df.3$Annualized ~., data = df.3[ ,c(-2,-3)]) | |
summary(chow_model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment