help using rollapply

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #897
    rbowman16
    Member

    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.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Scroll to top
Privacy Policy