Hi everyone,
My current code is this:
Model <- head(rollapply(z, width = 131, function(x) fitted(lm(y ~x1+ x2, data = as.data.frame(x))), by.column = FALSE, align = “right”) [,131],3429)
I would like to do this:
fit1 <- lm(y ~x1+ x2)
Model <- head(rollapply(z, width = 131, function(x) fitted(fit1), data = as.data.frame(x))), by.column = FALSE, align = “right”) [,131],3429)
Basically, I’m just trying to sub in “fit1” for the regression equation, but I keep getting an error…any help would be much appreciated. Thanks.