I am relatively new to R and i have been trying to create something similar to the following . See Rolling Fama French · R Views. I am struggling to chart each of the rolling factor betas as shown in the above link. I cant seem to extract them from the rolling regression function and its not possible to just plot Asset_reg. Any help would be welcomed.
Code below:
Rolling Regression
rolling_lm <- rollify(.f = function(Asset, Growth, Value, Momentum, Size,
ERP) {
lm(Asset ~ Growth + Value + Momentum + Size + ERP)
},
window = 36,
unlist = FALSE)
Asset_reg <- (roll_lm = rolling_lm(Asset,Growth, Value, Momentum, Size,
ERP))