Created
August 22, 2011 15:47
-
-
Save zachmayer/1162717 to your computer and use it in GitHub Desktop.
Recession forecasting II- Hussman's Accuracy
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
#Actual Recessions | |
getSymbols('USREC',src='FRED') | |
USREC <- USREC["1997-07-01::",] #Start from same period | |
#Compare recession now to warning last month | |
library(caret) | |
OneMonth <- Lag(P.Rec) | |
compare <- na.omit(merge(OneMonth,USREC)) | |
confusionMatrix(compare[,1],compare[,2],positive = '1') |
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
#Compare recession now to warning in last 6 months | |
SixMonth <- sign(apply.daily(Lag(P.Rec,1:6), sum)) | |
compare <- na.omit(merge(SixMonth,USREC)) | |
confusionMatrix(compare[,1],compare[,2],positive = '1') |
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
#Compare recession now to Recession last month | |
library(caret) | |
OneMonth <- Lag(USREC) | |
compare <- na.omit(merge(OneMonth,USREC)) | |
confusionMatrix(compare[,1],compare[,2],positive = '1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment