I have a large panel dataset containing daily observations for different stocks. It looks like this: https://i.stack.imgur.com/FOoX0.jpg (the variable symbol depicts the different stocks).
I want to run the following regression for each stock i between day t and day t - 21:
I tried to do this using rollregres:
fit_ivol <- roll_regres(panel_data$excess_return_stock ~ panel_data$excess_return_market + panel_data$SMB + panel_data$HML, panel_data, width=list(c(0:-20)), do_compute = "sigmas")
but since the first value of excess_return_stock for each symbol is NA, I get an error message saying "Error in na.fail.default(list(panel data$excess_return_stock = c(NA, : missing values in object".
Is there a way to tell rollregres to just skip the rows containing NAs?