Open afmass opened 3 days ago
In Lines 20-24, of run_Factor_Model_HB_selection.R
training and testing periods are being defined.
date.start.month <- seq(as.Date("2001-12-01"),length=200,by="months")
date.end.month <- seq(as.Date("2002-01-01"),length=200,by="months")-1
tst.dt.start.mnth <- seq(as.Date("2002-01-01"),length=200,by="months")
tst.dt.end.mnth <- seq(as.Date("2002-02-01"),length=200,by="months")-1
Now you take first period j=1
then you have:
## First Training period
> date.start.month[1]
[1] "2001-12-01"
> date.end.month[1]
[1] "2001-12-31"
## Test period corresponding first training period
> tst.dt.start.mnth[1]
[1] "2002-01-01"
> tst.dt.end.mnth[1]
[1] "2002-01-31"
Then if you look at Line 35, for j=1
it will take the above date.start.month[j]
and date.end.month[j]
check<-Factor_Model_HB_selection(start=date.start.month[j],end=date.end.month[j],nmc=1000,burn=500,month_id=j)
It generates the output for this specific month. This output goes into the Factor_Model_HB_Back_testing.R
as input and build the portfolio using the highest posterior estimates of the P(α > 0| data)
for ns(=25)
stocks. It computes the portfolio return for next month i.e.,
> tst.dt.start.mnth[1] --> "2002-01-01"
> tst.dt.end.mnth[1] --> "2002-01-31"
(as out-of-sample or test-sample portfolio return).
As currently written in this repo, the
Month_1.Rdata
produced byrun_Factor_Model_HB_selection.R
corresponds with December 2001 yetMonth_1.Rdata
used inBack_Testing.R
corresponds to December 2005. This seems like it is not plausible. The troubling part that I don't understand is that I was able to reproduce your plots used in your article from the code based on the discrepancy. What do I not understand here?Note that this doesn't change the fundamental result you stated that BO demonstrates model inefficiency.